diff options
author | T.K. Chia <u1049321969@caramail.com> | 2020-10-05 05:46:23 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-10-05 05:58:33 -0700 |
commit | 6d96a5946d1ec76fea79bc36aa95d7d3dd304200 (patch) | |
tree | 5dfc3a12aef12d0b0938764083ab2f12db6b19d6 /ld/testsuite | |
parent | 983d925db6a09ac90f6bed90be16eb69267b58e0 (diff) | |
download | gdb-6d96a5946d1ec76fea79bc36aa95d7d3dd304200.zip gdb-6d96a5946d1ec76fea79bc36aa95d7d3dd304200.tar.gz gdb-6d96a5946d1ec76fea79bc36aa95d7d3dd304200.tar.bz2 |
i386: Allow non-absolute segment values for lcall/ljmp
Allow an unresolved or non-absolute symbol as the segment operand of an
immediate far jump (`ljmp SEG, OFF') or far call (`lcall SEG, OFF').
gas/
2020-10-05 T.K. Chia <u1049321969@caramail.com>
PR gas/26694
* NEWS: Updated for i386 lcall and ljmp change.
* config/tc-i386.c (output_interseg_jump): Allow non-absolute
segment operand for immediate lcall and ljmp.
* testsuite/gas/i386/jump.d,
* testsuite/gas/i386/jump.s,
* testsuite/gas/i386/jump16.d,
* testsuite/gas/i386/jump16.e,
* testsuite/gas/i386/jump16.s: Add tests for non-absolute
segment operand for immediate ljmp.
ld/
2020-10-05 T.K. Chia <u1049321969@caramail.com>
PR gas/26694
* testsuite/ld-i386/ljmp.s,
* testsuite/ld-i386/ljmp1.d,
* testsuite/ld-i386/ljmp1.s,
* testsuite/ld-i386/ljmp2.d,
* testsuite/ld-i386/ljmp2.s,
* testsuite/ld-x86-64/ljmp1.d,
* testsuite/ld-x86-64/ljmp2.d: New testcases.
* testsuite/ld-i386/i386.exp,
* testsuite/ld-x86-64/x86-64.exp: Run them.
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ld-i386/i386.exp | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/ljmp.s | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/ljmp1.d | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/ljmp1.s | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/ljmp2.d | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/ljmp2.s | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/ljmp1.d | 17 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/ljmp2.d | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/x86-64.exp | 2 |
9 files changed, 80 insertions, 0 deletions
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 164c099..d0b8ed7 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -342,6 +342,8 @@ run_dump_test "call3g" run_dump_test "call3h" run_dump_test "jmp1" run_dump_test "jmp2" +run_dump_test "ljmp1" +run_dump_test "ljmp2" run_dump_test "load1" run_dump_test "load2" run_dump_test "load3" diff --git a/ld/testsuite/ld-i386/ljmp.s b/ld/testsuite/ld-i386/ljmp.s new file mode 100644 index 0000000..4b27a25 --- /dev/null +++ b/ld/testsuite/ld-i386/ljmp.s @@ -0,0 +1,10 @@ + .global seg1 + .equiv seg1, 8 + .global seg2 + .equiv seg2, 0x18 + /* Bad IA-16 segment values --- will overflow R_386_16 (and + R_X86_64_16). */ + .global seg3 + .equiv seg3, 0x10000 + .global seg4 + .equiv seg4, -0x10001 diff --git a/ld/testsuite/ld-i386/ljmp1.d b/ld/testsuite/ld-i386/ljmp1.d new file mode 100644 index 0000000..9708ad0 --- /dev/null +++ b/ld/testsuite/ld-i386/ljmp1.d @@ -0,0 +1,18 @@ +#name: Absolute non-overflowing relocs in ljmp segments +#as: --32 +#source: ljmp1.s +#source: ljmp.s +#ld: -melf_i386 -z noseparate-code +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +0+[a-f0-9]+ <_start>: + +[a-f0-9]+: 0f 22 c0 mov %eax,%cr0 + +[a-f0-9]+: ea ([0-9a-f]{2} ){4}08 00 ljmp \$0x8,\$0x[a-f0-9]+ + +0+[a-f0-9]+ <foo>: + +[a-f0-9]+: 66 ea 00 00 18 00 ljmpw \$0x18,\$0x0 diff --git a/ld/testsuite/ld-i386/ljmp1.s b/ld/testsuite/ld-i386/ljmp1.s new file mode 100644 index 0000000..3ae6882 --- /dev/null +++ b/ld/testsuite/ld-i386/ljmp1.s @@ -0,0 +1,9 @@ + .text +.code32 + .global _start +_start: + movl %eax, %cr0 + ljmp $seg1, $foo +foo: + ljmpw $seg2, $0 + .p2align 4,0x90 diff --git a/ld/testsuite/ld-i386/ljmp2.d b/ld/testsuite/ld-i386/ljmp2.d new file mode 100644 index 0000000..b599cf9 --- /dev/null +++ b/ld/testsuite/ld-i386/ljmp2.d @@ -0,0 +1,7 @@ +#name: ljmp segment value overflow +#as: --32 +#source: ljmp2.s +#source: ljmp.s +#ld: -melf_i386 -z noseparate-code +#error: .*relocation truncated to fit: R_386_16 .* +#error: .*relocation truncated to fit: R_386_16 .* diff --git a/ld/testsuite/ld-i386/ljmp2.s b/ld/testsuite/ld-i386/ljmp2.s new file mode 100644 index 0000000..f6a4227 --- /dev/null +++ b/ld/testsuite/ld-i386/ljmp2.s @@ -0,0 +1,9 @@ + .text +.code32 + .global _start +_start: + movl %eax, %cr0 + ljmp $seg3, $foo +foo: + ljmpw $seg4, $0 + .p2align 4,0x90 diff --git a/ld/testsuite/ld-x86-64/ljmp1.d b/ld/testsuite/ld-x86-64/ljmp1.d new file mode 100644 index 0000000..eb378fb --- /dev/null +++ b/ld/testsuite/ld-x86-64/ljmp1.d @@ -0,0 +1,17 @@ +#name: Absolute non-overflowing relocs in ljmp segments +#source: ../ld-i386/ljmp1.s +#source: ../ld-i386/ljmp.s +#ld: -z noseparate-code +#objdump: -Mi386 -dw + +.*: +file format .* + + +Disassembly of section .text: + +0+[a-f0-9]+ <_start>: + +[a-f0-9]+: 0f 22 c0 mov %eax,%cr0 + +[a-f0-9]+: ea ([0-9a-f]{2} ){4}08 00 ljmp \$0x8,\$0x[a-f0-9]+ + +0+[a-f0-9]+ <foo>: + +[a-f0-9]+: 66 ea 00 00 18 00 ljmpw \$0x18,\$0x0 diff --git a/ld/testsuite/ld-x86-64/ljmp2.d b/ld/testsuite/ld-x86-64/ljmp2.d new file mode 100644 index 0000000..b358182 --- /dev/null +++ b/ld/testsuite/ld-x86-64/ljmp2.d @@ -0,0 +1,6 @@ +#name: ljmp segment value overflow +#source: ../ld-i386/ljmp2.s +#source: ../ld-i386/ljmp.s +#ld: -z noseparate-code +#error: .*relocation truncated to fit: R_X86_64_16 .* +#error: .*relocation truncated to fit: R_X86_64_16 .* diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 3c0b434..2c2551f 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -519,6 +519,8 @@ run_dump_test "mov2a" run_dump_test "mov2b" run_dump_test "mov2c" run_dump_test "mov2d" +run_dump_test "ljmp1" +run_dump_test "ljmp2" run_dump_test "load1a" run_dump_test "load1b" run_dump_test "load1c" |