[LLVMdev] [lld] Handling non SHF_ALLOC sections.

Michael Spencer bigcheesegs at gmail.com
Mon Sep 16 17:23:57 PDT 2013

Debug info linking is currently broken due to how we handle reading and
laying out non SHF_ALLOC sections. I posted a patch that partially fixes
this, but it's both the wrong approach and doesn't handle multiple input
files with debug info (wrong relocation values).

The first issue is representing non SHF_ALLOC atoms in the Atom model. We
currently don't have a type for this, and DefinedAtom.cpp makes assumptions
about the permissions of an Atom based on their type, so it's hard to use
an existing type.

The next problem is in the ELF writer. It currently cannot handle
AtomSections that are not in a segment as file offsets and addresses are
never set. This means that assignOffsets is not called, and that the atoms
within are never added to the _atomToAddressMap. However, we can't just add
them to that map with their virtual address, as they don't have a virtual
address. We need to use the symbol value, which is the offset into the
section. My current hack to fix this is to call
assignVirtualAddresses(-fileoffset) and then explicitly added them to the

Any ideas for the proper fix here?

- Michael Spencer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130916/956a47ec/attachment.html>

More information about the llvm-dev mailing list