Support mcount/gprof test with GCC defaulting to PIE
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 17 Aug 2017 11:55:44 +0000 (04:55 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 17 Aug 2017 11:56:01 +0000 (04:56 -0700)
The mcount/gprof test should be linked with gcrt1.o, not Scrt1.o.

* Makeconfig (+link-pie-before-libc): Add CRT-* hook to override
the startup object.

ChangeLog
Makeconfig

index 4505dcef1dc369950d8d095dc2979e7703ce509b..f11f6e11c7e15d6f0fa8173491cac5f4cd9cb729 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-08-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * Makeconfig (+link-pie-before-libc): Add CRT-* hook to override
+       the startup object.
+
 2017-08-17  Florian Weimer  <fweimer@redhat.com>
 
        * include/sys/socket.h (__opensock): Remove internal_function.
index 5f2469116cea1fd080e785687454a4bc841a5b96..b51904b7973e508e49ab87a8678c8fd3f9cba9a5 100644 (file)
@@ -409,7 +409,7 @@ ifndef +link-pie
 +link-pie-before-libc = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
             $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
             $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
-            $(addprefix $(csu-objpfx),S$(start-installed-name)) \
+            $(firstword $(CRT-$(@F)) $(csu-objpfx)S$(start-installed-name)) \
             $(+preinit) $(+prectorS) \
             $(filter-out $(addprefix $(csu-objpfx),start.o \
                                                    S$(start-installed-name))\