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