aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/emulparams/aarch64elf.sh1
-rw-r--r--ld/emulparams/aarch64elf32.sh1
-rw-r--r--ld/testsuite/ld-elf/shared.exp14
-rw-r--r--ld/testsuite/ld-shared/shared.exp34
-rw-r--r--ld/testsuite/ld-vsb/vsb.exp16
-rw-r--r--ld/testsuite/ld-x86-64/pr19636-3d.d10
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp4
7 files changed, 38 insertions, 42 deletions
diff --git a/ld/emulparams/aarch64elf.sh b/ld/emulparams/aarch64elf.sh
index 72616b5..aa051c7 100644
--- a/ld/emulparams/aarch64elf.sh
+++ b/ld/emulparams/aarch64elf.sh
@@ -18,6 +18,7 @@ GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ENTRY=_start
EMBEDDED=yes
diff --git a/ld/emulparams/aarch64elf32.sh b/ld/emulparams/aarch64elf32.sh
index 45bf31a..0565b7a 100644
--- a/ld/emulparams/aarch64elf32.sh
+++ b/ld/emulparams/aarch64elf32.sh
@@ -18,6 +18,7 @@ GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ENTRY=_start
EMBEDDED=yes
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index bf8952a..09669b5 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -1618,12 +1618,12 @@ if { [istarget *-*-linux*]
] \
[list \
"Run pr21964-4" \
- "" \
+ "$NOPIE_LDFLAGS" \
"" \
{pr21964-4.c} \
"pr21964-4" \
"pass.out" \
- "" \
+ "$NOPIE_CFLAGS" \
"" \
"" \
"-ldl" \
@@ -1664,7 +1664,7 @@ proc mix_pic_and_non_pic {xfails cflags ldflags exe} {
run_ld_link_exec_tests [list \
[list \
- "Run $exe fun defined" \
+ "Run $exe fun undefined" \
"-Wl,--no-as-needed,-rpath,tmpdir $ldflags tmpdir/libpr19719b.o tmpdir/libpr19719.so" \
"" \
{ pr19719a.c pr19719c.c } \
@@ -1682,19 +1682,19 @@ proc mix_pic_and_non_pic {xfails cflags ldflags exe} {
}
if ![isnative] {
- unsupported "Run $exe fun undefined"
+ unsupported "Run $exe fun defined"
return
}
set exec_output [run_host_cmd "tmpdir/$exe" ""]
if {![string match "PASS\n" $exec_output]} {
- fail "Run $exe fun undefined"
+ fail "Run $exe fun defined"
} else {
- pass "Run $exe fun undefined"
+ pass "Run $exe fun defined"
}
}
-mix_pic_and_non_pic [list "arm*-*-*"] "" "" "pr19719"
+mix_pic_and_non_pic [list "arm*-*-*"] "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" "pr19719"
mix_pic_and_non_pic [] "-fPIE" "-pie" "pr19719pie"
set AFLAGS_PIE ""
diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp
index bdbe9a9..a8ddac2 100644
--- a/ld/testsuite/ld-shared/shared.exp
+++ b/ld/testsuite/ld-shared/shared.exp
@@ -121,6 +121,7 @@ proc shared_test { progname testname main sh1 sh2 dat args } {
global tmpdir
if [llength $args] { set shldflags [lindex $args 0] } else { set shldflags "" }
+ if { [llength $args] >= 2 } { set ldflags [lindex $args 1] } else { set ldflags "" }
# Build the shared library.
set shared -shared
@@ -146,7 +147,7 @@ proc shared_test { progname testname main sh1 sh2 dat args } {
set rpath /lib:$tmpdir
set exportflag " -Wl,-bexpall"
}
- if ![ld_link $CC_FOR_TARGET $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so $exportflag"] {
+ if ![ld_link $CC_FOR_TARGET $tmpdir/$progname "-Wl,-rpath,$rpath $ldflags $tmpdir/$main $tmpdir/$progname.so $exportflag"] {
fail "$testname"
return
}
@@ -205,7 +206,9 @@ if { [istarget mips*-*-*] && ! [at_least_gcc_version 4 3] } then {
verbose "Using $picflag to compile PIC code"
# Compile the main program.
-if ![ld_compile "$CC_FOR_TARGET $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
+global PLT_CFLAGS NOPIE_CFLAGS NOPIE_LDFLAGS
+verbose "Using $NOPIE_CFLAGS to compile and $NOPIE_LDFLAGS to link non PIC code"
+if ![ld_compile "$CC_FOR_TARGET $NOPIE_CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
unsupported "shared (non PIC)"
unsupported "shared"
} else {
@@ -215,12 +218,11 @@ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.
# will need to do more relocation work. However, note that not
# using -fpic will cause some of the tests to return different
# results. Make sure that PLT is used since PLT is expected.
- global PLT_CFLAGS NOPIE_CFLAGS
if { ![ld_compile "$CC_FOR_TARGET $PLT_CFLAGS $NOPIE_CFLAGS $SHCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
- || ![ld_compile "$CC_FOR_TARGET $PLT_CFLAGS $SHCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
+ || ![ld_compile "$CC_FOR_TARGET $PLT_CFLAGS $NOPIE_CFLAGS $SHCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
unsupported "shared (non PIC)"
} else { if { [is_xcoff_format] } {
- shared_test shnp "shared (nonPIC)" mainnp.o sh1np.o sh2np.o xcoff
+ shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o xcoff "" $NOPIE_LDFLAGS
} else {
# Solaris defaults to -z text.
setup_xfail "*-*-solaris2*"
@@ -243,7 +245,7 @@ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.
setup_xfail "arm*-*-linux*"
}
setup_xfail "aarch64*-*-linux*"
- shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o shared
+ shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o shared "" $NOPIE_LDFLAGS
# Test ELF shared library relocations with a non-zero load
# address for the library. Near as I can tell, the R_*_RELATIVE
@@ -273,7 +275,7 @@ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.
setup_xfail "*-*-solaris2*"
shared_test shnp "shared (non PIC, load offset)" \
mainnp.o sh1np.o sh2np.o shared \
- "-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv"
+ "-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv" $NOPIE_LDFLAGS
} }
# Now compile the code using -fpic.
@@ -283,13 +285,13 @@ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.
unsupported "shared"
} else {
if { [is_xcoff_format] } {
- shared_test shp "shared" mainnp.o sh1p.o sh2p.o xcoff
+ shared_test shp "shared" mainnp.o sh1p.o sh2p.o xcoff "" $NOPIE_LDFLAGS
} else {
- shared_test shp "shared" mainnp.o sh1p.o sh2p.o shared
- ld_compile "$CC_FOR_TARGET -DSYMBOLIC_TEST $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o
+ shared_test shp "shared" mainnp.o sh1p.o sh2p.o shared "" $NOPIE_LDFLAGS
+ ld_compile "$CC_FOR_TARGET $NOPIE_CFLAGS -DSYMBOLIC_TEST $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o
ld_compile "$CC_FOR_TARGET -DSYMBOLIC_TEST $SHCFLAG $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o
- shared_test shp "shared -Bsymbolic" mainnp.o sh1p.o sh2p.o symbolic "-Bsymbolic"
- ld_compile "$CC_FOR_TARGET $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o
+ shared_test shp "shared -Bsymbolic" mainnp.o sh1p.o sh2p.o symbolic "-Bsymbolic" $NOPIE_LDFLAGS
+ ld_compile "$CC_FOR_TARGET $NOPIE_CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o
ld_compile "$CC_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o
}
}
@@ -302,7 +304,7 @@ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdi
} else {
if { [file exists $tmpdir/sh1np.o ] && [ file exists $tmpdir/sh2np.o ] } {
if { [is_xcoff_format] } {
- shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o xcoff
+ shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o xcoff "" $NOPIE_LDFLAGS
} else {
# Solaris defaults to -z text.
setup_xfail "*-*-solaris2*"
@@ -325,7 +327,7 @@ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdi
setup_xfail "arm*-*-linux*"
}
setup_xfail "aarch64*-*-linux*"
- shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o shared
+ shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o shared "" $NOPIE_LDFLAGS
}
} else {
unsupported "shared (PIC main, non PIC so)"
@@ -333,9 +335,9 @@ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdi
if { [file exists $tmpdir/sh1p.o ] && [ file exists $tmpdir/sh2p.o ] } {
if { [is_xcoff_format] } {
- shared_test shmpp "shared (PIC main)" mainp.o sh1p.o sh2p.o xcoff
+ shared_test shmpp "shared (PIC main)" mainp.o sh1p.o sh2p.o xcoff "" $NOPIE_LDFLAGS
} else {
- shared_test shmpp "shared (PIC main)" mainp.o sh1p.o sh2p.o shared
+ shared_test shmpp "shared (PIC main)" mainp.o sh1p.o sh2p.o shared "" $NOPIE_LDFLAGS
}
} else {
unsupported "shared (PIC main)"
diff --git a/ld/testsuite/ld-vsb/vsb.exp b/ld/testsuite/ld-vsb/vsb.exp
index 9a61e9d..e44ac39 100644
--- a/ld/testsuite/ld-vsb/vsb.exp
+++ b/ld/testsuite/ld-vsb/vsb.exp
@@ -134,6 +134,7 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } {
global tmpdir
if [llength $args] { set shldflags [lindex $args 0] } else { set shldflags "" }
+ if { [llength $args] >= 2 } { set ldflags [lindex $args 1] } else { set ldflags "" }
# Build the shared library.
set shared -shared
@@ -169,7 +170,7 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } {
set rpath /lib:$tmpdir
set exportflag " -Wl,-bexpall"
}
- if ![ld_link $CC_FOR_TARGET $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so $exportflag"] {
+ if ![ld_link $CC_FOR_TARGET $tmpdir/$progname "-Wl,-rpath,$rpath $ldflags $tmpdir/$main $tmpdir/$progname.so $exportflag"] {
if { [ string match $visibility "hidden" ]
&& [regexp "undefined reference to \`\.?visibility\'" $link_output]
&& [regexp "undefined reference to \`visibility_var\'" $link_output] } {
@@ -235,6 +236,7 @@ proc visibility_run {visibility} {
global shared_needs_pic
global PLT_CFLAGS
global NOPIE_CFLAGS
+ global NOPIE_LDFLAGS
global COMPRESS_LDFLAG
global NOSANITIZE_CFLAGS
global NOLTO_CFLAGS
@@ -284,7 +286,7 @@ proc visibility_run {visibility} {
} else {
# Compile the main program. Make sure that PLT is used since PLT
# is expected.
- if ![ld_compile "$CC_FOR_TARGET -g $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
+ if ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
unsupported "visibility ($visibility) (non PIC)"
unsupported "visibility ($visibility)"
} else {
@@ -343,7 +345,7 @@ proc visibility_run {visibility} {
setup_xfail "*-*-beos*"
}
- visibility_test $visibility vnp "visibility ($visibility) (non PIC)" mainnp.o sh1np.o sh2np.o $datfile
+ visibility_test $visibility vnp "visibility ($visibility) (non PIC)" mainnp.o sh1np.o sh2np.o $datfile "" $NOPIE_LDFLAGS
# Test ELF shared library relocations with a non-zero load
# address for the library. Near as I can tell, the R_*_RELATIVE
@@ -395,7 +397,7 @@ proc visibility_run {visibility} {
if { ![is_xcoff_format] } {
visibility_test $visibility vnp "visibility ($visibility) (non PIC, load offset)" \
mainnp.o sh1np.o sh2np.o $datfile \
- "-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv"
+ "-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv" $NOPIE_LDFLAGS
}
}
@@ -411,7 +413,7 @@ proc visibility_run {visibility} {
setup_xfail $target_triplet
}
}
- visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o $datfile $COMPRESS_LDFLAG
+ visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o $datfile $COMPRESS_LDFLAG $NOPIE_LDFLAGS
}
}}
@@ -466,7 +468,7 @@ proc visibility_run {visibility} {
setup_xfail "*-*-beos*"
}
- visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o $datfile
+ visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o $datfile "" $NOPIE_LDFLAGS
} else {
unsupported "visibility (PIC main, non PIC so)"
}
@@ -488,7 +490,7 @@ proc visibility_run {visibility} {
setup_xfail "*-*-beos*"
}
- visibility_test $visibility vmpp "visibility ($visibility) (PIC main)" mainp.o sh1p.o sh2p.o $datfile
+ visibility_test $visibility vmpp "visibility ($visibility) (PIC main)" mainp.o sh1p.o sh2p.o $datfile "" $NOPIE_LDFLAGS
} else {
unsupported "visibility ($visibility) (PIC main)"
}
diff --git a/ld/testsuite/ld-x86-64/pr19636-3d.d b/ld/testsuite/ld-x86-64/pr19636-3d.d
deleted file mode 100644
index 3d9a6d7..0000000
--- a/ld/testsuite/ld-x86-64/pr19636-3d.d
+++ /dev/null
@@ -1,10 +0,0 @@
-#source: pr19636-3.s
-#as: --64
-#ld: -E --defsym foobar=0x100 -m elf_x86_64
-#readelf : --dyn-syms --wide
-
-Symbol table '\.dynsym' contains [0-9]+ entries:
- +Num: +Value +Size Type +Bind +Vis +Ndx Name
-#...
- +[0-9]+: +0+100 +0 +NOTYPE +GLOBAL +DEFAULT +ABS +foobar
-#pass
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 01d6459..52c4d5e 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -2168,9 +2168,9 @@ if { [isnative] && [check_compiler_available] } {
}
undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
- undefined_weak "-fPIE" ""
+ undefined_weak "-fPIE" "$NOPIE_LDFLAGS"
undefined_weak "-fPIE" "-pie"
- undefined_weak "-fPIE" "-Wl,-z,nodynamic-undefined-weak"
+ undefined_weak "-fPIE" "$NOPIE_LDFLAGS -Wl,-z,nodynamic-undefined-weak"
undefined_weak "-fPIE" "-pie -Wl,-z,nodynamic-undefined-weak"
}