[llvm-dev] Linking the FreeBSD base system with lld -- status update
Rafael EspĂndola via llvm-dev
llvm-dev at lists.llvm.org
Mon Mar 7 18:54:09 PST 2016
>>> 5. -dc option
>>>
>>> -dc assigns space to common symbols when producing relocatable output
>>> (-r). It is used by the /rescue build, which is a single binary
>>> assembled from a collection of individual tools (sh, ls, fsck, ...)
>>
>>
>> Why does it need -dc option?
>
> The "crunchide" tool used in building the rescue binary segfaults when
> operating on an object with common symbols, and a comment in the
> source claims:
>
> This program relies on the use of the linker's -dc flag to actually
> put global bss data into the file's bss segment (rather than leaving
> it as undefined "common" data).
>
> but that still does not explain why it's necessary. I believe it could
> be modified to avoid the requirement for now.
>
> However, there is a todo item in the source: arrange that all the BSS
> segments start at the same address, so that the final crunched binary
> BSS size is the max of all the component programs' BSS sizes, rather
> than their sum. It seems this would require -dc along with some linker
> script magic.
What are the input .o files? If you are compiling just for this you
should be able to use -fno-common.
Cheers,
Rafael
More information about the llvm-dev
mailing list