This should have no real effect in most cases, as e.g. `hidden`
visibility already implies `dso_local` (or at least LLVM IR does not
preserve the `dso_local` setting if the item is already `hidden`), but
it should fix `-Crelocation-model=static` and improve codegen in
executables.
Note that this PR does not exhaustively port the logic in [clang]. Only
the obviously correct portion and what is necessary to fix a regression
from LLVM 12 that relates to `-Crelocation_model=static`.
Fixes #83335
[clang]: 3001d080c8/clang/lib/CodeGen/CodeGenModule.cpp (L945-L1039)
13 lines
201 B
Rust
13 lines
201 B
Rust
#![crate_type="lib"]
|
|
|
|
#[repr(i8)]
|
|
pub enum Type {
|
|
Type1 = 0,
|
|
Type2 = 1
|
|
}
|
|
|
|
// CHECK: define{{( dso_local)?}} signext i8 @test()
|
|
#[no_mangle]
|
|
pub extern "C" fn test() -> Type {
|
|
Type::Type1
|
|
}
|