llvm-project/llvm/test/tools/gold/X86
Fangrui Song 584cb67d2d [IRSymTab] Set FB_used on llvm.compiler.used symbols
IR symbol table does not parse inline asm. A symbol only referenced by inline
asm is not in the IR symbol table, so LTO does not know that the definition (in
another translation unit) is referenced and may internalize it, even if that
definition has `__attribute__((used))` (which lowers to `llvm.compiler.used` on
ELF targets since D97446).

```
// cabac.c
__attribute__((used)) const uint8_t ff_h264_cabac_tables[...] = {...};

// h264_cabac.c
  asm("lea ff_h264_cabac_tables(%rip), %0" : ...);
```

`__attribute__((used))` is the recommended way to tell the compiler there may
be inline asm references, so the usage is perfectly fine. This patch
conservatively sets the `FB_used` bit on `llvm.compiler.used` symbols to work
around the IR symbol table limitation. Note: before D97446, Clang never emitted
symbols in the `llvm.compiler.used` list, so this change does not punish any
Clang emitted global object.

Without the patch, `ff_h264_cabac_tables` may be assigned to a non-external
partition and get internalized. Then we will get a linker error because the
`cabac.c` definition is not exposed.

Differential Revision: https://reviews.llvm.org/D97755
2021-03-03 16:22:30 -08:00
..
Inputs [gold] Match lld WPD behavior for shared library symbols and add test 2021-02-17 15:28:49 -08:00
v1.12 [test] Make ELF tests less reliant on the lexicographical order of non-local symbols 2021-02-13 01:01:06 -08:00
v1.16 [LTO] Move part of gold devirt test to v1.16 directory 2021-02-01 09:53:11 -08:00
alias.ll
alias2.ll
asm_undefined.ll
asm_undefined2.ll
available-externally.ll
bad-alias.ll
bcsection.ll
cache.ll [LLVMgold.so][test] Fix tests after D84132/55fa315b0352 2020-07-21 10:18:32 -07:00
coff.ll
comdat.ll
comdat2.ll
common.ll
common_thinlto.ll
ctors.ll
ctors2.ll
devirt_vcall_vis_export_dynamic.ll [gold] Add case being tested by equivalent lld test 2021-02-13 17:09:56 -08:00
devirt_vcall_vis_public.ll [LTO] Prevent devirtualization for symbols dynamically exported 2021-01-27 15:54:13 -08:00
devirt_vcall_vis_shared_def.ll [gold] Match lld WPD behavior for shared library symbols and add test 2021-02-17 15:28:49 -08:00
disable-verify.ll LLVMgold.so: Fix tests after D95380 2021-02-04 21:14:36 -08:00
drop-debug.ll
drop-linkage.ll
emit-asm.ll
emit-llvm.ll [IRSymTab] Set FB_used on llvm.compiler.used symbols 2021-03-03 16:22:30 -08:00
error-unopenable.ll
global_with_section.ll
invalid.ll
irmover-error.ll
linker-script.ll
linkonce-weak.ll
linkonce_odr_unnamed_addr.ll
lit.local.cfg
mixed_lto.ll
module_asm.ll
multiple-data.s
multiple-sections.ll Add test utility 'split-file' 2020-08-03 20:42:09 -07:00
new-pm.ll Rename -plugin-opt=no-new-pass-manager to -plugin-opt=legacy-pass-manager 2020-12-09 16:43:30 -08:00
no-map-whole-file.ll
opt-level.ll LLVMgold.so: Fix tests after D95380 2021-02-04 21:14:36 -08:00
opt-remarks.ll LLVMgold.so: Fix tests after D95380 2021-02-04 21:14:36 -08:00
parallel.ll [DCE] Don't remove non-willreturn calls 2021-02-19 12:35:40 +01:00
pr19901.ll
pr19901_thinlto.ll
pr25907.ll
pr25915.ll
relax-relocs.ll [LLVMgold.so][test] Fix tests after D84132/55fa315b0352 2020-07-21 10:18:32 -07:00
relocatable.ll
relocation-model-pic.ll [test] Split some tests which test both static and pic relocation models 2020-12-04 19:03:40 -08:00
relocation-model-static.ll [test] Add explicit dso_local to constant/global variable declarations 2020-12-04 13:51:01 -08:00
remarks.ll
resolve-to-alias.ll
slp-vectorize-pm.ll
slp-vectorize.ll LLVMgold.so: Fix tests after D95380 2021-02-04 21:14:36 -08:00
split-dwarf.ll
start-lib-common.ll
stats-file-option.ll
stats.ll
strip_names.ll
thinlto-emit-llvm.ll [ThinLTO][gold] Fix filenaming scheme for tasks. 2021-02-12 09:40:08 -08:00
thinlto.ll [ThinLTO] Add Visibility bits to GlobalValueSummary::GVFlags 2021-01-27 10:43:51 -08:00
thinlto_afdo.ll
thinlto_alias.ll
thinlto_archive.ll
thinlto_cspgo.ll
thinlto_emit_imports.ll
thinlto_emit_linked_objects.ll
thinlto_funcimport.ll
thinlto_internalize.ll
thinlto_linkonceresolution.ll
thinlto_no_objects.ll
thinlto_object_suffix_replace.ll
thinlto_prefix_replace.ll
thinlto_weak_library.ll
thinlto_weak_resolution.ll
type-merge.ll
type-merge2.ll
unnamed-addr.ll
vectorize.ll LLVMgold.so: Fix tests after D95380 2021-02-04 21:14:36 -08:00
visibility.ll
weak.ll