From f19721b98346b9493f3ecb5cd41527e102c7fedf Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
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(-)
@@ -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