Some extensions to the .section directive for ELF and COFF

Cary Coutant ccoutant@google.com
Thu Mar 26 22:14:00 GMT 2015


>> I'd prefer to extend the .section directive so you can give each
>> section both an "internal" (or "assembler") name, and an "external"
>> (or "linker") name. You can give each section a unique internal name
>> and switch back and forth at will, but they'll all get written to the
>> output file with the external name.
>
> This would more than double the amount of memory for strings that the
> assembler needs for this sort of thing. The general case for this is
> for compiler generated code and it should be able to do that without
> switching. Another option is to maybe have a numeric identifier after?
>
> , unique NUM
>
> to switch back? I'm not sure what the point of switching back is going
> to be in the general case (other than "hey, this might be useful").

I never said that the internal names had to be long. But in the GCC
case, we can take all the ".text.<function_name>" section names, put
an external name of ".text" on them, and be much better off in terms
of .o file size, without an appreciable difference in .s file size. It
would be icing on the cake to replace all those internal section names
with small numbers, to decrease the .s file size.

-cary



More information about the Binutils mailing list