>>> Andreas Jaeger 29.03.05 21:53:12 >>> >"Jan Beulich" < JBeulich@novell.com > writes: > >> While expressions like "sym - ." were correctly converted to use pc-relative >> relocations for 8-, 16-, and 32-bit operations, sign-extended 32-bit operands >> of 64-bit operations didn't get converted. > >Do you have a testcase? Attached/below. Built and tested on x86_64-unknown-linux-gnu. Jan gas/ 2005-03-30 Jan Beulich * config/tc-i386.c (md_apply_fix3): Also handle BFD_RELOC_X86_64_32S. (tc_gen_reloc): Handle BFD_RELOC_X86_64_32S in the default case. gas/testsuite/ 2005-03-30 Jan Beulich * gas/i386/x86-64-pcrel.[sd]: New. * gas/i386/i386.exp: Run new test. --- /home/jbeulich/src/binutils/mainline/2005-03-29/gas/config/tc-i386.c 2005-03-14 15:08:07.000000000 +0100 +++ 2005-03-29/gas/config/tc-i386.c 2005-03-29 15:51:21.258603448 +0200 @@ -4798,6 +4798,7 @@ md_apply_fix3 (fixP, valP, seg) break; case BFD_RELOC_32: + case BFD_RELOC_X86_64_32S: fixP->fx_r_type = BFD_RELOC_32_PCREL; break; case BFD_RELOC_16: @@ -5361,7 +5362,6 @@ tc_gen_reloc (section, fixp) case BFD_RELOC_386_TLS_GOTIE: case BFD_RELOC_386_TLS_LE_32: case BFD_RELOC_386_TLS_LE: - case BFD_RELOC_X86_64_32S: case BFD_RELOC_X86_64_TLSGD: case BFD_RELOC_X86_64_TLSLD: case BFD_RELOC_X86_64_DTPOFF32: --- /home/jbeulich/src/binutils/mainline/2005-03-29/gas/testsuite/gas/i386/i386.exp 2005-03-01 08:54:40.000000000 +0100 +++ 2005-03-29/gas/testsuite/gas/i386/i386.exp 2005-03-30 11:05:52.381427528 +0200 @@ -118,6 +118,7 @@ if [expr ([istarget "i*86-*-*"] || [ista run_dump_test "x86_64" run_dump_test "x86-64-addr32" run_dump_test "x86-64-opcode" + run_dump_test "x86-64-pcrel" run_dump_test "x86-64-rip" run_list_test "x86-64-inval" "-al" --- /home/jbeulich/src/binutils/mainline/2005-03-29/gas/testsuite/gas/i386/x86-64-pcrel.d 1970-01-01 01:00:00.000000000 +0100 +++ 2005-03-29/gas/testsuite/gas/i386/x86-64-pcrel.d 2005-03-30 12:04:55.000000000 +0200 @@ -0,0 +1,13 @@ +#objdump: -drw +#name: x86-64 pcrel + +.*: +file format elf64-x86-64 + +Disassembly of section .text: + +0+000 <_start>: +[ ]*[0-9a-f]+:[ ]+b0 00[ ]+movb?[ ]+\$(0x)?0,%al[ ]*[0-9a-f]+:[ ]+R_X86_64_PC8[ ]+xtrn\+(0x)?1 +[ ]*[0-9a-f]+:[ ]+66 b8 00 00[ ]+movw?[ ]+\$(0x)?0,%ax[ ]*[0-9a-f]+:[ ]+R_X86_64_PC16[ ]+xtrn\+(0x)?2 +[ ]*[0-9a-f]+:[ ]+b8 00 00 00 00[ ]+movl?[ ]+\$(0x)?0,%eax[ ]*[0-9a-f]+:[ ]+R_X86_64_PC32[ ]+xtrn\+(0x)?1 +[ ]*[0-9a-f]+:[ ]+48 c7 c0 00 00 00 00[ ]+movq?[ ]+\$(0x)?0,%rax[ ]*[0-9a-f]+:[ ]+R_X86_64_PC32[ ]+xtrn\+(0x)?3 +#pass --- /home/jbeulich/src/binutils/mainline/2005-03-29/gas/testsuite/gas/i386/x86-64-pcrel.s 1970-01-01 01:00:00.000000000 +0100 +++ 2005-03-29/gas/testsuite/gas/i386/x86-64-pcrel.s 2005-03-30 11:54:29.000000000 +0200 @@ -0,0 +1,8 @@ + .text +_start: + movb $(xtrn - .), %al + movw $(xtrn - .), %ax + movl $(xtrn - .), %eax + movq $(xtrn - .), %rax + + .p2align 4,0