How to set file alignment for some special sections?

Ian Lance Taylor iant@google.com
Tue Apr 1 17:03:00 GMT 2008


"PRC" <panruochen@gmail.com> writes:

> How about those sections which won't be loaded into memory, like .shstrtab,
> the section for string table?
> I've try
>   . = ALIGN(4);
>   .shstrtab 0 :  { *(.shstrtab) }
> in my linker script, but the output binary isn't affected.

Thre is no way to align the .shstrtab section.  The .shstrtab section
is treated specially by the linker.

If there were a way, it would be to do this:

.shstrtab 0 : ALIGN(4) { *(.shstrtab) }

but I'm fairly sure that won't actually work.

Ian



More information about the Binutils mailing list