llvm-project/lld/wasm
Fangrui Song db5e078690 [LTO] Add SelectionKind to IRSymtab and use it in ld.lld/LLVMgold
In PGO, a C++ external linkage function `foo` has a private counter
`__profc_foo` and a private `__profd_foo` in a `comdat nodeduplicate`.

A `__attribute__((weak))` function `foo` has a weak hidden counter `__profc_foo`
and a private `__profd_foo` in a `comdat nodeduplicate`.

In `ld.lld a.o b.o`, say a.o defines an external linkage `foo` and b.o
defines a weak `foo`. Currently we treat `comdat nodeduplicate` as `comdat any`,
ld.lld will incorrectly consider `b.o:__profc_foo` non-prevailing.  In the worst
case when `b.o:__profd_foo` is retained and `b.o:__profc_foo` isn't, there will
be dangling reference causing an `undefined hidden symbol` error.

Add SelectionKind to `Comdat` in IRSymtab and let linkers ignore nodeduplicate comdat.

Differential Revision: https://reviews.llvm.org/D106228
2021-07-20 13:22:00 -07:00
..
CMakeLists.txt Reland: "[lld][WebAssembly] Initial support merging string data" 2021-05-10 16:03:38 -07:00
Config.h [lld][WebAssembly] Add new `--import-undefined` option 2021-06-17 11:44:21 -07:00
Driver.cpp [WebAssembly] Fixed LLD generation of 64-bit __wasm_apply_data_relocs 2021-07-15 10:02:02 -07:00
InputChunks.cpp [WebAssembly] Support R_WASM_MEMORY_ADDR_TLS_SLEB64 for wasm64 2021-07-19 10:22:43 -07:00
InputChunks.h [lld][WebAssembly] Enable string tail merging in debug sections 2021-05-18 12:25:39 -07:00
InputElement.h [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00
InputFiles.cpp [LTO] Add SelectionKind to IRSymtab and use it in ld.lld/LLVMgold 2021-07-20 13:22:00 -07:00
InputFiles.h [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00
LTO.cpp [LTO][wasm][NewPM] Allow using new pass manager for wasm LTO 2020-12-01 12:22:40 -08:00
LTO.h [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
MapFile.cpp [WebAssembly][lld] Fix segfault on .bss sections in mapfile 2021-07-07 23:31:48 -07:00
MapFile.h [lld][WebAssembly] Add initial support for -Map/--print-map 2020-09-12 16:10:51 -07:00
MarkLive.cpp [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00
MarkLive.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Options.td [lld][WebAssembly] Add new `--import-undefined` option 2021-06-17 11:44:21 -07:00
OutputSections.cpp [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00
OutputSections.h [lld][WebAssembly] Enable string tail merging in debug sections 2021-05-18 12:25:39 -07:00
OutputSegment.cpp [lld][WebAssembly] Enable string tail merging in debug sections 2021-05-18 12:25:39 -07:00
OutputSegment.h [lld][WebAssembly] Refactor input chunk class hierarchy. NFC 2021-05-17 21:01:17 -07:00
Relocations.cpp [lld][WebAssembly] Error on import of TLS symbols in shared libraries 2021-07-20 12:36:03 -07:00
Relocations.h [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
SymbolTable.cpp [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00
SymbolTable.h [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00
Symbols.cpp [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00
Symbols.h Reland "[lld][WebAssembly] Cleanup duplicate fields in Symbols.h. NFC" 2021-07-20 12:13:08 -07:00
SyntheticSections.cpp Reland "[lld][WebAssembly] Cleanup duplicate fields in Symbols.h. NFC" 2021-07-20 12:13:08 -07:00
SyntheticSections.h Revert D105519 "[WebAssembly] Deduplicate imports of the same module name, field name, and type" and its followup 2021-07-19 17:09:01 -07:00
Writer.cpp Reland "[lld][WebAssembly] Cleanup duplicate fields in Symbols.h. NFC" 2021-07-20 12:13:08 -07:00
Writer.h [WebAssembly] Refactor synthetic sections and relocation processing. NFC. 2019-05-21 09:13:09 +00:00
WriterUtils.cpp [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00
WriterUtils.h [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00