This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Strip the ISA bit when printing symbol offsets


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]