* Calling equ'd symbols in GAS
@ 2011-07-29 3:21 Eduardo Cavazos
2011-07-29 3:49 ` Alan Modra
0 siblings, 1 reply; 14+ messages in thread
From: Eduardo Cavazos @ 2011-07-29 3:21 UTC (permalink / raw)
To: binutils
Hello,
Here's a small NASM program:
[BITS 64]
[ORG 0x0000000000200000]
b_print_newline equ 0x0000000000100040
start:
call b_print_newline
ret
Assemble it:
$ nasm -f bin pr-nl-a.asm -o pr-nl-a.app
Disassemble it:
$ objdump -D -b binary -m i386:x86-64 pr-nl-a.app
pr-nl-a.app: file format binary
Disassembly of section .data:
0000000000000000 <.data>:
0: e8 3b 00 f0 ff callq 0xfffffffffff00040
5: c3 retq
Here's a GAS version:
.set b_print_newline , 0x0000000000100040
.text
.global _start
_start:
call b_print_newline
ret
Assemble and link it:
$ as -o pr-nl-b.o pr-nl-b.s
$ ld -Ttext 200000 --oformat binary -o pr-nl-b.app pr-nl-b.o
Disassemble it:
$ objdump -D -b binary -m i386:x86-64 pr-nl-b.app
pr-nl-b.app: file format binary
Disassembly of section .data:
0000000000000000 <.data>:
0: ff 14 25 40 00 10 00 callq *0x100040
7: c3 retq
As you can see, the disassembled code differs slightly. The code for
`call` in NASM:
0: e8 3b 00 f0 ff callq 0xfffffffffff00040
vs GAS:
0: ff 14 25 40 00 10 00 callq *0x100040
Any suggestions for how to implement the GAS version properly?
Also, here's the program in FASM:
b_print_newline equ 0x0000000000100040
use64
org 0x0000000000200000
start: call b_print_newline
ret
It does the right thing:
$ objdump -D -b binary -m i386:x86-64 pr-nl-c.app
pr-nl-c.app: file format binary
Disassembly of section .data:
0000000000000000 <.data>:
0: e8 3b 00 f0 ff callq 0xfffffffffff00040
5: c3 retq
Ed
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
2011-07-29 3:21 Calling equ'd symbols in GAS Eduardo Cavazos
@ 2011-07-29 3:49 ` Alan Modra
2011-07-29 6:11 ` Eduardo Cavazos
0 siblings, 1 reply; 14+ messages in thread
From: Alan Modra @ 2011-07-29 3:49 UTC (permalink / raw)
To: Eduardo Cavazos; +Cc: binutils
On Thu, Jul 28, 2011 at 07:58:08PM -0500, Eduardo Cavazos wrote:
> Any suggestions for how to implement the GAS version properly?
Already fixed.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
2011-07-29 3:49 ` Alan Modra
@ 2011-07-29 6:11 ` Eduardo Cavazos
2011-07-29 6:32 ` Alan Modra
0 siblings, 1 reply; 14+ messages in thread
From: Eduardo Cavazos @ 2011-07-29 6:11 UTC (permalink / raw)
To: binutils
> On Thu, Jul 28, 2011 at 07:58:08PM -0500, Eduardo Cavazos wrote:
> > Any suggestions for how to implement the GAS version properly?
On Fri, 2011-07-29 at 12:41 +0930, Alan Modra wrote:
> Already fixed.
I tried with as from binutils version 2.21.1; it didn't seem to fix the
problem.
Is the fix only available in the latest cvs version? I also tried that
but make errors out:
make[2]: Entering directory `/home/dharmatech/src/binutils-cvs/binutils'
gcc -g -O2 -o sysinfo sysinfo.o syslex.o
syslex.o: In function `main':
/home/dharmatech/src/binutils-cvs/binutils/syslex.c:1: multiple
definition of `main'
sysinfo.o:/home/dharmatech/src/binutils-cvs/binutils/sysinfo.c:1: first
defined here
collect2: ld returned 1 exit status
make[2]: *** [sysinfo] Error 1
make[2]: Leaving directory `/home/dharmatech/src/binutils-cvs/binutils'
make[1]: *** [all-binutils] Error 2
make[1]: Leaving directory `/home/dharmatech/src/binutils-cvs'
make: *** [all] Error 2
This in on Ubuntu 10.10 64-bit.
Ed
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
2011-07-29 6:11 ` Eduardo Cavazos
@ 2011-07-29 6:32 ` Alan Modra
2011-07-29 6:50 ` Eduardo Cavazos
0 siblings, 1 reply; 14+ messages in thread
From: Alan Modra @ 2011-07-29 6:32 UTC (permalink / raw)
To: Eduardo Cavazos; +Cc: binutils
On Thu, Jul 28, 2011 at 10:49:14PM -0500, Eduardo Cavazos wrote:
>
> > On Thu, Jul 28, 2011 at 07:58:08PM -0500, Eduardo Cavazos wrote:
>
> > > Any suggestions for how to implement the GAS version properly?
>
> On Fri, 2011-07-29 at 12:41 +0930, Alan Modra wrote:
>
> > Already fixed.
>
> I tried with as from binutils version 2.21.1; it didn't seem to fix the
> problem.
Well, here's my 2.21.1 results
$ cat > equcall.s <<\EOF
.set b_print_newline , 0x0000000000100040
.text
.global _start
_start:
call b_print_newline
ret
EOF
$ gas/as-new -o equcall.o equcall.s
$ ld/ld-new -o equcall equcall.o
$ objdump -d equcall
equcall: file format elf32-i386
Disassembly of section .text:
08048054 <_start>:
8048054: e8 e7 7f 0b f8 call 100040 <b_print_newline>
8048059: c3 ret
$
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
2011-07-29 6:32 ` Alan Modra
@ 2011-07-29 6:50 ` Eduardo Cavazos
2011-07-29 7:35 ` Alan Modra
0 siblings, 1 reply; 14+ messages in thread
From: Eduardo Cavazos @ 2011-07-29 6:50 UTC (permalink / raw)
To: binutils
On Fri, 2011-07-29 at 15:30 +0930, Alan Modra wrote:
> 8048054: e8 e7 7f 0b f8 call 100040 <b_print_newline>
Right. Notice the difference from the NASM and FASM disassemblies:
0: e8 3b 00 f0 ff callq 0xfffffffffff00040:
I'm just wondering how to port the NASM example to GAS.
Ed
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
2011-07-29 6:50 ` Eduardo Cavazos
@ 2011-07-29 7:35 ` Alan Modra
2011-07-29 7:46 ` Eduardo Cavazos
0 siblings, 1 reply; 14+ messages in thread
From: Alan Modra @ 2011-07-29 7:35 UTC (permalink / raw)
To: Eduardo Cavazos; +Cc: binutils
On Fri, Jul 29, 2011 at 01:10:59AM -0500, Eduardo Cavazos wrote:
>
> On Fri, 2011-07-29 at 15:30 +0930, Alan Modra wrote:
>
> > 8048054: e8 e7 7f 0b f8 call 100040 <b_print_newline>
>
> Right. Notice the difference from the NASM and FASM disassemblies:
>
> 0: e8 3b 00 f0 ff callq 0xfffffffffff00040:
>
> I'm just wondering how to port the NASM example to GAS.
The only difference in the above is the address that the files are
linked at. So..
$ ld/ld-new -Ttext=0x200000 -o equcall equcall.o
$ objdump -d equcall
equcall: file format elf32-i386
Disassembly of section .text:
00200000 <_start>:
200000: e8 3b 00 f0 ff call 100040 <b_print_newline>
200005: c3 ret
$
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
2011-07-29 7:35 ` Alan Modra
@ 2011-07-29 7:46 ` Eduardo Cavazos
2011-07-29 9:26 ` Alan Modra
0 siblings, 1 reply; 14+ messages in thread
From: Eduardo Cavazos @ 2011-07-29 7:46 UTC (permalink / raw)
To: binutils
On Fri, 2011-07-29 at 16:02 +0930, Alan Modra wrote:
> The only difference in the above is the address that the files are
> linked at. So..
>
> $ ld/ld-new -Ttext=0x200000 -o equcall equcall.o
> $ objdump -d equcall
>
> equcall: file format elf32-i386
>
>
> Disassembly of section .text:
>
> 00200000 <_start>:
> 200000: e8 3b 00 f0 ff call 100040 <b_print_newline>
> 200005: c3 ret
> $
Aha, I see that you're getting the right code on your system. For some
reason, it's still not right on mine:
/tmp $ ~/opt/binutils-2.21.1/bin/as --version
GNU assembler (GNU Binutils) 2.21.1
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms
of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of
`x86_64-unknown-linux-gnu'.
/tmp $ ~/opt/binutils-2.21.1/bin/ld --version
GNU ld (GNU Binutils) 2.21.1
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms
of
the GNU General Public License version 3 or (at your option) a later
version.
This program has absolutely no warranty.
/tmp $ cat equcall.s
.set b_print_newline , 0x0000000000100040
.text
.global _start
_start:
call b_print_newline
ret
/tmp $ ~/opt/binutils-2.21.1/bin/as -o equcall.o equcall.s
equcall.s: Assembler messages:
equcall.s:10: Warning: indirect call without `*'
/tmp $ ~/opt/binutils-2.21.1/bin/ld -Ttext 200000 --oformat binary -o
equcall.app equcall.o
/tmp $ objdump -D -b binary -m i386:x86-64 equcall.app
equcall.app: file format binary
Disassembly of section .data:
0000000000000000 <.data>:
0: ff 14 25 40 00 10 00 callq *0x100040
7: c3 retq
Ed
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
2011-07-29 7:46 ` Eduardo Cavazos
@ 2011-07-29 9:26 ` Alan Modra
2011-07-29 11:03 ` Eduardo Cavazos
0 siblings, 1 reply; 14+ messages in thread
From: Alan Modra @ 2011-07-29 9:26 UTC (permalink / raw)
To: Eduardo Cavazos; +Cc: binutils
On Fri, Jul 29, 2011 at 01:50:13AM -0500, Eduardo Cavazos wrote:
> This assembler was configured for a target of
> `x86_64-unknown-linux-gnu'.
This is the difference between our assemblers. Mine is configured for
i686 by default. Try assembling with --32 added to the command line.
If you really do want x86_64 output then I can't help you; I've haven't
maintained x86 gas for a long time now.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
2011-07-29 9:26 ` Alan Modra
@ 2011-07-29 11:03 ` Eduardo Cavazos
2011-07-29 14:57 ` H.J. Lu
0 siblings, 1 reply; 14+ messages in thread
From: Eduardo Cavazos @ 2011-07-29 11:03 UTC (permalink / raw)
To: binutils
On Fri, 2011-07-29 at 17:16 +0930, Alan Modra wrote:
> If you really do want x86_64 output then I can't help you
I definately need x86-64. Thanks for the help troubleshooting it anyway.
Ed
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
2011-07-29 11:03 ` Eduardo Cavazos
@ 2011-07-29 14:57 ` H.J. Lu
[not found] ` <1312156228.3441.284.camel@dharmatech-ThinkPad-T61>
0 siblings, 1 reply; 14+ messages in thread
From: H.J. Lu @ 2011-07-29 14:57 UTC (permalink / raw)
To: Eduardo Cavazos; +Cc: binutils
On Fri, Jul 29, 2011 at 1:00 AM, Eduardo Cavazos <wayo.cavazos@gmail.com> wrote:
> On Fri, 2011-07-29 at 17:16 +0930, Alan Modra wrote:
>
>> If you really do want x86_64 output then I can't help you
>
> I definately need x86-64. Thanks for the help troubleshooting it anyway.
>
Please open a bug report with detailed info. I will take a look.
--
H.J.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
[not found] ` <1312156228.3441.284.camel@dharmatech-ThinkPad-T61>
@ 2011-08-01 19:29 ` H.J. Lu
2011-08-01 21:42 ` Eduardo Cavazos
2011-08-05 4:14 ` Alan Modra
0 siblings, 2 replies; 14+ messages in thread
From: H.J. Lu @ 2011-08-01 19:29 UTC (permalink / raw)
To: Eduardo Cavazos; +Cc: binutils
[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]
On Sun, Jul 31, 2011 at 4:50 PM, Eduardo Cavazos <wayo.cavazos@gmail.com> wrote:
> On Fri, 2011-07-29 at 06:34 -0700, H.J. Lu wrote:
>
>> Please open a bug report with detailed info. I will take a look.
>
> I filed a bug report mentioning the issue as discussed here on the list:
>
> http://sourceware.org/bugzilla/show_bug.cgi?id=13046
>
> I'm being asked not to mention NASM in the bug report for some reason.
> Unfortunately, that's the only way to really describe what I'm trying to
> accomplish. Currently, programs for BareMetal OS:
>
> http://www.returninfinity.com/baremetal.html
>
> are written in NASM. I'd like to explore using GNU Assembler for
> BareMetal apps as well.
>
The problem is direct call doesn't work in 64bit. I checked in this
patch.
Thanks.
--
H.J.
----
as/testsuite/
2011-08-01 H.J. Lu <hongjiu.lu@intel.com>
PR gas/13046
* gas/i386/x86-64-branch.s: Add tests for direct branch.
* gas/i386/x86-64-branch.d: Updated.
* gas/i386/ilp32/x86-64-branch.d: Likewise.
opcodes/
2011-08-01 H.J. Lu <hongjiu.lu@intel.com>
PR gas/13046
* i386-opc.tbl: Add Disp32S to 64bit call.
* i386-tbl.h: Regenerated.
[-- Attachment #2: gas-pr13046-1.patch --]
[-- Type: text/x-diff, Size: 5202 bytes --]
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index eb5ce65..063f899 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/13046
+ * gas/i386/x86-64-branch.s: Add tests for direct branch.
+ * gas/i386/x86-64-branch.d: Updated.
+ * gas/i386/ilp32/x86-64-branch.d: Likewise.
+
2011-07-29 Nick Clifton <nickc@redhat.com>
* gas/elf/warn-2.s: Add other types of NOP insn.
diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-branch.d b/gas/testsuite/gas/i386/ilp32/x86-64-branch.d
index cb33840..9118db1 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-branch.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-branch.d
@@ -18,6 +18,8 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 ff e0 jmpw \*%ax
[ ]*[a-f0-9]+: 66 ff e0 jmpw \*%ax
[ ]*[a-f0-9]+: 66 ff 20 jmpw \*\(%rax\)
+[ ]*[a-f0-9]+: e8 00 00 00 00 callq 0x1f 1b: R_X86_64_PC32 \*ABS\*\+0x10003c
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 0x24 20: R_X86_64_PC32 \*ABS\*\+0x10003c
[ ]*[a-f0-9]+: ff d0 callq \*%rax
[ ]*[a-f0-9]+: ff d0 callq \*%rax
[ ]*[a-f0-9]+: 66 ff d0 callw \*%ax
@@ -28,4 +30,6 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 ff e0 jmpw \*%ax
[ ]*[a-f0-9]+: 66 ff e0 jmpw \*%ax
[ ]*[a-f0-9]+: 66 ff 20 jmpw \*\(%rax\)
+[ ]*[a-f0-9]+: e8 00 00 00 00 callq 0x43 3f: R_X86_64_PC32 \*ABS\*\+0x10003c
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 0x48 44: R_X86_64_PC32 \*ABS\*\+0x10003c
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-branch.d b/gas/testsuite/gas/i386/x86-64-branch.d
index cc3d3a9..428ce5b 100644
--- a/gas/testsuite/gas/i386/x86-64-branch.d
+++ b/gas/testsuite/gas/i386/x86-64-branch.d
@@ -17,6 +17,8 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 ff e0 jmpw \*%ax
[ ]*[a-f0-9]+: 66 ff e0 jmpw \*%ax
[ ]*[a-f0-9]+: 66 ff 20 jmpw \*\(%rax\)
+[ ]*[a-f0-9]+: e8 00 00 00 00 callq 0x1f 1b: R_X86_64_PC32 \*ABS\*\+0x10003c
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 0x24 20: R_X86_64_PC32 \*ABS\*\+0x10003c
[ ]*[a-f0-9]+: ff d0 callq \*%rax
[ ]*[a-f0-9]+: ff d0 callq \*%rax
[ ]*[a-f0-9]+: 66 ff d0 callw \*%ax
@@ -27,4 +29,6 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 ff e0 jmpw \*%ax
[ ]*[a-f0-9]+: 66 ff e0 jmpw \*%ax
[ ]*[a-f0-9]+: 66 ff 20 jmpw \*\(%rax\)
+[ ]*[a-f0-9]+: e8 00 00 00 00 callq 0x43 3f: R_X86_64_PC32 \*ABS\*\+0x10003c
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 0x48 44: R_X86_64_PC32 \*ABS\*\+0x10003c
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-branch.s b/gas/testsuite/gas/i386/x86-64-branch.s
index 10fdd81..4c1861f 100644
--- a/gas/testsuite/gas/i386/x86-64-branch.s
+++ b/gas/testsuite/gas/i386/x86-64-branch.s
@@ -9,6 +9,8 @@
jmp *%ax
jmpw *%ax
jmpw *(%rax)
+ call 0x100040
+ jmp 0x100040
.intel_syntax noprefix
call rax
@@ -21,3 +23,5 @@
jmp ax
jmpw ax
jmpw [rax]
+ call 0x100040
+ jmp 0x100040
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 9b5494e..4e39050 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/13046
+ * i386-opc.tbl: Add Disp32S to 64bit call.
+ * i386-tbl.h: Regenerated.
+
2011-07-24 Chao-ying Fu <fu@mips.com>
Maciej W. Rozycki <macro@codesourcery.com>
diff --git a/opcodes/i386-opc.tbl b/opcodes/i386-opc.tbl
index 4c29ab7..eb7dae9 100644
--- a/opcodes/i386-opc.tbl
+++ b/opcodes/i386-opc.tbl
@@ -320,7 +320,7 @@ shrd, 2, 0xfad, None, 2, Cpu386, Modrm|CheckRegSize|No_bSuf|No_sSuf|No_ldSuf, {
// Control transfer instructions.
call, 1, 0xe8, None, 1, CpuNo64, JumpDword|DefaultSize|No_bSuf|No_sSuf|No_qSuf|No_ldSuf, { Disp16|Disp32 }
-call, 1, 0xe8, None, 1, Cpu64, JumpDword|DefaultSize|No_bSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Disp16|Disp32 }
+call, 1, 0xe8, None, 1, Cpu64, JumpDword|DefaultSize|No_bSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Disp16|Disp32|Disp32S }
call, 1, 0xff, 0x2, 1, CpuNo64, Modrm|DefaultSize|No_bSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg16|Reg32|Word|Dword|Unspecified|BaseIndex|Disp8|Disp16|Disp32|JumpAbsolute }
call, 1, 0xff, 0x2, 1, Cpu64, Modrm|DefaultSize|No_bSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Reg16|Reg64|Word|Qword|Unspecified|BaseIndex|Disp8|Disp32|Disp32S|JumpAbsolute }
// Intel Syntax
diff --git a/opcodes/i386-tbl.h b/opcodes/i386-tbl.h
index f133b80..795f71d 100644
--- a/opcodes/i386-tbl.h
+++ b/opcodes/i386-tbl.h
@@ -2558,7 +2558,7 @@ const insn_template i386_optab[] =
1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0 } } } },
{ "call", 1, 0xff, 0x2, 1,
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
2011-08-01 19:29 ` H.J. Lu
@ 2011-08-01 21:42 ` Eduardo Cavazos
2011-08-05 4:14 ` Alan Modra
1 sibling, 0 replies; 14+ messages in thread
From: Eduardo Cavazos @ 2011-08-01 21:42 UTC (permalink / raw)
To: binutils
On Mon, 2011-08-01 at 12:29 -0700, H.J. Lu wrote:
> The problem is direct call doesn't work in 64bit. I checked in this
> patch.
Thanks H.J. Using the latest from cvs, I was able to assemble a working
app for BareMetal OS.
Ed
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
2011-08-01 19:29 ` H.J. Lu
2011-08-01 21:42 ` Eduardo Cavazos
@ 2011-08-05 4:14 ` Alan Modra
2011-08-05 14:13 ` H.J. Lu
1 sibling, 1 reply; 14+ messages in thread
From: Alan Modra @ 2011-08-05 4:14 UTC (permalink / raw)
To: H.J. Lu; +Cc: binutils
On Mon, Aug 01, 2011 at 12:29:17PM -0700, H.J. Lu wrote:
> * gas/i386/x86-64-branch.s: Add tests for direct branch.
> * gas/i386/x86-64-branch.d: Updated.
> * gas/i386/ilp32/x86-64-branch.d: Likewise.
Needs tweaking. eg. on x86_64-mingw32, I see
regexp_diff match failure
regexp "^[ ]*[a-f0-9]+: e8 00 00 00 00 callq 0x1f 1b: R_X86_64_PC32 \*ABS\*\+0x10003c$"
line " 1a: e8 5b 00 10 00 callq 10007a <.text+0x10007a> 1b: R_X86_64_PC32 *ABS*"
regexp_diff match failure
regexp "^[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 0x24 20: R_X86_64_PC32 \*ABS\*\+0x10003c$"
line " 1f: e9 60 00 10 00 jmpq 100084 <.text+0x100084> 20: R_X86_64_PC32 *ABS*"
regexp_diff match failure
regexp "^[ ]*[a-f0-9]+: e8 00 00 00 00 callq 0x43 3f: R_X86_64_PC32 \*ABS\*\+0x10003c$"
line " 3e: e8 7f 00 10 00 callq 1000c2 <.text+0x1000c2> 3f: R_X86_64_PC32 *ABS*"
regexp_diff match failure
regexp "^[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 0x48 44: R_X86_64_PC32 \*ABS\*\+0x10003c$"
line " 43: e9 84 00 10 00 jmpq 1000cc <.text+0x1000cc> 44: R_X86_64_PC32 *ABS*"
FAIL: x86-64 indirect branch
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Calling equ'd symbols in GAS
2011-08-05 4:14 ` Alan Modra
@ 2011-08-05 14:13 ` H.J. Lu
0 siblings, 0 replies; 14+ messages in thread
From: H.J. Lu @ 2011-08-05 14:13 UTC (permalink / raw)
To: Binutils
On Thu, Aug 4, 2011 at 9:14 PM, Alan Modra <amodra@gmail.com> wrote:
> On Mon, Aug 01, 2011 at 12:29:17PM -0700, H.J. Lu wrote:
>> * gas/i386/x86-64-branch.s: Add tests for direct branch.
>> * gas/i386/x86-64-branch.d: Updated.
>> * gas/i386/ilp32/x86-64-branch.d: Likewise.
>
> Needs tweaking. eg. on x86_64-mingw32, I see
>
> regexp_diff match failure
> regexp "^[ ]*[a-f0-9]+: e8 00 00 00 00 callq 0x1f 1b: R_X86_64_PC32 \*ABS\*\+0x10003c$"
> line " 1a: e8 5b 00 10 00 callq 10007a <.text+0x10007a> 1b: R_X86_64_PC32 *ABS*"
> regexp_diff match failure
> regexp "^[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 0x24 20: R_X86_64_PC32 \*ABS\*\+0x10003c$"
> line " 1f: e9 60 00 10 00 jmpq 100084 <.text+0x100084> 20: R_X86_64_PC32 *ABS*"
> regexp_diff match failure
> regexp "^[ ]*[a-f0-9]+: e8 00 00 00 00 callq 0x43 3f: R_X86_64_PC32 \*ABS\*\+0x10003c$"
> line " 3e: e8 7f 00 10 00 callq 1000c2 <.text+0x1000c2> 3f: R_X86_64_PC32 *ABS*"
> regexp_diff match failure
> regexp "^[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 0x48 44: R_X86_64_PC32 \*ABS\*\+0x10003c$"
> line " 43: e9 84 00 10 00 jmpq 1000cc <.text+0x1000cc> 44: R_X86_64_PC32 *ABS*"
> FAIL: x86-64 indirect branch
>
I checked in this.
Thanks.
--
H.J.
-
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index c6c0579..5154d36 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gas/i386/x86-64-branch.d: Pass -dw to objdump and support
+ win64.
+
2011-08-04 H.J. Lu <hongjiu.lu@intel.com>
* gas/elf/bad-group.d: New.
diff --git a/gas/testsuite/gas/i386/x86-64-branch.d b/gas/testsuite/gas/i386/x86
-64-branch.d
index 428ce5b..fee2099 100644
--- a/gas/testsuite/gas/i386/x86-64-branch.d
+++ b/gas/testsuite/gas/i386/x86-64-branch.d
@@ -1,5 +1,5 @@
#as: -J
-#objdump: -drw
+#objdump: -dw
#name: x86-64 indirect branch
.*: +file format .*
@@ -17,8 +17,8 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 ff e0 jmpw \*%ax
[ ]*[a-f0-9]+: 66 ff e0 jmpw \*%ax
[ ]*[a-f0-9]+: 66 ff 20 jmpw \*\(%rax\)
-[ ]*[a-f0-9]+: e8 00 00 00 00 callq 0x1f 1b: R_X86_64_PC3
2 \*ABS\*\+0x10003c
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 0x24 20: R_X86_64_PC3
2 \*ABS\*\+0x10003c
+[ ]*[a-f0-9]+: e8 (00|5b) 00 (00|10) 00 callq (0x1f|10007a <.te
xt\+0x10007a>)
+[ ]*[a-f0-9]+: e9 (00|60) 00 (00|10) 00 jmpq (0x24|100084 <.te
xt\+0x100084>)
[ ]*[a-f0-9]+: ff d0 callq \*%rax
[ ]*[a-f0-9]+: ff d0 callq \*%rax
[ ]*[a-f0-9]+: 66 ff d0 callw \*%ax
@@ -29,6 +29,6 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 ff e0 jmpw \*%ax
[ ]*[a-f0-9]+: 66 ff e0 jmpw \*%ax
[ ]*[a-f0-9]+: 66 ff 20 jmpw \*\(%rax\)
-[ ]*[a-f0-9]+: e8 00 00 00 00 callq 0x43 3f: R_X86_64_PC3
2 \*ABS\*\+0x10003c
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 0x48 44: R_X86_64_PC3
2 \*ABS\*\+0x10003c
+[ ]*[a-f0-9]+: e8 (00|7f) 00 (00|10) 00 callq (0x43|1000c2 <.te
xt\+0x1000c2>)
+[ ]*[a-f0-9]+: e9 (00|84) 00 (00|10) 00 jmpq (0x48|1000cc <.te
xt\+0x1000cc>)
#pass
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2011-08-05 14:13 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-29 3:21 Calling equ'd symbols in GAS Eduardo Cavazos
2011-07-29 3:49 ` Alan Modra
2011-07-29 6:11 ` Eduardo Cavazos
2011-07-29 6:32 ` Alan Modra
2011-07-29 6:50 ` Eduardo Cavazos
2011-07-29 7:35 ` Alan Modra
2011-07-29 7:46 ` Eduardo Cavazos
2011-07-29 9:26 ` Alan Modra
2011-07-29 11:03 ` Eduardo Cavazos
2011-07-29 14:57 ` H.J. Lu
[not found] ` <1312156228.3441.284.camel@dharmatech-ThinkPad-T61>
2011-08-01 19:29 ` H.J. Lu
2011-08-01 21:42 ` Eduardo Cavazos
2011-08-05 4:14 ` Alan Modra
2011-08-05 14:13 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).