This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Calling equ'd symbols in GAS
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