summaryrefslogtreecommitdiff
path: root/Makeconfig
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-09-04 19:53:24 -0700
committerH.J. Lu <hjl.tools@gmail.com>2012-09-06 11:43:43 -0700
commita5055ad15a4cb063627653d0a2109f66ead63c33 (patch)
tree11780094df41853e87aa787a88048e0651cca38d /Makeconfig
parent48bac3debbc7acd0a2e8fe8248780f9d2c043c10 (diff)
Use crtbeginT.o to statically link programs
Diffstat (limited to 'Makeconfig')
-rw-r--r--Makeconfig11
1 files changed, 7 insertions, 4 deletions
diff --git a/Makeconfig b/Makeconfig
index 57f35f957f..3ed9746dcc 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -445,13 +445,13 @@ ifndef +link-static
+link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
$(addprefix $(csu-objpfx),$(static-start-installed-name)) \
- $(+preinit) $(+prector) \
+ $(+preinit) $(+prectorT) \
$(filter-out $(addprefix $(csu-objpfx),start.o \
$(start-installed-name))\
$(+preinit) $(link-extra-libs-static) \
$(common-objpfx)libc% $(+postinit),$^) \
$(link-extra-libs-static) $(link-libc-static)
-+link-static-after-libc = $(+postctor) $(+postinit)
++link-static-after-libc = $(+postctorT) $(+postinit)
+link-static = $(+link-static-before-libc) $(link-libc-static) \
$(+link-static-after-libc)
+link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \
@@ -462,12 +462,12 @@ ifndef +link-bounded
+link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \
$(sysdep-LDFLAGS) $(LDFLAGS) \
$(addprefix $(csu-objpfx),b$(static-start-installed-name)) \
- $(+preinit) $(+prector) \
+ $(+preinit) $(+prectorT) \
$(filter-out $(addprefix $(csu-objpfx),start.ob \
$(start-installed-name))\
$(+preinit) $(link-extra-libs-bounded) \
$(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
+ $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctorT) $(+postinit)
endif
ifndef config-LDFLAGS
ifeq (yes,$(build-shared))
@@ -579,6 +579,9 @@ endif
# Variants of the two previous definitions for linking PIE programs.
+prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
+postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
+# Variants of the two previous definitions for statically linking programs.
++prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
++postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
+interp = $(addprefix $(elf-objpfx),interp.os)
csu-objpfx = $(common-objpfx)csu/
elf-objpfx = $(common-objpfx)elf/