diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2010-12-02 13:25:13 +0000 |
---|---|---|
committer | Richard Sandiford <rdsandiford@googlemail.com> | 2010-12-02 13:25:13 +0000 |
commit | c969da647374bec1548589cd47406e2a12a7800c (patch) | |
tree | 70576c6e17cf11e39b7eb45aac6bf109929e911e /gas/testsuite | |
parent | 0c98115d15fbd16d6808a5a7718d748072c00dd7 (diff) | |
download | gdb-c969da647374bec1548589cd47406e2a12a7800c.zip gdb-c969da647374bec1548589cd47406e2a12a7800c.tar.gz gdb-c969da647374bec1548589cd47406e2a12a7800c.tar.bz2 |
gas/
* symbols.c (S_FORCE_RELOC): Return true for indirect functions
even if !strict.
* expr.c (operand): Don't convert absolute symbols to constants
if S_FORCE_RELOC is true.
(expr): Only reduce subtractions between different symbols if
S_FORCE_RELOC is false for both of them.
* write.c (fixup_segment): Don't remove symbols if S_FORCE_RELOC
is true for them, regardless of their segment.
gas/testsuite/
* gas/i386/ifunc-2.s, gas/i386/ifunc-2.l: New test.
* gas/i386/ifunc-3.s, gas/i386/ifunc-3.d: Likeise.
* gas/i386/i386.exp: Run them.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/i386.exp | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/ifunc-2.l | 61 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/ifunc-2.s | 100 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/ifunc-3.d | 57 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/ifunc-3.s | 54 |
6 files changed, 280 insertions, 0 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 90b3bfc..10fbad8 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-12-02 Richard Sandiford <richard.sandiford@linaro.org> + + * gas/i386/ifunc-2.s, gas/i386/ifunc-2.l: New test. + * gas/i386/ifunc-3.s, gas/i386/ifunc-3.d: Likeise. + * gas/i386/i386.exp: Run them. + 2010-11-20 Richard Sandiford <rdsandiford@googlemail.com> * lib/gas-defs.exp (regexp_diff): Delete. diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index c295be6..3a966d7 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -215,6 +215,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] run_list_test "inval-equ-1" "-al" run_list_test "inval-equ-2" "-al" run_dump_test "ifunc" + run_list_test "ifunc-2" + run_dump_test "ifunc-3" run_list_test "l1om-inval" "-march=l1om --32" run_dump_test "localpic" run_dump_test "debug1" diff --git a/gas/testsuite/gas/i386/ifunc-2.l b/gas/testsuite/gas/i386/ifunc-2.l new file mode 100644 index 0000000..0ed314b --- /dev/null +++ b/gas/testsuite/gas/i386/ifunc-2.l @@ -0,0 +1,61 @@ +.*/ifunc-2\.s: Assembler messages: +.*/ifunc-2\.s:4: Error: can't resolve `bar1' {\.text\.1 section} - `foo1' {\.text\.1 section} +.*/ifunc-2\.s:5: Error: can't resolve `bar2' {\.text\.2 section} - `foo2' {\.text\.2 section} +.*/ifunc-2\.s:6: Error: can't resolve `bar1' {\.text\.1 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:7: Error: can't resolve `bar2' {\.text\.2 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:8: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:9: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:10: Error: can't resolve `bar1' {\.text\.1 section} - `abs1' {\*ABS\* section} +.*/ifunc-2\.s:11: Error: can't resolve `abs1' {\*ABS\* section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:12: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:19: Error: can't resolve `bar1' {\.text\.1 section} - `foo1' {\.text\.1 section} +.*/ifunc-2\.s:20: Error: can't resolve `bar2' {\.text\.2 section} - `foo2' {\.text\.2 section} +.*/ifunc-2\.s:21: Error: can't resolve `bar1' {\.text\.1 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:22: Error: can't resolve `bar2' {\.text\.2 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:23: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:24: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:25: Error: can't resolve `bar1' {\.text\.1 section} - `abs1' {\*ABS\* section} +.*/ifunc-2\.s:26: Error: can't resolve `abs1' {\*ABS\* section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:27: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:34: Error: can't resolve `bar1' {\.text\.1 section} - `foo1' {\.text\.1 section} +.*/ifunc-2\.s:35: Error: can't resolve `bar2' {\.text\.2 section} - `foo2' {\.text\.2 section} +.*/ifunc-2\.s:36: Error: can't resolve `bar1' {\.text\.1 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:37: Error: can't resolve `bar2' {\.text\.2 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:38: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:39: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:40: Error: can't resolve `bar1' {\.text\.1 section} - `abs1' {\*ABS\* section} +.*/ifunc-2\.s:41: Error: can't resolve `abs1' {\*ABS\* section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:42: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:44: Error: can't resolve `abs1' {\*ABS\* section} - `abs2' {\*ABS\* section} +.*/ifunc-2\.s:45: Error: can't resolve `abs2' {\*ABS\* section} - `abs1' {\*ABS\* section} +.*/ifunc-2\.s:50: Error: can't resolve `abs1' {\*ABS\* section} - `abs2' {\*ABS\* section} +.*/ifunc-2\.s:51: Error: can't resolve `abs2' {\*ABS\* section} - `abs1' {\*ABS\* section} +.*/ifunc-2\.s:56: Error: can't resolve `abs1' {\*ABS\* section} - `abs2' {\*ABS\* section} +.*/ifunc-2\.s:57: Error: can't resolve `abs2' {\*ABS\* section} - `abs1' {\*ABS\* section} +.*/ifunc-2\.s:62: Error: can't resolve `bar1' {\.text\.1 section} - `foo1' {\.text\.1 section} +.*/ifunc-2\.s:63: Error: can't resolve `bar2' {\.text\.2 section} - `foo2' {\.text\.2 section} +.*/ifunc-2\.s:64: Error: can't resolve `bar1' {\.text\.1 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:65: Error: can't resolve `bar2' {\.text\.2 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:66: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:67: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:68: Error: can't resolve `bar2' {\.text\.2 section} - `abs1' {\*ABS\* section} +.*/ifunc-2\.s:69: Error: can't resolve `abs1' {\*ABS\* section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:70: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:77: Error: can't resolve `bar1' {\.text\.1 section} - `foo1' {\.text\.1 section} +.*/ifunc-2\.s:78: Error: can't resolve `bar2' {\.text\.2 section} - `foo2' {\.text\.2 section} +.*/ifunc-2\.s:79: Error: can't resolve `bar1' {\.text\.1 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:80: Error: can't resolve `bar2' {\.text\.2 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:81: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:82: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:83: Error: can't resolve `bar2' {\.text\.2 section} - `abs1' {\*ABS\* section} +.*/ifunc-2\.s:84: Error: can't resolve `abs1' {\*ABS\* section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:85: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:92: Error: can't resolve `bar1' {\.text\.1 section} - `foo1' {\.text\.1 section} +.*/ifunc-2\.s:93: Error: can't resolve `bar2' {\.text\.2 section} - `foo2' {\.text\.2 section} +.*/ifunc-2\.s:94: Error: can't resolve `bar1' {\.text\.1 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:95: Error: can't resolve `bar2' {\.text\.2 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:96: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar1' {\.text\.1 section} +.*/ifunc-2\.s:97: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:98: Error: can't resolve `bar2' {\.text\.2 section} - `abs1' {\*ABS\* section} +.*/ifunc-2\.s:99: Error: can't resolve `abs1' {\*ABS\* section} - `bar2' {\.text\.2 section} +.*/ifunc-2\.s:100: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar2' {\.text\.2 section} diff --git a/gas/testsuite/gas/i386/ifunc-2.s b/gas/testsuite/gas/i386/ifunc-2.s new file mode 100644 index 0000000..ca536d3 --- /dev/null +++ b/gas/testsuite/gas/i386/ifunc-2.s @@ -0,0 +1,100 @@ + .section .text.1,"ax",@progbits + +start1: + .long bar1-foo1 + .long bar2-foo2 + .long bar1-bar2 + .long bar2-bar1 + .long start1-bar1 + .long start1-bar2 + .long bar1-abs1 + .long abs1-bar1 + .long .-bar1 + + .type foo1,%gnu_indirect_function +foo1: + ret + .size foo1,.-foo1 + + .long bar1-foo1 + .long bar2-foo2 + .long bar1-bar2 + .long bar2-bar1 + .long start1-bar1 + .long start1-bar2 + .long bar1-abs1 + .long abs1-bar1 + .long .-bar1 + + .type bar1,%gnu_indirect_function +bar1: + ret + .size bar1,.-bar1 + + .long bar1-foo1 + .long bar2-foo2 + .long bar1-bar2 + .long bar2-bar1 + .long start1-bar1 + .long start1-bar2 + .long bar1-abs1 + .long abs1-bar1 + .long .-bar1 + + .long abs1-abs2 + .long abs2-abs1 + + .equ abs1,0x11223300 + .type abs1,%gnu_indirect_function + + .long abs1-abs2 + .long abs2-abs1 + + .equ abs2,0x11223380 + .type abs2,%gnu_indirect_function + + .long abs1-abs2 + .long abs2-abs1 + + .section .text.2,"ax",@progbits + +start2: + .long bar1-foo1 + .long bar2-foo2 + .long bar1-bar2 + .long bar2-bar1 + .long start2-bar1 + .long start2-bar2 + .long bar2-abs1 + .long abs1-bar2 + .long .-bar2 + + .type foo2,%gnu_indirect_function +foo2: + ret + .size foo2,.-foo2 + + .long bar1-foo1 + .long bar2-foo2 + .long bar1-bar2 + .long bar2-bar1 + .long start2-bar1 + .long start2-bar2 + .long bar2-abs1 + .long abs1-bar2 + .long .-bar2 + + .type bar2,%gnu_indirect_function +bar2: + ret + .size bar2,.-bar2 + + .long bar1-foo1 + .long bar2-foo2 + .long bar1-bar2 + .long bar2-bar1 + .long start2-bar1 + .long start2-bar2 + .long bar2-abs1 + .long abs1-bar2 + .long .-bar2 diff --git a/gas/testsuite/gas/i386/ifunc-3.d b/gas/testsuite/gas/i386/ifunc-3.d new file mode 100644 index 0000000..124de37 --- /dev/null +++ b/gas/testsuite/gas/i386/ifunc-3.d @@ -0,0 +1,57 @@ +#readelf: --relocs --syms -x .text.1 -x .text.2 +#name: i386 ifunc 3 + +Relocation section '\.rel\.text\.1' at offset .* contains .* entries: + Offset Info Type Sym.Value Sym. Name +00000000 ........ R_386_PC32 bar1\(\) bar1 +00000004 ........ R_386_PC32 bar2\(\) bar2 +00000008 ........ R_386_PC32 bar1\(\) bar1 +0000000c ........ R_386_PC32 bar2\(\) bar2 +00000010 ........ R_386_32 bar1\(\) bar1 +00000018 ........ R_386_PC32 bar1\(\) bar1 +0000001c ........ R_386_PC32 bar2\(\) bar2 +00000020 ........ R_386_PC32 bar1\(\) bar1 +00000024 ........ R_386_PC32 bar2\(\) bar2 +00000028 ........ R_386_32 bar1\(\) bar1 +0000002c ........ R_386_PC32 abs1\(\) abs1 +00000030 ........ R_386_PC32 abs1\(\) abs1 +00000034 ........ R_386_32 abs1\(\) abs1 +00000038 ........ R_386_PC32 abs1\(\) abs1 +0000003c ........ R_386_PC32 abs1\(\) abs1 +00000040 ........ R_386_32 abs1\(\) abs1 + +Relocation section '\.rel\.text\.2' at offset .* contains .* entries: + Offset Info Type Sym.Value Sym. Name +00000000 ........ R_386_PC32 bar1\(\) bar1 +00000004 ........ R_386_PC32 bar2\(\) bar2 +00000008 ........ R_386_PC32 bar1\(\) bar1 +0000000c ........ R_386_PC32 bar2\(\) bar2 +00000010 ........ R_386_32 bar2\(\) bar2 +00000018 ........ R_386_PC32 bar1\(\) bar1 +0000001c ........ R_386_PC32 bar2\(\) bar2 +00000020 ........ R_386_PC32 bar1\(\) bar1 +00000024 ........ R_386_PC32 bar2\(\) bar2 +00000028 ........ R_386_32 bar2\(\) bar2 + +Symbol table '.symtab' contains .* entries: + Num: Value Size Type Bind Vis Ndx Name +#... +.*: 00000014 1 IFUNC LOCAL DEFAULT .* bar1 +.*: 00000014 1 IFUNC LOCAL DEFAULT .* bar2 +#... +.*: 11223300 0 IFUNC LOCAL DEFAULT ABS abs1 +#... + +Hex dump of section '\.text\.1': + NOTE: This section has relocations against it, but these have NOT been applied to this dump\. + 0x00000000 00000000 00000000 08000000 0c000000 .* + 0x00000010 4054ffff c38d7600 00000000 00000000 .* + 0x00000020 20000000 24000000 4054ffff 00000000 .* + 0x00000030 30000000 4054ffff 00000000 3c000000 .* + 0x00000040 4054ffff .* + +Hex dump of section '\.text\.2': + NOTE: This section has relocations against it, but these have NOT been applied to this dump\. + 0x00000000 00000000 00000000 08000000 0c000000 .* + 0x00000010 4054ffff c38d7600 00000000 00000000 .* + 0x00000020 20000000 24000000 4054ffff .* diff --git a/gas/testsuite/gas/i386/ifunc-3.s b/gas/testsuite/gas/i386/ifunc-3.s new file mode 100644 index 0000000..dbcf494 --- /dev/null +++ b/gas/testsuite/gas/i386/ifunc-3.s @@ -0,0 +1,54 @@ + .section .text.1,"ax",@progbits + +start1: + .long bar1-. + .long bar2-. + .long bar1-start1 + .long bar2-start1 + .long bar1-base + + .type bar1,%gnu_indirect_function +bar1: + ret + .size bar1,.-bar1 + .align 4 + + .long bar1-. + .long bar2-. + .long bar1-start1 + .long bar2-start1 + .long bar1-base + + .long abs1-. + .long abs1-start1 + .long abs1-base + + .equ abs1,0x11223300 + .type abs1,%gnu_indirect_function + + .long abs1-. + .long abs1-start1 + .long abs1-base + + .section .text.2,"ax",@progbits + +start2: + .long bar1-. + .long bar2-. + .long bar1-start2 + .long bar2-start2 + .long bar2-base + + .type bar2,%gnu_indirect_function +bar2: + ret + .size bar2,.-bar2 + .align 4 + + .long bar1-. + .long bar2-. + .long bar1-start2 + .long bar2-start2 + .long bar2-base + + .equ base,0xabc0 |