]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/testsuite/lib/ld-lib.exp
ld: Add a linker configure option --enable-relro
[thirdparty/binutils-gdb.git] / ld / testsuite / lib / ld-lib.exp
index 29af846427a1a2816bffb3ad139d4227263c8be5..62f97689ac5fb5c17d6309a7cc2036a07cbe9d5d 100644 (file)
@@ -589,6 +589,13 @@ proc run_dump_test { name {extra_options {}} } {
     global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS READELFFLAGS LDFLAGS
     global host_triplet runtests
     global env verbose
+    global ld_elf_shared_opt
+
+    if { [is_elf_format] && [check_shared_lib_support] } {
+       set ld_extra_opt "$ld_elf_shared_opt"
+    } else {
+       set ld_extra_opt ""
+    }
 
     if [string match "*/*" $name] {
        set file $name
@@ -912,7 +919,7 @@ proc run_dump_test { name {extra_options {}} } {
 
        # Add -L$srcdir/$subdir so that the linker command can use
        # linker scripts in the source directory.
-       set cmd "$LD $LDFLAGS -L$srcdir/$subdir \
+       set cmd "$LD $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
                   $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
 
         # If needed then check for, or add a -Map option.
@@ -1166,6 +1173,13 @@ proc run_ld_link_tests { ldtests } {
     global CFLAGS
     global runtests
     global exec_output
+    global ld_elf_shared_opt
+
+    if { [is_elf_format] && [check_shared_lib_support] } {
+       set ld_extra_opt "$ld_elf_shared_opt"
+    } else {
+       set ld_extra_opt ""
+    }
 
     foreach testitem $ldtests {
        set testname [lindex $testitem 0]
@@ -1228,7 +1242,7 @@ proc run_ld_link_tests { ldtests } {
            if { ![ar_simple_create $ar $ld_options $binfile "$objfiles $ld_after"] } {
                set failed 1
            }
-       } elseif { ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles $ld_after"] } {
+       } elseif { ![ld_simple_link $ld $binfile "$ld_extra_opt -L$srcdir/$subdir $ld_options $objfiles $ld_after"] } {
            set maybe_failed 1
            set ld_output "$exec_output"
        }