[lld] [llvm] RFC: [LLD] [COFF] Fix linking MSVC generated implib header objects (PR #122811)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 05:57:16 PST 2025


mstorsjo wrote:

> > Should we add a `DefinedRegular` subclass which ignores the offset? That's maybe the most efficient way around it, without needing to litter `DefinedRegular` with a condition in e.g. the `getRVA()` method. (Alternatively, `DefinedRegular` would need a flag about whether to ignore the Value offset or not.)
> 
> I guess instead of a flag, `DefinedRegular` could just store the offset itself, copy it from `coff_symbol_generic` in the constructor and use it internally instead. In this case, we could then just override it. A new symbol type works too.

Oh, that sounds like a good idea. That does increase the size of `DefinedRegular` by 4 bytes, and we're space conscious about it (see `static_assert(sizeof(SymbolUnion) <= 48, "symbols should be optimized for memory usage");` at the head of `Symbols.cpp`), but it seems like I can add such a field without affecting this, at least on x86_64 Linux, so perhaps that's a viable strategy after all?

https://github.com/llvm/llvm-project/pull/122811


More information about the llvm-commits mailing list