Common sections

Richard Henderson
Mon Jun 7 21:53:00 GMT 2010

On 06/06/2010 01:56 PM, fearyourself wrote:
> However, if I declare in the elf_backend_section_flags hook that this
> section is also a SEC_IS_COMMON, then I get the right addressing.

You don't ever want to set SEC_IS_COMMON in the assembler.  If you 
want COMMON symbols, then you should define only COMMON symbols and
let the linker construct the COMMON section.

If you want to define a "big common section", look at how the x86_64-elf
port handles its symbols defined with ".largecomm".

Although even more likely you don't want COMMON symbols at all, and
should simply be doing

	.section .largebss,"aw",@nobits
	.type x,@object
	.size x,4000000
x:	.zero 4000000

and then have your linker script place .largebss after .bss.


More information about the Binutils mailing list