Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
580bf28 to
3b34082
Compare
This comment has been minimized.
This comment has been minimized.
3b34082 to
479e3fa
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a5312a1 to
222159d
Compare
This comment has been minimized.
This comment has been minimized.
|
@antoyo @GuillaumeGomez does GCC have bugs around comparing pointers casted to integers? |
222159d to
44b1ad1
Compare
No, not that I know of. |
|
GCC devs at least historically had strange ideas about pointer equality, so I would not be surprised if they are doing optimizations that are incorrect for Rust. |
This comment has been minimized.
This comment has been minimized.
44b1ad1 to
250a379
Compare
This comment has been minimized.
This comment has been minimized.
250a379 to
e464681
Compare
|
Disabled the test with GCC for now. |
|
|
|
r? @wesleywiser rustbot has assigned @wesleywiser. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
e464681 to
58d3ca0
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The symbol name of the EII impl will now get changed to match the EII decl whenever there is no default impl. This already works across all backends and targets unlike the weak symbol aliases that we currently use. When there is a default impl, we will still use weak symbol aliases.
58d3ca0 to
39bb028
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
| codegen_fn_attrs.symbol_name = Some(Symbol::intern( | ||
| tcx.symbol_name(Instance::mono(tcx, foreign_item)).name, | ||
| )); |
There was a problem hiding this comment.
Was it intentional that the renamed symbol now inherits -Zdefault-visibility?
There was a problem hiding this comment.
EIIs are Rust-level, so with -Zdefault-visibility=hidden a dylib containing the impl no longer exports decl::foo and a downstream crate fails to link with undefined symbol: decl::foo. At the same time, the weak-alias path hardcoded Visibility::Default.
There was a problem hiding this comment.
While I feel the current changes are more logically intuitive, this does represent a change in behavior, doesn't it?
There was a problem hiding this comment.
-Zdefault-visibility=hidden breaks rust dylibs entirely, right?
Edit: Indeed:
$ echo '#[inline(never)] pub fn square(num: i32) -> i32 { num * num }' | rustc +nightly - --crate-type dylib -Cprefer-dynamic -Zdefault-visibility=hidden
$ echo 'fn main() { rust_out::square(1); }' | rustc +nightly - --extern rust_out=librust_out.so
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "/tmp/rustchEtbi4/symbols.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bdynamic" "/tmp/librust_out.so" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-20a66e70cfa492f6.so" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-*.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustchEtbi4/raw-dylibs" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "rust_out" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: rust-lld: error: undefined symbol: rust_out::square
>>> referenced by rust_out.8fb83714f74d418f-cgu.0
>>> rust_out.rust_out.8fb83714f74d418f-cgu.0.rcgu.o:(rust_out::main)
collect2: error: ld returned 1 exit status
error: aborting due to 1 previous errorThere was a problem hiding this comment.
Yes, not EII specifically.
The symbol name of the EII impl will now get changed to match the EII decl whenever there is no default impl. This already works across all backends and targets unlike the weak symbol aliases that we currently use. When there is a default impl, we will still use weak symbol aliases.
cc #125418