[PATCH] Linker: Replace overridden subprograms
Duncan P. N. Exon Smith
dexonsmith at apple.com
Tue Dec 16 14:27:10 PST 2014
> On 2014-Dec-16, at 13:27, Rafael EspĂndola <rafael.espindola at gmail.com> wrote:
>
> + // Don't drop subprograms if the new module doesn't have debug info.
> + if (!SrcM->getNamedMetadata("llvm.dbg.cu"))
> + return;
>
> Why? It seems better for the linker to have a simpler logic: keep the
> matching debug info, even if it is empty. With the _odr variants it is
> probably not a big issue, but a weak function is allowed to replace a
> completely different linkonce function for example.
>
Hmm, I've been focussing on the `_odr` variants. I can remove this check.
> + for (unsigned I = 0, E = CompileUnits->getNumOperands(); I != E; ++I) {
>
> Can this be a range loop?
>
> + for (unsigned S = 0, SE = SPs.getNumElements(); S != SE; ++S) {
>
> and this one?
>
> The bigger question is the asymmetry. If a function in the source
> replaces one in the destination, this will drop the subprogram in the
> destination. If we decide not to copy a function from the source, we
> are still copying the subprogram, no?
It's asymmetrical (asymmetry happens all the time in linkers, right?), but
I'm not sure there's a good way to fix this without invasive changes to
`MapValue()`. I'd rather leave "solving this correctly" until we have a
custom class for subprograms (as mentioned in PR21910).
(I wouldn't even be trying to solve this yet if it weren't blocking
our Release+Asserts bootstrap.)
>
> Cheers,
> Rafael
More information about the llvm-commits
mailing list