|
|
077c9d |
commit e30fb31c0ad8d31babd1d0d0f05e37c6579a870b
|
|
|
077c9d |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
077c9d |
Date: Fri Apr 26 07:16:47 2019 +0200
|
|
|
077c9d |
|
|
|
077c9d |
Makeconfig: Move $(CC) to +link command variables
|
|
|
077c9d |
|
|
|
077c9d |
This change is needed to add linker flags which come very early in the
|
|
|
077c9d |
command linke (before LDFLAGS) and are not applied to test programs
|
|
|
077c9d |
(only to installed programs).
|
|
|
077c9d |
|
|
|
077c9d |
diff --git a/Makeconfig b/Makeconfig
|
|
|
077c9d |
index 742c0c0783a14bfa..1ad25fc5a7251aea 100644
|
|
|
077c9d |
--- a/Makeconfig
|
|
|
077c9d |
+++ b/Makeconfig
|
|
|
077c9d |
@@ -415,7 +415,7 @@ link-extra-libs-tests = $(libsupport)
|
|
|
077c9d |
|
|
|
077c9d |
# Command for linking PIE programs with the C library.
|
|
|
077c9d |
ifndef +link-pie
|
|
|
077c9d |
-+link-pie-before-libc = $(CC) $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \
|
|
|
077c9d |
++link-pie-before-libc = $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \
|
|
|
077c9d |
-Wl,-O1 -nostdlib -nostartfiles -o $@ \
|
|
|
077c9d |
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
|
|
|
077c9d |
$(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
|
|
|
077c9d |
@@ -428,23 +428,24 @@ ifndef +link-pie
|
|
|
077c9d |
$(link-extra-libs)
|
|
|
077c9d |
+link-pie-after-libc = $(+postctorS) $(+postinit)
|
|
|
077c9d |
define +link-pie
|
|
|
077c9d |
-$(+link-pie-before-libc) $(rtld-LDFLAGS) $(link-extra-flags) $(link-libc) $(+link-pie-after-libc)
|
|
|
077c9d |
+$(CC) $(+link-pie-before-libc) $(rtld-LDFLAGS) $(link-extra-flags) \
|
|
|
077c9d |
+ $(link-libc) $(+link-pie-after-libc)
|
|
|
077c9d |
$(call after-link,$@)
|
|
|
077c9d |
endef
|
|
|
077c9d |
define +link-pie-tests
|
|
|
077c9d |
-$(+link-pie-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
|
|
|
077c9d |
- $(+link-pie-after-libc)
|
|
|
077c9d |
+$(CC) $(+link-pie-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
|
|
|
077c9d |
+ $(+link-pie-after-libc)
|
|
|
077c9d |
$(call after-link,$@)
|
|
|
077c9d |
endef
|
|
|
077c9d |
define +link-pie-printers-tests
|
|
|
077c9d |
-$(+link-pie-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \
|
|
|
077c9d |
- $(+link-pie-after-libc)
|
|
|
077c9d |
+$(CC) $(+link-pie-before-libc) $(built-rtld-LDFLAGS) \
|
|
|
077c9d |
+ $(link-libc-printers-tests) $(+link-pie-after-libc)
|
|
|
077c9d |
$(call after-link,$@)
|
|
|
077c9d |
endef
|
|
|
077c9d |
endif
|
|
|
077c9d |
# Command for statically linking programs with the C library.
|
|
|
077c9d |
ifndef +link-static
|
|
|
077c9d |
-+link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \
|
|
|
077c9d |
++link-static-before-libc = -nostdlib -nostartfiles -static -o $@ \
|
|
|
077c9d |
$(if $($(@F)-no-pie),$(no-pie-ldflag),$(default-pie-ldflag)) \
|
|
|
077c9d |
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
|
|
|
077c9d |
$(firstword $(CRT-$(@F)) $(csu-objpfx)$(real-static-start-installed-name)) \
|
|
|
077c9d |
@@ -456,11 +457,13 @@ ifndef +link-static
|
|
|
077c9d |
$(link-extra-libs-static)
|
|
|
077c9d |
+link-static-after-libc = $(+postctorT) $(+postinit)
|
|
|
077c9d |
define +link-static
|
|
|
077c9d |
-$(+link-static-before-libc) $(link-extra-flags) $(link-libc-static) $(+link-static-after-libc)
|
|
|
077c9d |
+$(CC) $(+link-static-before-libc) $(link-extra-flags) $(link-libc-static) \
|
|
|
077c9d |
+ $(+link-static-after-libc)
|
|
|
077c9d |
$(call after-link,$@)
|
|
|
077c9d |
endef
|
|
|
077c9d |
define +link-static-tests
|
|
|
077c9d |
-$(+link-static-before-libc) $(link-libc-static-tests) $(+link-static-after-libc)
|
|
|
077c9d |
+$(CC) $(+link-static-before-libc) $(link-libc-static-tests) \
|
|
|
077c9d |
+ $(+link-static-after-libc)
|
|
|
077c9d |
$(call after-link,$@)
|
|
|
077c9d |
endef
|
|
|
077c9d |
endif
|
|
|
077c9d |
@@ -475,7 +478,7 @@ ifeq (yes,$(build-pie-default))
|
|
|
077c9d |
+link-tests = $(+link-pie-tests)
|
|
|
077c9d |
+link-printers-tests = $(+link-pie-printers-tests)
|
|
|
077c9d |
else # not build-pie-default
|
|
|
077c9d |
-+link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
|
|
|
077c9d |
++link-before-libc = -nostdlib -nostartfiles -o $@ \
|
|
|
077c9d |
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
|
|
|
077c9d |
$(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
|
|
|
077c9d |
$(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \
|
|
|
077c9d |
@@ -487,16 +490,17 @@ else # not build-pie-default
|
|
|
077c9d |
$(link-extra-libs)
|
|
|
077c9d |
+link-after-libc = $(+postctor) $(+postinit)
|
|
|
077c9d |
define +link
|
|
|
077c9d |
-$(+link-before-libc) $(rtld-LDFLAGS) $(link-extra-flags) $(link-libc) $(+link-after-libc)
|
|
|
077c9d |
+$(CC) $(+link-before-libc) $(rtld-LDFLAGS) $(link-extra-flags) $(link-libc) \
|
|
|
077c9d |
+ $(+link-after-libc)
|
|
|
077c9d |
$(call after-link,$@)
|
|
|
077c9d |
endef
|
|
|
077c9d |
define +link-tests
|
|
|
077c9d |
-$(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
|
|
|
077c9d |
+$(CC) $(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
|
|
|
077c9d |
$(+link-after-libc)
|
|
|
077c9d |
$(call after-link,$@)
|
|
|
077c9d |
endef
|
|
|
077c9d |
define +link-printers-tests
|
|
|
077c9d |
-$(+link-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \
|
|
|
077c9d |
+$(CC) $(+link-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \
|
|
|
077c9d |
$(+link-after-libc)
|
|
|
077c9d |
$(call after-link,$@)
|
|
|
077c9d |
endef
|