ld: Pass -z notext to linker for tests with DT_TEXTREL
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 25 May 2020 11:54:31 +0000 (04:54 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 25 May 2020 11:54:50 +0000 (04:54 -0700)
Some linker tests need DT_TEXTREL.  Pass -z notext to linker for these
tests so that they will pass with DT_TEXTREL check defaulting to warning
or error.

* testsuite/ld-elf/eh6.d: Pass -z notext to linker.
* testsuite/ld-elf/ehdr_start-shared.d: Likewise.
* testsuite/ld-elf/pr19539.d: Likewise.
* testsuite/ld-elfvers/vers.exp: Likewise.
* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
* testsuite/ld-i386/i386.exp: Likewise.
* testsuite/ld-i386/nogot1.d: Likewise.
* testsuite/ld-i386/pr19539.d: Likewise.
* testsuite/ld-i386/pr19636-2a.d: Likewise.
* testsuite/ld-i386/pr19636-2b.d: Likewise.
* testsuite/ld-i386/pr19636-2c.d: Likewise.
* testsuite/ld-i386/pr19636-2d.d: Likewise.
* testsuite/ld-i386/pr19636-2e.d: Likewise.
* testsuite/ld-i386/pr19636-3d.d: Likewise.
* testsuite/ld-i386/pr19636-3e.d: Likewise.
* testsuite/ld-i386/pr19939b.d: Likewise.
* testsuite/ld-i386/undefweaka.d: Likewise.
* testsuite/ld-i386/undefweakb.d: Likewise.
* testsuite/ld-shared/shared.exp: Likewise.
* testsuite/ld-size/size.exp: Likewise.
* testsuite/ld-unique/unique.exp: Likewise.
* testsuite/ld-x86-64/pie1.d: Likewise.
* testsuite/ld-x86-64/pr19539a.d: Likewise.
* testsuite/ld-x86-64/pr19539b.d: Likewise.
* testsuite/ld-x86-64/pr19636-1d.d: Likewise.
* testsuite/ld-x86-64/pr19636-1e.d: Likewise.
* testsuite/ld-x86-64/pr19807-1a.d: Likewise.
* testsuite/ld-x86-64/pr19807-1b.d: Likewise.
* testsuite/ld-x86-64/pr19807-2b.d: Likewise.
* testsuite/ld-x86-64/pr19807-2c.d: Likewise.
* testsuite/ld-x86-64/pr19807-2d.d: Likewise.
* testsuite/ld-x86-64/pr19807-2e.d: Likewise.
* testsuite/ld-x86-64/pr19939b.d: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Likewise.

35 files changed:
ld/ChangeLog
ld/testsuite/ld-elf/eh6.d
ld/testsuite/ld-elf/ehdr_start-shared.d
ld/testsuite/ld-elf/pr19539.d
ld/testsuite/ld-elfvers/vers.exp
ld/testsuite/ld-elfvsb/elfvsb.exp
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/nogot1.d
ld/testsuite/ld-i386/pr19539.d
ld/testsuite/ld-i386/pr19636-2a.d
ld/testsuite/ld-i386/pr19636-2b.d
ld/testsuite/ld-i386/pr19636-2c.d
ld/testsuite/ld-i386/pr19636-2d.d
ld/testsuite/ld-i386/pr19636-2e.d
ld/testsuite/ld-i386/pr19636-3d.d
ld/testsuite/ld-i386/pr19636-3e.d
ld/testsuite/ld-i386/pr19939b.d
ld/testsuite/ld-i386/undefweaka.d
ld/testsuite/ld-i386/undefweakb.d
ld/testsuite/ld-shared/shared.exp
ld/testsuite/ld-size/size.exp
ld/testsuite/ld-unique/unique.exp
ld/testsuite/ld-x86-64/pie1.d
ld/testsuite/ld-x86-64/pr19539a.d
ld/testsuite/ld-x86-64/pr19539b.d
ld/testsuite/ld-x86-64/pr19636-1d.d
ld/testsuite/ld-x86-64/pr19636-1e.d
ld/testsuite/ld-x86-64/pr19807-1a.d
ld/testsuite/ld-x86-64/pr19807-1b.d
ld/testsuite/ld-x86-64/pr19807-2b.d
ld/testsuite/ld-x86-64/pr19807-2c.d
ld/testsuite/ld-x86-64/pr19807-2d.d
ld/testsuite/ld-x86-64/pr19807-2e.d
ld/testsuite/ld-x86-64/pr19939b.d
ld/testsuite/ld-x86-64/x86-64.exp

index 533685b363d7b05b55b8019fb09dca1bd9ec4b02..2c7120f7dcd2ab403e58265f8fb5169ed7fc48bb 100644 (file)
@@ -1,3 +1,40 @@
+2020-05-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * testsuite/ld-elf/eh6.d: Pass -z notext to linker.
+       * testsuite/ld-elf/ehdr_start-shared.d: Likewise.
+       * testsuite/ld-elf/pr19539.d: Likewise.
+       * testsuite/ld-elfvers/vers.exp: Likewise.
+       * testsuite/ld-elfvsb/elfvsb.exp: Likewise.
+       * testsuite/ld-i386/i386.exp: Likewise.
+       * testsuite/ld-i386/nogot1.d: Likewise.
+       * testsuite/ld-i386/pr19539.d: Likewise.
+       * testsuite/ld-i386/pr19636-2a.d: Likewise.
+       * testsuite/ld-i386/pr19636-2b.d: Likewise.
+       * testsuite/ld-i386/pr19636-2c.d: Likewise.
+       * testsuite/ld-i386/pr19636-2d.d: Likewise.
+       * testsuite/ld-i386/pr19636-2e.d: Likewise.
+       * testsuite/ld-i386/pr19636-3d.d: Likewise.
+       * testsuite/ld-i386/pr19636-3e.d: Likewise.
+       * testsuite/ld-i386/pr19939b.d: Likewise.
+       * testsuite/ld-i386/undefweaka.d: Likewise.
+       * testsuite/ld-i386/undefweakb.d: Likewise.
+       * testsuite/ld-shared/shared.exp: Likewise.
+       * testsuite/ld-size/size.exp: Likewise.
+       * testsuite/ld-unique/unique.exp: Likewise.
+       * testsuite/ld-x86-64/pie1.d: Likewise.
+       * testsuite/ld-x86-64/pr19539a.d: Likewise.
+       * testsuite/ld-x86-64/pr19539b.d: Likewise.
+       * testsuite/ld-x86-64/pr19636-1d.d: Likewise.
+       * testsuite/ld-x86-64/pr19636-1e.d: Likewise.
+       * testsuite/ld-x86-64/pr19807-1a.d: Likewise.
+       * testsuite/ld-x86-64/pr19807-1b.d: Likewise.
+       * testsuite/ld-x86-64/pr19807-2b.d: Likewise.
+       * testsuite/ld-x86-64/pr19807-2c.d: Likewise.
+       * testsuite/ld-x86-64/pr19807-2d.d: Likewise.
+       * testsuite/ld-x86-64/pr19807-2e.d: Likewise.
+       * testsuite/ld-x86-64/pr19939b.d: Likewise.
+       * testsuite/ld-x86-64/x86-64.exp: Likewise.
+
 2020-05-24  Fangrui Song <maskray@google.com>
 
        PR ld/26018
index 69c4c85acd1e5a66cb72886f44e9f87a686e7d62..08e9d7b2bd2c9087de971fe320578f91815543e6 100644 (file)
@@ -1,5 +1,5 @@
 #source: eh6.s
-#ld: --gc-sections -shared
+#ld: --gc-sections -shared -z notext
 #readelf: -wf -rW
 #target: x86_64-*-linux-gnu* i?86-*-linux-gnu i?86-*-gnu*
 
index 6cbaa3a3416e5a861ad03e354871a32bee45adb5..af6bec0a5a77d5fdb4e200951331878972902970 100644 (file)
@@ -1,5 +1,5 @@
 #source: ehdr_start.s
-#ld: -e _start -shared
+#ld: -e _start -shared -z notext
 #nm: -n
 #target: *-*-linux* *-*-gnu* *-*-nacl* arm*-*-uclinuxfdpiceabi
 #xfail: cris*-*-* frv-*-* ![check_shared_lib_support] 
index c9f91ce663488d4bbbd3eda8af50db152fa1f1da..56e6502ca6ed5a2bcfe54cd9be0548a39158fc48 100644 (file)
@@ -1,6 +1,6 @@
 #source: start.s
 #source: pr19539.s
-#ld: -pie -T pr19539.t
+#ld: -pie -T pr19539.t -z notext
 #readelf : --dyn-syms --wide
 #target: *-*-linux* *-*-gnu* *-*-solaris* arm*-*-uclinuxfdpiceabi
 #xfail: cris*-*-* ![check_pie_support] 
index ed48e1a6971b34e3802a7993e907413e9983e5fd..8efbac21b9623c6dede0073b5e817c407a3506b3 100644 (file)
@@ -576,7 +576,7 @@ proc build_vers_lib_no_pic { test source libname other mapfile verexp versymexp
   global shared
   # Make sure that PLT is used since PLT is expected.
   global PLT_CFLAGS
-  build_binary $shared $PLT_CFLAGS $test $source $libname $other $mapfile $verexp $versymexp $symexp ""
+  build_binary "$shared -z notext" $PLT_CFLAGS $test $source $libname $other $mapfile $verexp $versymexp $symexp ""
 }
 
 proc build_vers_lib_pic { test source libname other mapfile verexp versymexp symexp } {
index 58dea0b0c80a7daa8ef8c789c5dc5f29dc46e09f..5e19d32ae619dee6f4a7947796c989c3db2aa195 100644 (file)
@@ -142,6 +142,9 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } {
     if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
        set shared "-bM:SRE -bE:$tmpdir/xcoff.exp"
     }
+    if { [is_elf_format] && [check_shared_lib_support] } {
+       append shared " -Wl,-z,notext"
+    }
     if {![ld_link $CC $tmpdir/$progname.so "$shared $shldflags $tmpdir/$sh1 $tmpdir/$sh2"]} {
        if { [ string match $visibility "hidden_undef" ]
             && [regexp "undefined reference to \`\.?visibility\'" $link_output]
index e3a5f8b1959c7a5c3f8ba73fa018bd392863b497..2956c44c73a76a3b00aad1b499e3e680019e6ba3 100644 (file)
@@ -181,7 +181,7 @@ set i386tests {
       {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
       "tlsbindesc"}
     {"TLS -fno-pic -shared"
-     "-shared -melf_i386 --no-ld-generated-unwind-info \
+     "-shared -melf_i386 --no-ld-generated-unwind-info -z notext \
       -z noseparate-code --hash-style=sysv" ""
      "--32" {tlsnopic1.s tlsnopic2.s}
      {{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd}
@@ -197,7 +197,8 @@ set i386tests {
      {{objdump -sj.debug_foobar tlsg.sd}} "tlsg"}
     {"TLS @indntpoff with %eax" "-melf_i386" "" "--32" {tlsindntpoff.s}
      {{objdump -drj.text tlsindntpoff.dd}} "tlsindntpoff"}
-    {"Reloc section order" "-shared -melf_i386 -z nocombreloc" "" "--32"
+    {"Reloc section order"
+     "-shared -melf_i386 -z nocombreloc -z notext" "" "--32"
      {reloc.s} {{objdump -hw reloc.d}} "reloc.so"}
     {"Basic --emit-relocs support" "-shared -melf_i386 --emit-relocs" "" "--32"
      {emit-relocs.s} {{readelf --relocs emit-relocs.rd}} "emit-relocs.so"}
@@ -238,10 +239,13 @@ set i386tests {
     {"Build pr19827b.so" "-melf_i386 -shared" ""
      "--32 -mx86-used-note=yes"
      { pr19827b.S } {} "pr19827b.so"}
-    {"Build pr19827" "-melf_i386 -pie tmpdir/pr19827a.o tmpdir/pr19827b.so" ""
+    {"Build pr19827"
+     "-melf_i386 -pie -z notext tmpdir/pr19827a.o tmpdir/pr19827b.so"
+     ""
      "--32 -mx86-used-note=yes"
      { dummy.s } {{readelf {-rW} pr19827.rd}} "pr19827"}
-    {"Build pr19827.so" "-melf_i386 -shared -Bsymbolic" ""
+    {"Build pr19827.so"
+     "-melf_i386 -shared -Bsymbolic -z notext" ""
      "--32 -mx86-used-note=yes"
      { pr19827a.S }  {{readelf {-rW} pr19827.rd}} "pr19827.so"}
 }
@@ -1316,7 +1320,7 @@ if { [isnative]
     run_cc_link_tests [list \
        [list \
            "Build pr22001-1.so" \
-           "-shared" \
+           "-shared -Wl,-z,notext" \
            "-Wa,-mx86-used-note=yes" \
            { pr22001-1a.c } \
            {} \
@@ -1352,7 +1356,7 @@ if { [isnative]
        ] \
        [list \
            "Run pr22001-1" \
-           "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
+           "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext tmpdir/pr22001-1.so" \
            "-Wa,-mx86-used-note=yes" \
            { pr22001-1b.c } \
            "pr22001-1" \
@@ -1395,7 +1399,7 @@ if { [isnative]
        ] \
        [list \
            "Run pr21997-1" \
-           "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+           "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/pr21997-1.so" \
            "-Wa,-mx86-used-note=yes" \
            { pr21997-1b.c } \
            "pr21997-1" \
index 018c24d3a90cb8adcce1ec992f341d73ca80f15d..0e721dc5caad9dcf10cab89f74b32fcbd90cb928 100644 (file)
@@ -1,4 +1,4 @@
-#ld: --shared -melf_i386
+#ld: --shared -melf_i386 -z notext
 #readelf: -S --wide
 #as: --32
 
index 7fe6e89a0d05bd08d0e437c83480665fd409c2b7..f0644a3a84a9e8cc8356c542ba1ee979cb9a23d4 100644 (file)
@@ -1,5 +1,5 @@
 #as: --32
-#ld: -pie -m elf_i386 -T pr19539.t
+#ld: -pie -m elf_i386 -T pr19539.t -z notext
 #readelf: -r --wide
 
 Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
index a3eafecb3bb586a17dd617a21933695e2a8edafd..98fb23c5a540e2e3e3bebf89d4f0007bf131e0f2 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-2.s
 #as: --32 -mrelax-relocations=no
-#ld: -pie -m elf_i386
+#ld: -pie -m elf_i386 -z notext
 #readelf : -r --wide -x .got -x .got.plt --dyn-syms
 
 Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 1 entry:
index 57965f2775a7e958b72621268d8c833064bc6849..d7c0a47cddf3f7bbda7c8cfa81ee9ba264f0c2ef 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-2.s
 #as: --32 -mrelax-relocations=no
-#ld: -pie -E -m elf_i386
+#ld: -pie -E -m elf_i386 -z notext
 #readelf : -r --wide -x .got -x .got.plt --dyn-syms
 
 Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 1 entry:
index 3c7cd6def3cc1fcb7778ed1ae416c797bf5b9cc9..b126480b4f285b8c29e62535a4a1ed0c9bb96c33 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-2.s
 #as: --32 -mrelax-relocations=no
-#ld: -pie -m elf_i386
+#ld: -pie -m elf_i386 -z notext
 #objdump: -dw
 #notarget: i?86-*-nacl* x86_64-*-nacl*
 
index 28eaa04d2bb5d91ee9e35667387f8b53ad47d312..694be367ebb646cb007be9e41856ef39644d9815 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-2.s
 #as: --32 -mrelax-relocations=no
-#ld: -shared -m elf_i386
+#ld: -shared -m elf_i386 -z notext
 #readelf : -r --wide --dyn-syms
 #notarget: i?86-*-nacl* x86_64-*-nacl*
 
index 148e3060a7f62de94a211f20dd5cbd49fedbbaef..c039fcb0a312339bc8a72ebd14c9363523e50104 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-2.s
 #as: --32 -mrelax-relocations=no
-#ld: -shared -Bsymbolic -m elf_i386
+#ld: -shared -Bsymbolic -m elf_i386 -z notext
 #readelf : -r --wide --dyn-syms
 #notarget: i?86-*-nacl* x86_64-*-nacl*
 
index 7004bb14f052e804111fe1e3a4ba348b62539153..7af7ba36e94e77026c8e1a863aa598193600ac0d 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-3.s
 #as: --32
-#ld: -shared -m elf_i386
+#ld: -shared -m elf_i386 -z notext
 #readelf : -r --wide --dyn-syms
 
 Relocation section '\.rela?\..*' at offset 0x[0-9a-f]+ contains [0-9]+ entr(y|ies):
index aeb4e7e17121aada8d384f40251b8d218dae4af5..2b692caf95a13a4de0a9dda19deb3c8715115b62 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-3.s
 #as: --32
-#ld: -shared -Bsymbolic -m elf_i386
+#ld: -shared -Bsymbolic -m elf_i386 -z notext
 #readelf : -r --wide --dyn-syms
 
 Relocation section '\.rela?\..*' at offset 0x[0-9a-f]+ contains [0-9]+ entr(y|ies):
index 5124ae10dcbe9143db0e243eab09ecd7c9919e23..25d7188265016e5021bcf7c410fe702da144c983 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19939.s
 #as: --32
-#ld: -melf_i386 -shared
+#ld: -melf_i386 -shared -z notext
 #readelf: -d --wide
 
 #...
index c106ebf54f0b0406eb8ce17105f74b773fc8a3ca..e7e7a174719e5d42dd19689d52f96538f1b5d857 100644 (file)
@@ -1,6 +1,6 @@
 #source: undefweak.s
 #as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 -z notext
 #readelf: -r --wide
 
 Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
index e6d6d5f7c32180eb58d620f77683b4e6e2463b43..e823a68c4dec71a84760ee3ecd14b2cdc6145bcc 100644 (file)
@@ -1,6 +1,6 @@
 #source: undefweak.s
 #as: --32
-#ld: -pie -melf_i386
+#ld: -pie -melf_i386 -z notext
 #readelf: -r --wide -x .data.rel.ro
 
 Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
index 32cdbe8a417d08c5a5906bd792e335f8a70efd97..fa64730775cacdcf7ef9be657c2399bc840c6cdf 100644 (file)
@@ -133,6 +133,9 @@ proc shared_test { progname testname main sh1 sh2 dat args } {
     if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
        set shared "-bM:SRE -bE:$tmpdir/xcoff.exp"
     }
+    if { [is_elf_format] && [check_shared_lib_support] } {
+       append shared " -Wl,-z,notext"
+    }
     if {![ld_link $CC $tmpdir/$progname.so "$shared $shldflags $tmpdir/$sh1 $tmpdir/$sh2"]} {
         fail "$testname"
        return
index 23b0b875586e1b68e0e7306755a70fe1dc2c7b05..20ebc01cc6fbcbb021e7408fdfc421875bf263c2 100644 (file)
@@ -114,7 +114,7 @@ run_cc_link_tests [list \
     ] \
     [list \
        "Build size-7" \
-       "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libsize-7.so" \
+       "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/libsize-7.so" \
        "$NOPIE_CFLAGS" \
        {size-7a.c} \
        {{readelf -rW size-7.rd}} \
@@ -129,7 +129,7 @@ run_cc_link_tests [list \
     ] \
     [list \
        "Build size-8" \
-       "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libsize-8.so" \
+       "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/libsize-8.so" \
        "$NOPIE_CFLAGS" \
        {size-8a.c} \
        {{readelf -rW size-8.rd}} \
@@ -277,7 +277,7 @@ run_ld_link_exec_tests [list \
     ] \
     [list \
        "Run size-8" \
-       "$NOPIE_LDFLAGS -Wl,--no-as-needed,--hash-styl=gnu \
+       "$NOPIE_LDFLAGS -Wl,--no-as-needed,--hash-styl=gnu,-z,notext \
         tmpdir/libsize-8.so" \
        "" \
        {size-8a.c} \
index 0775c7d64a1172135b334b9dd3174115585fb1a4..6f2112c5d79cf886283c4061191cf7f2dba3e0e0 100644 (file)
@@ -208,7 +208,7 @@ if {![ld_link "$CC $board_cflags" "tmpdir/unique_shared_prog" "-Ltmpdir tmpdir/u
 }
 
 # Create shared library containing unique symbol with reference.
-if {![ld_link $ld "tmpdir/libunique_shared_ref.so" "-shared tmpdir/unique_shared.o tmpdir/unique_empty.o"] } {
+if {![ld_link $ld "tmpdir/libunique_shared_ref.so" "-shared -z notext tmpdir/unique_shared.o tmpdir/unique_empty.o"] } {
     fail "Could not create a shared library containing an unique symbol with reference"
     set fails [expr $fails + 1]
 }
index 3e64c150bcc13d4b2cd0ce3126c784d05ff1c78e..acd90b7952bbc4e5caebc8168e7b780c333995e7 100644 (file)
@@ -1,6 +1,6 @@
 #name: PIE with undefined symbol
 #as: --64
-#ld: -pie -melf_x86_64 --noinhibit-exec
+#ld: -pie -melf_x86_64 --noinhibit-exec -z notext
 #readelf: -s --wide
 #warning: \A[^\n]*\.o[^\n]*in function `_start':\n[^\n]*: undefined reference to `foo'\Z
 
index 8c456d848233216c53f0f28eadcd4603c5949c02..3b696c58cb6a6764a6b1cb171187bcfa9e7de399 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19539.s
 #as: --64
-#ld: -pie -m elf_x86_64 -T pr19539.t
+#ld: -pie -m elf_x86_64 -T pr19539.t -z notext
 #readelf: -r --wide
 
 Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
index f338987def744525a1dec7636114174beec85532..0e50f326466a11832b51abff904ce750450070ee 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19539.s
 #as: --x32
-#ld: -pie -m elf32_x86_64 -T pr19539.t
+#ld: -pie -m elf32_x86_64 -T pr19539.t -z notext
 #readelf: -r --wide
 
 Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
index ccab633190c101898801f705b10d314c40764681..6b33d9c91b9b28eab044e623958c9a0b9a2b1f93 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-1.s
 #as: --64
-#ld: -shared -m elf_x86_64
+#ld: -shared -m elf_x86_64 -z notext
 #readelf : -r --wide --dyn-syms
 
 Relocation section '\.rela?\..*' at offset 0x[0-9a-f]+ contains [0-9]+ entr(y|ies):
index 85161493900d87ad469f617c9f96eedb6e7652f7..fb01a235b509e1902b0650d17b6c2e29aaa2217c 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-1.s
 #as: --64
-#ld: -shared -Bsymbolic -m elf_x86_64
+#ld: -shared -Bsymbolic -m elf_x86_64 -z notext
 #readelf : -r --wide --dyn-syms
 
 Relocation section '\.rela?\..*' at offset 0x[0-9a-f]+ contains [0-9]+ entr(y|ies):
index f3c5390b28594638568b8ba6374cd00b307396b6..6792e381fc203e1f93e73d8efd13b3fa7fd54428 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19807-1.s
 #as: --64
-#ld: -pie -melf_x86_64 -z noreloc-overflow
+#ld: -pie -melf_x86_64 -z noreloc-overflow -z notext
 #objdump: -dw
 
 .*: +file format .*
index 6af4985463c57f8d32f3b81b8e253dbfe4d8daee..1983a81dd9e00f8e73e73b08f1a0239cc1c3815a 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19807-1.s
 #as: --x32
-#ld: -pie -melf32_x86_64 -z noreloc-overflow
+#ld: -pie -melf32_x86_64 -z noreloc-overflow -z notext
 #objdump: -dw
 
 .*: +file format .*
index 44205f2308cca401225f58eac03ed2779eadc335..8e3af447a31f0a01b50d72e040880fcbd6782ba4 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19807-2.s
 #as: --x32
-#ld: -pie -melf32_x86_64
+#ld: -pie -melf32_x86_64 -z notext
 #readelf: -r --wide
 
 Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
index 83ac64162429df3c7edfd010d9df2ea5a7f5e513..96e92544515e2ae128265f6465a258f63551263a 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19807-2.s
 #as: --x32
-#ld: -pie -melf32_x86_64
+#ld: -pie -melf32_x86_64 -z notext
 #objdump: -dw
 
 .*: +file format .*
index 5394615158f938a4da2322234b3135ae1daf3718..413df228efafb65a966a04ebbb339b46ae56a336 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19807-2.s
 #as: --64
-#ld: -pie -melf_x86_64 -z noreloc-overflow
+#ld: -pie -melf_x86_64 -z noreloc-overflow -z notext
 #readelf: -r --wide
 
 Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
index f26616a20a839babade0874e3f8e279e4f910846..2d57596279104781499e4d1f881a978827e1a7d5 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19807-2.s
 #as: --64
-#ld: -pie -melf_x86_64 -z noreloc-overflow
+#ld: -pie -melf_x86_64 -z noreloc-overflow -z notext
 #objdump: -dw
 
 .*: +file format .*
index 26161515508906e53c143d878b6f5d79209db98e..e239f2da0e6947fb57c6cb19ad43361800281956 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19939.s
 #as: --64
-#ld: -melf_x86_64 -shared
+#ld: -melf_x86_64 -shared -z notext
 #readelf: -d --wide
 
 #...
index 9db16c6b6e0786c78e9450e0756f79da6310a27f..07b70a4b8abaa8c3615524709a30669757cfe16a 100644 (file)
@@ -212,9 +212,12 @@ set x86_64tests {
      "--64" { pr19827a.S }}
     {"Build pr19827b.so" "-melf_x86_64 -shared" ""
      "--64" { pr19827b.S } {} "pr19827b.so"}
-    {"Build pr19827" "-melf_x86_64 -pie tmpdir/pr19827a.o tmpdir/pr19827b.so" ""
+    {"Build pr19827"
+     "-melf_x86_64 -pie -z notext tmpdir/pr19827a.o tmpdir/pr19827b.so"
+     ""
      "--64" { dummy.s } {{readelf {-rW} pr19827.rd}} "pr19827"}
-    {"Build pr19827.so" "-melf_x86_64 -shared -Bsymbolic" ""
+    {"Build pr19827.so"
+     "-melf_x86_64 -shared -Bsymbolic -z notext" ""
      "--64" { pr19827a.S }  {{readelf {-rW} pr19827.rd}} "pr19827.so"}
     {"Build pr19969.so" "-melf_x86_64 -shared" ""
      "--64" { pr19969a.S } {} "pr19969.so"}
@@ -222,7 +225,9 @@ set x86_64tests {
      "--64" { pr20550a.s }}
     {"Build pr20550b.so" "-melf_x86_64 -shared" ""
      "--64" { pr20550b.s } {} "pr20550b.so"}
-    {"Build pr20550" "-melf_x86_64 -pie tmpdir/pr20550a.o tmpdir/pr20550b.so" ""
+    {"Build pr20550"
+     "-melf_x86_64 -pie -z notext tmpdir/pr20550a.o tmpdir/pr20550b.so"
+     ""
      "--64" { dummy.s } {} "pr20550"}
 }
 
@@ -1172,7 +1177,7 @@ if { [isnative] && [check_compiler_available] } {
        ] \
        [list \
            "Build pr22001-1a" \
-           "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
+           "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext tmpdir/pr22001-1.so" \
            "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
            { pr22001-1b.c } \
            {{error_output "pr22001-1a.err"}} \
@@ -1188,7 +1193,7 @@ if { [isnative] && [check_compiler_available] } {
        ] \
        [list \
            "Build pr21997-1a" \
-           "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+           "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/pr21997-1.so" \
            "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
            { pr21997-1b.c } \
            {{error_output "pr21997-1a.err"}} \
@@ -1263,7 +1268,7 @@ if { [isnative] && [check_compiler_available] } {
        ] \
        [list \
            "Build pr22791-1" \
-           "-pie -Wl,--no-as-needed tmpdir/pr22791-1.so" \
+           "-pie -Wl,--no-as-needed,-z,notext tmpdir/pr22791-1.so" \
            "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
            { pr22791-1b.s } \
            {{error_output "pr22791-1.err"}} \
@@ -1359,7 +1364,7 @@ if { [isnative] && [check_compiler_available] } {
        run_ld_link_exec_tests [list \
            [list \
                "Run pr22001-1b" \
-               "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
+               "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext tmpdir/pr22001-1.so" \
                "-Wa,-mx86-used-note=yes" \
                { pr22001-1c.c } \
                "pr22001-1b" \
@@ -1368,7 +1373,7 @@ if { [isnative] && [check_compiler_available] } {
            ] \
            [list \
                "Run pr21997-1b" \
-               "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+               "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/pr21997-1.so" \
                "-Wa,-mx86-used-note=yes" \
                { pr21997-1c.c } \
                "pr21997-1b" \
@@ -1422,7 +1427,7 @@ if { [isnative] && [check_compiler_available] } {
            ] \
            [list \
                "Run pr25416-5f (PIE GDesc -> LE -maddress-mode=short)" \
-               "-pie tmpdir/pr25416-5b.o tmpdir/pr25416-5d.o" \
+               "-pie -Wl,-z,notext tmpdir/pr25416-5b.o tmpdir/pr25416-5d.o" \
                "-Wa,-mx86-used-note=yes" \
                { pr25416-5a.c } \
                "pr25416-5f" \
@@ -1430,7 +1435,7 @@ if { [isnative] && [check_compiler_available] } {
            ] \
            [list \
                "Run pr25416-5g (PIE GDesc -> LE -maddress-mode=long)" \
-               "-pie tmpdir/pr25416-5c.o tmpdir/pr25416-5d.o" \
+               "-pie -Wl,-z,notext tmpdir/pr25416-5c.o tmpdir/pr25416-5d.o" \
                "-Wa,-mx86-used-note=yes" \
                { pr25416-5a.c } \
                "pr25416-5g" \