asavonic wrote:

> How does your PR handle the case of multiple modules in LTO? How do the 
> module flags get merged?

`global-asm-symbols` and `global-asm-symvers` module flags are emitted with 
[`Append`](https://github.com/llvm/llvm-project/blob/6074f9b6246686e61e48d9e3aafc1c2069f93e5a/llvm/include/llvm/IR/Module.h#L141)
 behavior. When modules are linked, we have a joined list of symbols from both 
modules. Global inline assembly lines are concatenated.

Let's take `LTO/AArch64/global-inline-asm-flags.ll` test as an example:

- The first module defines symbols for `baz`, `baz@VER` and `foo@LINKEDVER`:
```
!0 = !{i32 5, !"global-asm-symbols", !1}
!1 = !{!2, !3, !4}
!2 = !{!"baz", i32 2050}
!3 = !{!"baz@VER", i32 2050}
!4 = !{!"foo@LINKEDVER", i32 2050}
```

- The second module from `Inputs/` directory defines `bar`, `bar@VER`, 
`foo@ANOTHERVER`, `foo`, `foo@VER`.
```
!1 = !{i32 5, !"global-asm-symbols", !2}
!2 = !{!3, !4, !5, !6, !7}
!3 = !{!"bar", i32 2050}
!4 = !{!"bar@VER", i32 2050}
!5 = !{!"foo@ANOTHERVER", i32 2050}
!6 = !{!"foo", i32 2050}
!7 = !{!"foo@VER", i32 2050}
```

- When these modules are linked, the resulting module contains all these 
symbols:
```
!0 = distinct !{i32 5, !"global-asm-symbols", !1}
!1 = distinct !{!2, !3, !4, !5, !6, !7, !8, !9}
!2 = !{!"baz", i32 2050}
!3 = !{!"baz@VER", i32 2050}
!4 = !{!"foo@LINKEDVER", i32 2050}
!5 = !{!"bar", i32 2050}
!6 = !{!"bar@VER", i32 2050}
!7 = !{!"foo@ANOTHERVER", i32 2050}
!8 = !{!"foo", i32 2050}
!9 = !{!"foo@VER", i32 2050}
```
Same happens for `global-asm-symvers`, but list elements are lists instead of 
pairs.

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