This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: Strip the ISA bit when printing symbol offsets
- From: Daniel Jacobowitz <drow at false dot org>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 14 Nov 2009 10:46:26 -0500
- Subject: Re: RFC: Strip the ISA bit when printing symbol offsets
- References: <20091113212716.GA28795@caradoc.them.org> <834ooxo3sd.fsf@gnu.org>
On Sat, Nov 14, 2009 at 11:26:42AM +0200, Eli Zaretskii wrote:
> Isn't it true that an address of a function should always be aligned,
> so that its LSB is always zero? If so, I don't think we need to pass
> the architecture pointer to build_address_symbolic, we could just
> always reset the LSB. WDYT?
No, that's not true. On a typical RISC architecture instructions are
more than one byte and require alignment, but on x86_64:
drow@caradoc:~% cat f.c
int a()
{
return 0;
}
int b()
{
return 2;
}
drow@caradoc:~% gcc -Os -c f.c
drow@caradoc:~% objdump -dr f.o
f.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <a>:
0: 31 c0 xor %eax,%eax
2: c3 retq
0000000000000003 <b>:
3: b8 02 00 00 00 mov $0x2,%eax
8: c3 retq
--
Daniel Jacobowitz
CodeSourcery