[PATCH] D30419: [ELF] - Define __bss_start symbol.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 2 02:31:23 PST 2017
>>> + // __bss_start should point to the first .bss.* output section.
>>> + for (OutputSection *OS : OutputSections) {
>>> + bool IsBSS = (In<ELFT>::Common && In<ELFT>::Common->OutSec == OS) ||
>>> + OS == Out::Bss || OS == Out::BssRelRo;
>>
>>You can just check if the type is NOBITS, no?
>
>I do not think I can. That would catch .tbss first.
> __bss_start is not documented, so I am refering to BFD imlementation,
>it default script places __bss_start before all .bss and .tbss is listed explicitly before:
>
> .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
>.....
> . = .;
> __bss_start = .;
> .bss :
> {
> *(.dynbss)
> *(.bss .bss.* .gnu.linkonce.b.*)
> *(COMMON)
> /* Align here to ensure that the .bss section occupies space up to
> _end. Align after .bss to ensure correct alignment even if the
> .bss section disappears because there are no input sections.
> FIXME: Why do we need it? When there is no .bss section, we don't
> pad the .data section. */
> . = ALIGN(. != 0 ? 64 / 8 : 1);
> }
>
>.So to have the same behavior, I think I should do what I do.
So is it ok for commit with original check ?
>>> + bool IsBSS = (In<ELFT>::Common && In<ELFT>::Common->OutSec == OS) ||
>>> + OS == Out::Bss || OS == Out::BssRelRo;
George.
More information about the llvm-commits
mailing list