diff options
Diffstat (limited to 'ld/testsuite/ld-i386')
37 files changed, 798 insertions, 0 deletions
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 1a79694..ab8f017 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -320,6 +320,35 @@ run_dump_test "load5b" run_dump_test "load6" run_dump_test "pr19175" run_dump_test "pr19615" +run_dump_test "pr19636-1a" +run_dump_test "pr19636-1b" +run_dump_test "pr19636-1c" +run_dump_test "pr19636-1d" +run_dump_test "pr19636-1d-nacl" +run_dump_test "pr19636-1e" +run_dump_test "pr19636-1f" +run_dump_test "pr19636-1g" +run_dump_test "pr19636-1h" +run_dump_test "pr19636-1i" +run_dump_test "pr19636-2a" +run_dump_test "pr19636-2b" +run_dump_test "pr19636-2c" +run_dump_test "pr19636-2c-nacl" +run_dump_test "pr19636-2d" +run_dump_test "pr19636-2d-nacl" +run_dump_test "pr19636-2e" +run_dump_test "pr19636-2e-nacl" +run_dump_test "pr19636-3a" +run_dump_test "pr19636-3b" +run_dump_test "pr19636-3c" +run_dump_test "pr19636-3d" +run_dump_test "pr19636-3e" +run_dump_test "pr19636-3f" +run_dump_test "pr19636-3g" +run_dump_test "pr19636-4a" +run_dump_test "pr19636-4b" +run_dump_test "pr19636-4c" +run_dump_test "pr19636-4d" if { !([istarget "i?86-*-linux*"] || [istarget "i?86-*-gnu*"] @@ -339,6 +368,62 @@ run_dump_test "pr17935-2" run_dump_test "pr18801" run_dump_test "pr18815" +proc undefined_weak {cflags ldflags} { + set testname "Undefined weak symbol" + if { ![ string match "" $cflags$ldflags] } { + set testname "$testname ($cflags $ldflags)" + } + + if { [ regexp "\-fPIE" $cflags] + && ![ regexp "\-z nodynamic-undefined-weak" $ldflags] } { + set weak_symbol "Weak defined" + } else { + set weak_symbol "Weak undefined" + } + + run_cc_link_tests [list \ + [list \ + "Build libpr19704a.so" \ + "-shared -Wl,-soname,libpr19704.so" \ + "" \ + { dummy.s } \ + {} \ + "libpr19704a.so" \ + ] \ + [list \ + "Build libpr19704b.so" \ + "-shared -Wl,-soname,libpr19704.so" \ + "-fPIC" \ + { pr19704b.c } \ + {} \ + "libpr19704b.so" \ + ] \ + ] + + exec cp tmpdir/libpr19704a.so tmpdir/libpr19704.so + + run_ld_link_exec_tests [] [list \ + [list \ + "Run pr19704" \ + "$ldflags tmpdir/libpr19704.so -R tmpdir" \ + "" \ + { pr19704a.c } \ + "pr19704" \ + "pr19704.out" \ + "$cflags" \ + ] \ + ] + + exec cp tmpdir/libpr19704b.so tmpdir/libpr19704.so + + set exec_output [run_host_cmd tmpdir/pr19704 ""] + if {![string match $weak_symbol $exec_output]} { + fail $testname + } else { + pass $testname + } +} + # Add $PLT_CFLAGS if PLT is expected. global PLT_CFLAGS @@ -636,6 +721,12 @@ if { [isnative] "got1.out" \ ] \ ] + + undefined_weak "" "" + undefined_weak "-fPIE" "" + undefined_weak "-fPIE" "-pie" + undefined_weak "-fPIE" "-z nodynamic-undefined-weak" + undefined_weak "-fPIE" "-pie -z nodynamic-undefined-weak" } if { !([istarget "i?86-*-linux*"] diff --git a/ld/testsuite/ld-i386/pr19636-1.s b/ld/testsuite/ld-i386/pr19636-1.s new file mode 100644 index 0000000..b2bc4df --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1.s @@ -0,0 +1,9 @@ + .text + .weak func1 + .weak func2 + .weak func3 + .globl _start +_start: + cmp func1@GOT(%eax), %eax + jmp *func2@GOT(%eax) + call func3@PLT diff --git a/ld/testsuite/ld-i386/pr19636-1a.d b/ld/testsuite/ld-i386/pr19636-1a.d new file mode 100644 index 0000000..47b946f --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1a.d @@ -0,0 +1,16 @@ +#source: pr19636-1.s +#as: --32 -mrelax-relocations=no +#ld: -pie -m elf_i386 --no-dynamic-linker +#readelf : -r --wide -x .got -x .got.plt --dyn-syms + +There are no relocations in this file. + +Symbol table '\.dynsym' contains 1 entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name + +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + + +Hex dump of section '.got': + 0x[0-9a-f]+ [0 ]+\.+ + +Hex dump of section '.got.plt': + 0x[0-9a-f]+ +[0-9a-f]+ +[0 ]+ .\.+ diff --git a/ld/testsuite/ld-i386/pr19636-1b.d b/ld/testsuite/ld-i386/pr19636-1b.d new file mode 100644 index 0000000..bc67f9d --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1b.d @@ -0,0 +1,19 @@ +#source: pr19636-1.s +#as: --32 -mrelax-relocations=no +#ld: -pie -E -m elf_i386 --no-dynamic-linker +#readelf : -r --wide -x .got -x .got.plt --dyn-syms + +There are no relocations in this file. + +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name + +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_start +#... + +Hex dump of section '.got': + 0x[0-9a-f]+ [0 ]+\.+ + +Hex dump of section '.got.plt': + 0x[0-9a-f]+ +[0-9a-f]+ +[0 ]+ .\.+ diff --git a/ld/testsuite/ld-i386/pr19636-1c.d b/ld/testsuite/ld-i386/pr19636-1c.d new file mode 100644 index 0000000..9aebbb1 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1c.d @@ -0,0 +1,9 @@ +#source: pr19636-1.s +#as: --32 -mrelax-relocations=no +#ld: -pie -E -m elf_i386 --no-dynamic-linker +#readelf : --wide --dyn-syms + +#failif +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func[0-9]? +#... diff --git a/ld/testsuite/ld-i386/pr19636-1d-nacl.d b/ld/testsuite/ld-i386/pr19636-1d-nacl.d new file mode 100644 index 0000000..fef5eea --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1d-nacl.d @@ -0,0 +1,124 @@ +#source: pr19636-1.s +#as: --32 -mrelax-relocations=no +#ld: -pie -m elf_i386 --no-dynamic-linker +#objdump: -dw +#target: i?86-*-nacl* x86_64-*-nacl* + +.*: +file format .* + + +Disassembly of section .plt: + +0+ <.plt>: +[ ]*[a-f0-9]+: ff 73 04 pushl 0x4\(%ebx\) +[ ]*[a-f0-9]+: 8b 4b 08 mov 0x8\(%ebx\),%ecx +[ ]*[a-f0-9]+: 83 e1 e0 and \$0xffffffe0,%ecx +[ ]*[a-f0-9]+: ff e1 jmp \*%ecx +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 8b 8b 0c 00 00 00 mov 0xc\(%ebx\),%ecx +[ ]*[a-f0-9]+: 83 e1 e0 and \$0xffffffe0,%ecx +[ ]*[a-f0-9]+: ff e1 jmp \*%ecx +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 68 00 00 00 00 push \$0x0 +[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 6a <_start-0x16> +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop + +Disassembly of section .text: + +0+80 <_start>: +[ ]*[a-f0-9]+: 3b 80 f8 ff ff ff cmp -0x8\(%eax\),%eax +[ ]*[a-f0-9]+: ff a0 fc ff ff ff jmp \*-0x4\(%eax\) +[ ]*[a-f0-9]+: e8 af ff ff ff call 40 <_start-0x40> diff --git a/ld/testsuite/ld-i386/pr19636-1d.d b/ld/testsuite/ld-i386/pr19636-1d.d new file mode 100644 index 0000000..16e316c --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1d.d @@ -0,0 +1,26 @@ +#source: pr19636-1.s +#as: --32 -mrelax-relocations=no +#ld: -pie -m elf_i386 --no-dynamic-linker +#objdump: -dw +#notarget: i?86-*-nacl* x86_64-*-nacl* + +.*: +file format .* + + +Disassembly of section .plt: + +0+c0 <.plt>: +[ ]*[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\) +[ ]*[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\) +[ ]*[a-f0-9]+: 00 00 add %al,\(%eax\) +[ ]*[a-f0-9]+: 00 00 add %al,\(%eax\) +[ ]*[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\) +[ ]*[a-f0-9]+: 68 00 00 00 00 push \$0x0 +[ ]*[a-f0-9]+: e9 00 00 00 00 jmp [a-f0-9]+ <.*> + +Disassembly of section .text: + +0+e0 <_start>: +[ ]*[a-f0-9]+: 3b 80 f8 ff ff ff cmp -0x8\(%eax\),%eax +[ ]*[a-f0-9]+: ff a0 fc ff ff ff jmp \*-0x4\(%eax\) +[ ]*[a-f0-9]+: e8 df ff ff ff call d0 <_start-0x10> diff --git a/ld/testsuite/ld-i386/pr19636-1e.d b/ld/testsuite/ld-i386/pr19636-1e.d new file mode 100644 index 0000000..25a5b64 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1e.d @@ -0,0 +1,19 @@ +#source: pr19636-1.s +#as: --32 -mrelax-relocations=no +#ld: -shared -m elf_i386 --no-dynamic-linker +#readelf : -r --wide --dyn-syms + +Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 2 entries: + +Offset +Info +Type +Sym. Value +Symbol's Name +[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func1 +[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func2 + +Relocation section '\.rel\.plt' at offset 0x[0-9a-f]+ contains 1 entries: + +Offset +Info +Type +Sym. Value +Symbol's Name +[0-9a-f]+ +[0-9a-f]+ +R_386_JUMP_SLOT +0+ +func3 + +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func[0-9]? +#pass diff --git a/ld/testsuite/ld-i386/pr19636-1f.d b/ld/testsuite/ld-i386/pr19636-1f.d new file mode 100644 index 0000000..0bf7595 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1f.d @@ -0,0 +1,19 @@ +#source: pr19636-1.s +#as: --32 -mrelax-relocations=no +#ld: -shared -Bsymbolic -m elf_i386 --no-dynamic-linker +#readelf : -r --wide --dyn-syms + +Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 2 entries: + +Offset +Info +Type +Sym. Value +Symbol's Name +[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func1 +[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func2 + +Relocation section '\.rel\.plt' at offset 0x[0-9a-f]+ contains 1 entries: + +Offset +Info +Type +Sym. Value +Symbol's Name +[0-9a-f]+ +[0-9a-f]+ +R_386_JUMP_SLOT +0+ +func3 + +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func[0-9]? +#pass diff --git a/ld/testsuite/ld-i386/pr19636-1g.d b/ld/testsuite/ld-i386/pr19636-1g.d new file mode 100644 index 0000000..1b3233f --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1g.d @@ -0,0 +1,12 @@ +#source: pr19636-1.s +#as: --32 -mrelax-relocations=no +#ld: -m elf_i386 --no-dynamic-linker +#readelf : -r --wide -x .got -x .got.plt --dyn-syms + +There are no relocations in this file. + +Hex dump of section '.got': + 0x[0-9a-f]+ [0 ]+\.+ + +Hex dump of section '.got.plt': + 0x[0-9a-f]+ [0 ]+\.+ diff --git a/ld/testsuite/ld-i386/pr19636-1h.d b/ld/testsuite/ld-i386/pr19636-1h.d new file mode 100644 index 0000000..f9c4837 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1h.d @@ -0,0 +1,19 @@ +#source: pr19636-1.s +#as: --32 -mrelax-relocations=no +#ld: -E -m elf_i386 --no-dynamic-linker +#readelf : -r --wide -x .got -x .got.plt --dyn-syms + +There are no relocations in this file. + +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name + +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_start +#... + +Hex dump of section '.got': + 0x[0-9a-f]+ [0 ]+\.+ + +Hex dump of section '.got.plt': + 0x[0-9a-f]+ +[0-9a-f]+ +[0 ]+ .\.+ diff --git a/ld/testsuite/ld-i386/pr19636-1i.d b/ld/testsuite/ld-i386/pr19636-1i.d new file mode 100644 index 0000000..f67e39b --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1i.d @@ -0,0 +1,9 @@ +#source: pr19636-1.s +#as: --32 -mrelax-relocations=no +#ld: -E -m elf_i386 --no-dynamic-linker +#readelf : --wide --dyn-syms + +#failif +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func[0-9]? +#... diff --git a/ld/testsuite/ld-i386/pr19636-2.s b/ld/testsuite/ld-i386/pr19636-2.s new file mode 100644 index 0000000..e8e7c9f --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-2.s @@ -0,0 +1,9 @@ + .text + .weak func + .globl _start +_start: + cmp func@GOT(%eax), %eax + jmp *func@GOT(%eax) + call func@PLT + cmp $func, %eax + call func diff --git a/ld/testsuite/ld-i386/pr19636-2a.d b/ld/testsuite/ld-i386/pr19636-2a.d new file mode 100644 index 0000000..fbed7e7 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-2a.d @@ -0,0 +1,19 @@ +#source: pr19636-2.s +#as: --32 -mrelax-relocations=no +#ld: -pie -m elf_i386 +#readelf : -r --wide -x .got -x .got.plt --dyn-syms + +Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 1 entries: + +Offset +Info +Type +Sym. Value +Symbol's Name +[0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func + +Symbol table '\.dynsym' contains 2 entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name + +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func + +Hex dump of section '.got': + 0x[0-9a-f]+ [0 ]+\.+ + +Hex dump of section '.got.plt': + 0x[0-9a-f]+ +[0-9a-f]+ +[0 ]+ .\.+ diff --git a/ld/testsuite/ld-i386/pr19636-2b.d b/ld/testsuite/ld-i386/pr19636-2b.d new file mode 100644 index 0000000..9a0a263 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-2b.d @@ -0,0 +1,22 @@ +#source: pr19636-2.s +#as: --32 -mrelax-relocations=no +#ld: -pie -E -m elf_i386 +#readelf : -r --wide -x .got -x .got.plt --dyn-syms + +Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 1 entries: + +Offset +Info +Type +Sym. Value +Symbol's Name +[0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func + +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_start +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func +#... + +Hex dump of section '.got': + 0x[0-9a-f]+ [0 ]+\.+ + +Hex dump of section '.got.plt': + 0x[0-9a-f]+ +[0-9a-f]+ +[0 ]+ .\.+ diff --git a/ld/testsuite/ld-i386/pr19636-2c-nacl.d b/ld/testsuite/ld-i386/pr19636-2c-nacl.d new file mode 100644 index 0000000..7543e0e --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-2c-nacl.d @@ -0,0 +1,126 @@ +#source: pr19636-2.s +#as: --32 -mrelax-relocations=no +#ld: -pie -m elf_i386 +#objdump: -dw +#target: i?86-*-nacl* x86_64-*-nacl* + +.*: +file format .* + + +Disassembly of section .plt: + +0+ <.plt>: +[ ]*[a-f0-9]+: ff 73 04 pushl 0x4\(%ebx\) +[ ]*[a-f0-9]+: 8b 4b 08 mov 0x8\(%ebx\),%ecx +[ ]*[a-f0-9]+: 83 e1 e0 and \$0xffffffe0,%ecx +[ ]*[a-f0-9]+: ff e1 jmp \*%ecx +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 8b 8b 0c 00 00 00 mov 0xc\(%ebx\),%ecx +[ ]*[a-f0-9]+: 83 e1 e0 and \$0xffffffe0,%ecx +[ ]*[a-f0-9]+: ff e1 jmp \*%ecx +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 68 00 00 00 00 push \$0x0 +[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 6a <_start-0x16> +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: 90 nop + +Disassembly of section .text: + +0+80 <_start>: +[ ]*[a-f0-9]+: 3b 80 fc ff ff ff cmp -0x4\(%eax\),%eax +[ ]*[a-f0-9]+: ff a0 fc ff ff ff jmp \*-0x4\(%eax\) +[ ]*[a-f0-9]+: e8 af ff ff ff call 40 <_start-0x40> +[ ]*[a-f0-9]+: 3d 00 00 00 00 cmp \$0x0,%eax +[ ]*[a-f0-9]+: e8 fc ff ff ff call 97 <_start\+0x17> diff --git a/ld/testsuite/ld-i386/pr19636-2c.d b/ld/testsuite/ld-i386/pr19636-2c.d new file mode 100644 index 0000000..98b53aa --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-2c.d @@ -0,0 +1,28 @@ +#source: pr19636-2.s +#as: --32 -mrelax-relocations=no +#ld: -pie -m elf_i386 +#objdump: -dw +#notarget: i?86-*-nacl* x86_64-*-nacl* + +.*: +file format .* + + +Disassembly of section .plt: + +0+130 <.plt>: +[ ]*[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\) +[ ]*[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\) +[ ]*[a-f0-9]+: 00 00 add %al,\(%eax\) +[ ]*[a-f0-9]+: 00 00 add %al,\(%eax\) +[ ]*[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\) +[ ]*[a-f0-9]+: 68 00 00 00 00 push \$0x0 +[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 150 <_start> + +Disassembly of section .text: + +0+150 <_start>: +[ ]*[a-f0-9]+: 3b 80 fc ff ff ff cmp -0x4\(%eax\),%eax +[ ]*[a-f0-9]+: ff a0 fc ff ff ff jmp \*-0x4\(%eax\) +[ ]*[a-f0-9]+: e8 df ff ff ff call 140 <_start-0x10> +[ ]*[a-f0-9]+: 3d 00 00 00 00 cmp \$0x0,%eax +[ ]*[a-f0-9]+: e8 fc ff ff ff call 167 <_start\+0x17> diff --git a/ld/testsuite/ld-i386/pr19636-2d-nacl.d b/ld/testsuite/ld-i386/pr19636-2d-nacl.d new file mode 100644 index 0000000..99c491f --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-2d-nacl.d @@ -0,0 +1,21 @@ +#source: pr19636-2.s +#as: --32 -mrelax-relocations=no +#ld: -shared -m elf_i386 +#readelf : -r --wide --dyn-syms +#target: i?86-*-nacl* x86_64-*-nacl* + +Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 3 entries: + +Offset +Info +Type +Sym. Value +Symbol's Name +[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +func +[0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func +[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func + +Relocation section '\.rel\.plt' at offset [0x0-9a-f]+ contains 1 entries: + +Offset +Info +Type +Sym. Value +Symbol's Name +[0-9a-f]+ +[0-9a-f]+ +R_386_JUMP_SLOT +0+ +func + +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func +#pass diff --git a/ld/testsuite/ld-i386/pr19636-2d.d b/ld/testsuite/ld-i386/pr19636-2d.d new file mode 100644 index 0000000..28eaa04 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-2d.d @@ -0,0 +1,17 @@ +#source: pr19636-2.s +#as: --32 -mrelax-relocations=no +#ld: -shared -m elf_i386 +#readelf : -r --wide --dyn-syms +#notarget: i?86-*-nacl* x86_64-*-nacl* + +Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 3 entries: + +Offset +Info +Type +Sym. Value +Symbol's Name +[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +func +[0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func +[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func + +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func +#pass diff --git a/ld/testsuite/ld-i386/pr19636-2e-nacl.d b/ld/testsuite/ld-i386/pr19636-2e-nacl.d new file mode 100644 index 0000000..f791128 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-2e-nacl.d @@ -0,0 +1,21 @@ +#source: pr19636-2.s +#as: --32 -mrelax-relocations=no +#ld: -shared -Bsymbolic -m elf_i386 +#readelf : -r --wide --dyn-syms +#target: i?86-*-nacl* x86_64-*-nacl* + +Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 3 entries: + +Offset +Info +Type +Sym. Value +Symbol's Name +[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +func +[0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func +[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func + +Relocation section '\.rel\.plt' at offset [0x0-9a-f]+ contains 1 entries: + +Offset +Info +Type +Sym. Value +Symbol's Name +[0-9a-f]+ +[0-9a-f]+ +R_386_JUMP_SLOT +0+ +func + +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func +#pass diff --git a/ld/testsuite/ld-i386/pr19636-2e.d b/ld/testsuite/ld-i386/pr19636-2e.d new file mode 100644 index 0000000..148e306 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-2e.d @@ -0,0 +1,17 @@ +#source: pr19636-2.s +#as: --32 -mrelax-relocations=no +#ld: -shared -Bsymbolic -m elf_i386 +#readelf : -r --wide --dyn-syms +#notarget: i?86-*-nacl* x86_64-*-nacl* + +Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 3 entries: + +Offset +Info +Type +Sym. Value +Symbol's Name +[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +func +[0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func +[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func + +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func +#pass diff --git a/ld/testsuite/ld-i386/pr19636-3.s b/ld/testsuite/ld-i386/pr19636-3.s new file mode 100644 index 0000000..9bd7e4a --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-3.s @@ -0,0 +1,5 @@ + .text + .weak func + .globl _start +_start: + .dc.a func diff --git a/ld/testsuite/ld-i386/pr19636-3a.d b/ld/testsuite/ld-i386/pr19636-3a.d new file mode 100644 index 0000000..078896e --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-3a.d @@ -0,0 +1,10 @@ +#source: pr19636-3.s +#as: --32 +#ld: -pie -m elf_i386 +#readelf : -r --dyn-syms --wide + +There are no relocations in this file. + +Symbol table '\.dynsym' contains 1 entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name + +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + diff --git a/ld/testsuite/ld-i386/pr19636-3b.d b/ld/testsuite/ld-i386/pr19636-3b.d new file mode 100644 index 0000000..e8f9138 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-3b.d @@ -0,0 +1,6 @@ +#source: pr19636-3.s +#as: --32 +#ld: -pie -E -m elf_i386 +#readelf : -r --wide + +There are no relocations in this file. diff --git a/ld/testsuite/ld-i386/pr19636-3c.d b/ld/testsuite/ld-i386/pr19636-3c.d new file mode 100644 index 0000000..701b131 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-3c.d @@ -0,0 +1,9 @@ +#source: pr19636-3.s +#as: --32 +#ld: -pie -E -m elf_i386 +#readelf : --dyn-syms --wide + +#failif +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func +#... diff --git a/ld/testsuite/ld-i386/pr19636-3d.d b/ld/testsuite/ld-i386/pr19636-3d.d new file mode 100644 index 0000000..12ff6b8 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-3d.d @@ -0,0 +1,14 @@ +#source: pr19636-3.s +#as: --32 +#ld: -shared -m elf_i386 +#readelf : -r --wide --dyn-syms + +Relocation section '\.rela?\..*' at offset 0x[0-9a-f]+ contains [0-9]+ entries: +#... +[0-9a-f]+[ \t]+[0-9a-f]+[ \t]+R_.*[ \t]+[0-9a-f]+[ \t]+func.* +#... +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func +#... diff --git a/ld/testsuite/ld-i386/pr19636-3e.d b/ld/testsuite/ld-i386/pr19636-3e.d new file mode 100644 index 0000000..a0f3344 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-3e.d @@ -0,0 +1,14 @@ +#source: pr19636-3.s +#as: --32 +#ld: -shared -Bsymbolic -m elf_i386 +#readelf : -r --wide --dyn-syms + +Relocation section '\.rela?\..*' at offset 0x[0-9a-f]+ contains [0-9]+ entries: +#... +[0-9a-f]+[ \t]+[0-9a-f]+[ \t]+R_.*[ \t]+[0-9a-f]+[ \t]+func.* +#... +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func +#... diff --git a/ld/testsuite/ld-i386/pr19636-3f.d b/ld/testsuite/ld-i386/pr19636-3f.d new file mode 100644 index 0000000..858850b --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-3f.d @@ -0,0 +1,6 @@ +#source: pr19636-3.s +#as: --32 +#ld: -E -m elf_i386 +#readelf : -r --wide + +There are no relocations in this file. diff --git a/ld/testsuite/ld-i386/pr19636-3g.d b/ld/testsuite/ld-i386/pr19636-3g.d new file mode 100644 index 0000000..1b0d668 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-3g.d @@ -0,0 +1,9 @@ +#source: pr19636-3.s +#as: --32 +#ld: -E -m elf_i386 +#readelf : --dyn-syms --wide + +#failif +#... + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func +#... diff --git a/ld/testsuite/ld-i386/pr19636-4.s b/ld/testsuite/ld-i386/pr19636-4.s new file mode 100644 index 0000000..6c981f5 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-4.s @@ -0,0 +1,14 @@ + .text + .type start,"function" + .global start +start: + .type _start,"function" + .global _start +_start: + .type __start,"function" + .global __start +__start: + .type main,"function" + .global main +main: + .long 0 diff --git a/ld/testsuite/ld-i386/pr19636-4a.d b/ld/testsuite/ld-i386/pr19636-4a.d new file mode 100644 index 0000000..8cdbc1c --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-4a.d @@ -0,0 +1,8 @@ +#source: pr19636-4.s +#as: --32 +#ld: -pie --defsym foobar=0x100 -m elf_i386 +#readelf : --dyn-syms --wide + +Symbol table '\.dynsym' contains 1 entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name + +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + diff --git a/ld/testsuite/ld-i386/pr19636-4b.d b/ld/testsuite/ld-i386/pr19636-4b.d new file mode 100644 index 0000000..7ac3629 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-4b.d @@ -0,0 +1,10 @@ +#source: pr19636-4.s +#as: --32 +#ld: -pie -E --defsym foobar=0x100 -m elf_i386 +#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-i386/pr19636-4c.d b/ld/testsuite/ld-i386/pr19636-4c.d new file mode 100644 index 0000000..a3891c4 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-4c.d @@ -0,0 +1,10 @@ +#source: pr19636-4.s +#as: --32 +#ld: -shared -Bsymbolic --defsym foobar=0x100 -m elf_i386 +#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-i386/pr19636-4d.d b/ld/testsuite/ld-i386/pr19636-4d.d new file mode 100644 index 0000000..a9487f0 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-4d.d @@ -0,0 +1,10 @@ +#source: pr19636-4.s +#as: --32 +#ld: -E --defsym foobar=0x100 -m elf_i386 +#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-i386/pr19704.out b/ld/testsuite/ld-i386/pr19704.out new file mode 100644 index 0000000..3506f46 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19704.out @@ -0,0 +1 @@ +Weak undefined diff --git a/ld/testsuite/ld-i386/pr19704a.c b/ld/testsuite/ld-i386/pr19704a.c new file mode 100644 index 0000000..aa52e00 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19704a.c @@ -0,0 +1,13 @@ +#include <stdio.h> + +extern int __attribute__ ((weak)) fun (void); + +int +main (void) +{ + if (&fun != 0) + fun (); + else + printf ("Weak undefined\n"); + return 0; +} diff --git a/ld/testsuite/ld-i386/pr19704b.c b/ld/testsuite/ld-i386/pr19704b.c new file mode 100644 index 0000000..1d688e1 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19704b.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +void +fun (void) +{ + printf ("Weak defined\n"); +} |