asavonic wrote:

I'm not sure what is supposed to happen when we have duplicated symbols in LTO. 
`llvm-lto` gives `symbol 'bar' is already defined` error, so it is not 
supported.

`llvm-lto2` allows for "non-prevaling" symbols. For such symbols it injects 
`.lto_discard bar` to make AsmParser skip the corresponding label:
```
module asm ".lto_discard bar"
module asm ".text"
module asm ".balign 16"
module asm ".globl bar"          <--
module asm "bar:"                <-- these lines are ignored because of 
.lto_discard 
module asm "pacib     x30, x27"
module asm "retab"
module asm ".previous"
```

`global-asm-symbols` must stay consistent with the resulting assembly, so we 
must exclude discarded symbols. This can be done using `AppendUnique` module 
flag behavior, or by changing the flag in LTO.

I don't know how this is supposed to work for symvers though. If a symver is 
duplicated, it appears in `.lto_discard` like a regular symbol, but AsmParser 
cannot parse this syntax:
```
<inline asm>:1:22: unexpected token
.lto_discard bar, bar@VER
```
I'll run some more tests and figure out what we can do here.

https://github.com/llvm/llvm-project/pull/174995
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to