[lldb-dev] LLDB does not support the default 8 byte build ID generated by LLD
Pavel Labath via lldb-dev
lldb-dev at lists.llvm.org
Wed Jun 20 08:18:07 PDT 2018
Thanks for the heads up Scott. I was not aware that lld generates
build-ids with different length.
Padding would be one option (we already do that to handle the crc
pseudo-build-ids), but perhaps a better one would be to teach the
class how to handle arbitrary-sized UUIDs (or up to 20 bytes, at
I don't think there's a fundamental reason reason why only these two
lengths are acceptable. The class originally supported 16 bytes only,
because that's how mac UUIDs look like. Then, later, when we were
bringing up linux, we added 20-byte support because that's what the
gnu linkers generated. But, as it seems that this field can be of any
size, maybe it's time to teach UUID how to handle the new reality.
Have you looked at how hard would it be to implement something like that?
On Wed, 20 Jun 2018 at 16:05, Scott Funkenhauser via lldb-dev
<lldb-dev at lists.llvm.org> wrote:
> Hey guys,
> LLDB uses source/Utility/UUID.cpp to store the build ID. This class only supports 16 or 20 byte IDs.
> When parsing the .note.gnu.build-id ELF section, any build ID between 4 and 20 bytes will be parsed and saved (which will silently fail if the size isn't 16 or 20 bytes) https://github.com/llvm-mirror/lldb/blob/4dc18b8ce3f95c2aa33edc4c821909c329e94be9/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp#L1279 .
> I discovered this issue because by default LLD will generate a 8 byte build ID, causing LLDB to ignore the .note.gnu.build-id ELF section and compute a crc32 at runtime.
> Is this a know issue that somebody is already working on? (After a quick search I couldn't find any open bugs with a similar description).
> Does anybody have any objection to modifying UUID::SetBytes to accept any byte array with a size between 4 - 20 bytes, and pad with zeros to the next largest supported size (either 16 or 20 bytes).
> Setting a UUID with length of 8, would pad with 8 trailing zeros to have an overall length of 16.
> Setting a UUID with length of 17, would pad with 3 trailing zeros to have an overall length of 20.
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
More information about the lldb-dev