[PATCH] D96931: [LTO] Discard non-prevailing defined symbols in module-level assembly
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 8 16:32:48 PST 2021
pcc added a comment.
In D96931#2612552 <https://reviews.llvm.org/D96931#2612552>, @ychen wrote:
> In D96931#2612521 <https://reviews.llvm.org/D96931#2612521>, @pcc wrote:
>
>> This is just solving part of the problem, no? Imagine that you have a weak definition and a global definition in two object files. Then you will have the same problem.
>
> I would think the global one is chosen by the linker?
I thought that the problem was with full LTO where the module inline asm blobs are simply concatenated. So if you have one file with
.global foo
foo:
.byte 1
and another with
.weak foo
foo:
.byte 2
then the assembler will see both `foo` labels and complain about multiple definitions.
>> I think that some kind of marker that we can use to mark blocks of asm as conceptually coming from different object files would be best.
>
> Encoded into metadata: the `map<inlineasm string offset, vector<nonprevail symbols>>` Then in the MC layer, discard the non-prevail symbols.
I mean you would be able to say something like
.new_module
.global foo
foo:
.byte 1
.new_module
.weak foo
foo:
.byte 2
and that would be equivalent to
.global foo
foo:
.byte 1
.byte 2
Similarly if the second file did not provide a definition of `foo` the assembler would ignore the `.weak` directive.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96931/new/
https://reviews.llvm.org/D96931
More information about the llvm-commits
mailing list