Linking FreeBSD with lld: -dc option missing

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 10:13:15 PST 2016


On 16 November 2016 at 17:05, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
>
> And it doesn't know how to hide common symbols, so it depends on they
> being pre allocated to .bss.

Correct, although I looked into it in more detail after my mail and it
seems crunchide does not actually change a symbol's binding or
visibility, but merely "hides" it by prefixing it with "_$$hide$$
<filename.o> ". Now I think I should just fix crunchide to apply the
same change to STT_COMMON symbols.

Looking through the old threads I see that I commented on one small
benefit of -dc in the past: there's a TODO for the crunch system to
overlap the .bss of each of the individual components, and this
requires symbols to be allocated rather than common. However, this now
seems like a somewhat pointless optimization, and if any user really
wants it the future then they can use -fno-common.

> So, right now if a foo.o is in both /bin/sh and the rescue system you
> only compile it once? I would assume that the one in the rescue system
> was a special minimal version. If the size is not an issue, why do you
> "concatenate" multiple program into one? Why not just have static
> versions of sh, ls, etc?

Much of this is just historical; the crunch system was originally
introduced for boot/install floppies. It can still be convenient to
have a single, statically linked binary that includes multiple tools
though, for example if you can transfer it somehow to a broken system.


More information about the llvm-commits mailing list