This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: BFD, alignment of common symbols
- To: Nick Clifton <nickc at redhat dot com>
- Subject: Re: BFD, alignment of common symbols
- From: Mikulas Patocka <mikulas at artax dot karlin dot mff dot cuni dot cz>
- Date: Sun, 11 Feb 2001 12:27:00 +0100 (CET)
- cc: binutils at sources dot redhat dot com
> Hi Mikulas,
>
> : If the symbol is in common section, asymbol->section == &bfd_com_section,
> : asymbol->value contains the size of a symbol and ... where is the
> : alignment?
>
> First of all, this is only supported for ELF targets. Other file
> formats do not support alignment of common symbols.
>
> For ELF, the size of the symbol is placed in the 'size' field and the
> alignment is placed in the 'value' field. Take a look at
> elf_slurp_symbol_table() in bfd/elfcode.h for an example of this.
Yes, I see. I also looked at bfd_elf_print_symbol - it prints symbol
including an alignment.
The function gets asymbol *symbol and prints
((elf_symbol_type *) symbol)->internal_elf_sym.st_value
as the alignment. Sadly elf_symbol_type is private type not exported in
bfd.h, so there's no way to get it outside bfd library :-(
An ultimate solution - create pipe, use bfd_elf_print_symbol to print the
symbol to pipe, read the pipe and parse numbers :-)
Mikulas