aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-01-19 19:36:37 +0000
committerH.J. Lu <hjl.tools@gmail.com>2013-01-19 19:36:37 +0000
commit6738cadcc7b0e5ada20372765a72771dd99efe43 (patch)
treee505794ada35899f1579a6c0498ff2bd97bfa0b0 /ld
parent44fc9657c5168eb2e6c116eef7cc709972fcdc0f (diff)
downloadfsf-binutils-gdb-6738cadcc7b0e5ada20372765a72771dd99efe43.zip
fsf-binutils-gdb-6738cadcc7b0e5ada20372765a72771dd99efe43.tar.gz
fsf-binutils-gdb-6738cadcc7b0e5ada20372765a72771dd99efe43.tar.bz2
Add HOSTING_SCRT0 for PIE test
ld/ * Makefile.am (HOSTING_SCRT0): New. * configure.host (HOSTING_SCRT0): New. Used for PIE. * configure.in (HOSTING_SCRT0): New AC_SUBST. * Makefile.in: Regenerated. * configure: Likewise. ld/testsuite/ * config/default.exp (get_target_emul): Also set HOSTING_SCRT0. * lib/ld-lib.exp (default_ld_link): Use HOSTING_SCRT0 for -pie.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog11
-rw-r--r--ld/Makefile.am1
-rw-r--r--ld/Makefile.in1
-rwxr-xr-xld/configure6
-rw-r--r--ld/configure.host7
-rw-r--r--ld/configure.in1
-rw-r--r--ld/testsuite/ChangeLog6
-rw-r--r--ld/testsuite/config/default.exp4
-rw-r--r--ld/testsuite/lib/ld-lib.exp7
9 files changed, 39 insertions, 5 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 190e081..bf3d210 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,14 @@
+2013-01-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (HOSTING_SCRT0): New.
+
+ * configure.host (HOSTING_SCRT0): New. Used for PIE.
+
+ * configure.in (HOSTING_SCRT0): New AC_SUBST.
+
+ * Makefile.in: Regenerated.
+ * configure: Likewise.
+
2013-01-18 Mike Frysinger <vapier@gentoo.org>
* NEWS: Mention change in behavior with --enable-new-dtags.
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 5fb039f..c12bcb6 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -86,6 +86,7 @@ POD2MAN = pod2man --center="GNU Development Tools" \
#stuff for self hosting (can be overridden in config file).
HOSTING_CRT0 = @HOSTING_CRT0@
+HOSTING_SCRT0 = @HOSTING_SCRT0@
HOSTING_LIBS = @HOSTING_LIBS@
HOSTING_EMU = -m $(EMUL)
diff --git a/ld/Makefile.in b/ld/Makefile.in
index a350bc0..e21a7ce 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -230,6 +230,7 @@ HDEFINES = @HDEFINES@
#stuff for self hosting (can be overridden in config file).
HOSTING_CRT0 = @HOSTING_CRT0@
HOSTING_LIBS = @HOSTING_LIBS@
+HOSTING_SCRT0 = @HOSTING_SCRT0@
INCINTL = @INCINTL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
diff --git a/ld/configure b/ld/configure
index cb99b4c..1d20df5 100755
--- a/ld/configure
+++ b/ld/configure
@@ -614,6 +614,7 @@ ENABLE_PLUGINS_FALSE
ENABLE_PLUGINS_TRUE
NATIVE_LIB_DIRS
HOSTING_LIBS
+HOSTING_SCRT0
HOSTING_CRT0
HDEFINES
do_compare
@@ -12185,7 +12186,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12188 "configure"
+#line 12189 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12291,7 +12292,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12294 "configure"
+#line 12295 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16200,6 +16201,7 @@ do_compare="$gcc_cv_prog_cmp_skip"
+
for ac_header in string.h strings.h stdlib.h unistd.h elf-hints.h limits.h locale.h sys/param.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
diff --git a/ld/configure.host b/ld/configure.host
index baf79b8..ab7bc7d 100644
--- a/ld/configure.host
+++ b/ld/configure.host
@@ -56,6 +56,7 @@ case "${host}" in
*-*-linux*)
HOSTING_CRT0='-dynamic-linker `${CC} --help --verbose 2>&1 | egrep "ld[^ ]*\.so" | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*\.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_SCRT0='-dynamic-linker `${CC} --help --verbose 2>&1 | egrep "ld[^ ]*\.so" | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*\.so..\).*,\1,"` `${CC} --print-file-name=Scrt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbeginS.o ]; then echo ../gcc/crtbeginS.o; else ${CC} --print-file-name=crtbeginS.o; fi`'
HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
;;
@@ -242,3 +243,9 @@ alpha*-*-*)
;;
esac
+
+# Provide default HOSTING_SCRT0. Each host should define a proper one
+# if needed.
+if test -z "$HOSTING_SCRT0"; then
+ HOSTING_SCRT0="$HOSTING_CRT0"
+fi
diff --git a/ld/configure.in b/ld/configure.in
index 0cdef93..2af3dfc 100644
--- a/ld/configure.in
+++ b/ld/configure.in
@@ -185,6 +185,7 @@ ACX_PROG_CMP_IGNORE_INITIAL
AC_SUBST(HDEFINES)
AC_SUBST(HOSTING_CRT0)
+AC_SUBST(HOSTING_SCRT0)
AC_SUBST(HOSTING_LIBS)
AC_SUBST(NATIVE_LIB_DIRS)
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 70aa059..ee98aaa 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/default.exp (get_target_emul): Also set HOSTING_SCRT0.
+
+ * lib/ld-lib.exp (default_ld_link): Use HOSTING_SCRT0 for -pie.
+
2013-01-18 H.J. Lu <hongjiu.lu@intel.com>
* ld-size/size-10.rd: Updated.
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
index bba48d7..d540f19 100644
--- a/ld/testsuite/config/default.exp
+++ b/ld/testsuite/config/default.exp
@@ -139,11 +139,11 @@ proc get_target_emul {} {
}
if [isnative] {
- foreach x {HOSTING_CRT0 HOSTING_LIBS} {
+ foreach x {HOSTING_CRT0 HOSTING_SCRT0 HOSTING_LIBS} {
get_link_files $x
}
} else {
- foreach x {HOSTING_CRT0 HOSTING_LIBS} { set $x "" }
+ foreach x {HOSTING_CRT0 HOSTING_SCRT0 HOSTING_LIBS} { set $x "" }
}
if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" }
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index a3ff2e3..0b156a1 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -179,13 +179,18 @@ proc big_or_little_endian {} {
proc default_ld_link { ld target objects } {
global HOSTING_EMU
global HOSTING_CRT0
+ global HOSTING_SCRT0
global HOSTING_LIBS
global LIBS
global host_triplet
global link_output
global exec_output
- set objs "$HOSTING_CRT0 $objects"
+ if { [ string match "* -pie *" $objects ] } {
+ set objs "$HOSTING_SCRT0 $objects"
+ } else {
+ set objs "$HOSTING_CRT0 $objects"
+ }
set libs "$LIBS $HOSTING_LIBS"
if [is_endian_output_format $objects] then {