-
Couldn't load subscription status.
- Fork 13.9k
The war of symbol and symbol (the PR dedicated to duplicate symbols breaking rustc in unexpected ways) #23011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NB: before the move of this block from finish_register_fn we reported “compilation successful” error before we created the entry wrapper or actually translated contents of the entry function.
|
This seems like a fine refactoring to me, thanks @nagisa! I'm not trans hacker though so I'm not comfortable r+'ing |
4ac3765 to
e1f7a6b
Compare
|
Thanks for taking a look @alexcrichton! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the double negative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function has only been moved and renamed from base::get_fn_llvm_attributes only. The body has seen no changes (other than variable renames, of course).
Nicely spotted, nevertheless. I will go ahead and fix this.
|
☔ The latest upstream changes (presumably #23265) made this pull request unmergeable. Please resolve the merge conflicts. |
|
(i'm going to be out until wedneday; but I will try to get to this then. sorry for the absurd delay; maybe you can rebase in the meantime @nagisa ) |
07e593c to
caa5001
Compare
|
☔ The latest upstream changes (presumably #23337) made this pull request unmergeable. Please resolve the merge conflicts. |
caa5001 to
e935301
Compare
|
☔ The latest upstream changes (presumably #23376) made this pull request unmergeable. Please resolve the merge conflicts. |
e935301 to
46b0b82
Compare
|
Rebased. I didn’t even notice the last breakage until now, didn’t get github mail. |
|
☔ The latest upstream changes (presumably #23654) made this pull request unmergeable. Please resolve the merge conflicts. |
46b0b82 to
91e9f9d
Compare
|
Rebased. |
|
@nagisa my plan is to review this right after the beta-release, is that okay with you? |
|
Sure, been waiting for a month, can easily wait a few weeks more. I’ll have to rigorously review the patch for bitrot, though. |
|
@nagisa yeah, sorry about the delay... |
|
☔ The latest upstream changes (presumably #23936) made this pull request unmergeable. Please resolve the merge conflicts. |
It emits the same symbol – `transmute` – from the same crate twice.
This discovers another class of mis-trans where we wrap multiple native functions into a single wrapper, which is wrong.
This commit causes no change in trans semantics, it just moves some functions around and deduplicates them.
These functions have only a single use and functionally belong to foreign and glue respectively anyway
We provide tools to tell what exact symbols to emit for any fn or static, but
don’t quite check if that won’t cause any issues later on. Some of the issues
include LLVM mangling our names again and our names pointing to wrong locations,
us generating dumb foreign call wrappers, linker errors, extern functions
resolving to different symbols altogether (extern {fn fail();} fail(); in some
cases calling fail1()), etc.
Before the commit we had a function called note_unique_llvm_symbol, so it is
clear somebody was aware of the issue at some point, but the function was barely
used, mostly in irrelevant locations.
Along with working on it I took liberty to start refactoring trans/base into
a few smaller modules. The refactoring is incomplete and I hope I will find some
motivation to carry on with it.
This is possibly a [breaking-change] because it makes dumbly written code
properly invalid.
91e9f9d to
16881af
Compare
16881af to
000db38
Compare
|
@bors r+ |
|
📌 Commit 000db38 has been approved by |
We provide tools to tell what exact symbols to emit for any fn or static, but
don’t quite check if that won’t cause any issues later on. Some of the issues
include LLVM mangling our names again and our names pointing to wrong locations,
us generating dumb foreign call wrappers, linker errors, extern functions
resolving to different symbols altogether (`extern {fn fail();} fail();` in some
cases calling `fail1()`), etc.
Before the commit we had a function called `note_unique_llvm_symbol`, so it is
clear somebody was aware of the issue at some point, but the function was barely
used, mostly in irrelevant locations.
Along with working on it I took liberty to start refactoring trans/base into
a few smaller modules. The refactoring is incomplete and I hope I will find some
motivation to carry on with it.
This is possibly a [breaking-change] because it makes dumbly written code
properly invalid.
This fixes all those issues about incorrect use of #[no_mangle] being not reported/misreported/ICEd by the compiler.
NB. This PR does not attempt to tackle the parallel codegen issue that was mentioned in #22811, but I believe it should be very straightforward in a follow up PR by modifying `trans::declare::get_defined_value` to look at all the contexts.
cc @alexcrichton @huonw @nrc because you commented on the original RFC issue.
EDIT: wow, this became much bigger than I initially intended.
We provide tools to tell what exact symbols to emit for any fn or static, but
don’t quite check if that won’t cause any issues later on. Some of the issues
include LLVM mangling our names again and our names pointing to wrong locations,
us generating dumb foreign call wrappers, linker errors, extern functions
resolving to different symbols altogether (
extern {fn fail();} fail();in somecases calling
fail1()), etc.Before the commit we had a function called
note_unique_llvm_symbol, so it isclear somebody was aware of the issue at some point, but the function was barely
used, mostly in irrelevant locations.
Along with working on it I took liberty to start refactoring trans/base into
a few smaller modules. The refactoring is incomplete and I hope I will find some
motivation to carry on with it.
This is possibly a [breaking-change] because it makes dumbly written code
properly invalid.
This fixes all those issues about incorrect use of #[no_mangle] being not reported/misreported/ICEd by the compiler.
NB. This PR does not attempt to tackle the parallel codegen issue that was mentioned in #22811, but I believe it should be very straightforward in a follow up PR by modifying
trans::declare::get_defined_valueto look at all the contexts.cc @alexcrichton @huonw @nrc because you commented on the original RFC issue.
EDIT: wow, this became much bigger than I initially intended.