Structure Alignment

Daniel Jacobowitz drow@mvista.com
Fri Oct 11 11:47:00 GMT 2002


On Fri, Oct 11, 2002 at 11:44:48AM -0700, Sivaguru Sankaridurg wrote:
> Hi,
> 
> If I have a program that defines a structure ( say struct node { char c; int
> i; } ), is there any way that I can get the alignment information for this
> structure from objdump OR by using BFD api ?
> 
> Note:
> * I dont want to use alignof() builtin function, bcos all I have is the name
> of the structure as a char*. For example think that I am writing a function
> "int GetAlignment(char *typename)", that accepts the typename ("node" in
> this case) and returns the alignment required for the type (4 -- in this
> case).

Nope.  This information is generally not encoded in debug information
at all; you're out of luck.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



More information about the Binutils mailing list