From f19721b98346b9493f3ecb5cd41527e102c7fedf Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 16 Aug 2017 14:15:43 -0700 Subject: [PATCH] Support -pg with GCC defaulting to PIE -pg and -pie are mutually exclusive since they need different crt1.o, gcrrt1.o vs Scrt1.o. Make -pg overrdies -pie. * Makeconfig (+link-pie-before-libc): Add CRT-* hook to override the startup object. --- Makeconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makeconfig b/Makeconfig index 5f2469116c..b51904b797 100644 --- a/Makeconfig +++ b/Makeconfig @@ -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))\ -- 2.13.5