Issue #8009 has been reported by tmm1 (Aman Gupta).

----------------------------------------
Bug #8009: `make MAINLIBS=-ltcmalloc` does not work with new versions of gcc
https://bugs.ruby-lang.org/issues/8009

Author: tmm1 (Aman Gupta)
Status: Open
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: build
Target version: 
ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474)


With newer versions of gcc, linker arguments must appear after object files.


diff --git a/Makefile.in b/Makefile.in
index 45eb7c6..a93a1e6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -194,12 +194,12 @@ all:
 miniruby$(EXEEXT):
                @-if test -f $@; then $(MV) -f $@ $@.old; $(RM) $@.old; fi
                $(ECHO) linking $@
-               $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(DTRACE_OBJ) $(LIBS) $(OUTFLAG)$@
+               $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(DTRACE_OBJ) $(MAINLIBS) $(LIBS) $(OUTFLAG)$@
 
 $(PROGRAM):
                @$(RM) $@
                $(ECHO) linking $@
-               $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) $(EXTLIBS) $(OUTFLAG)$@
+               $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(MAINLIBS) $(LIBS) $(EXTLIBS) $(OUTFLAG)$@
                $(Q) $(POSTLINK)
 
 # We must `rm' the library each time this rule is invoked because "updating" a



-- 
http://bugs.ruby-lang.org/