Closed
Description
The #[linkage]
feature has some code that generates a symbol, e.g. for foo
it generates extern_with_linkage_foo
.
We have some code that causes the compilation to fail if it can detect that the generated symbol is the source of a collision.
rust/src/librustc_codegen_llvm/consts.rs
Lines 130 to 147 in 4680580
But as far as I can tell, we have no tests of this feature.
While I was working on PR #61231, I tried to manufacture such a test, but it was not obvious to me how to actually set things up to make the scenario happen. I don't want to forget about the need for this test after I put that task aside, so I'm filing this issue.
Activity
pnkfelix commentedon May 27, 2019
Ah I think I just found a way to cause that code to fire.
pnkfelix commentedon May 27, 2019
For the record, here is how I did it (play):
pnkfelix commentedon May 27, 2019
Another quick note: this variant test case ("weird.rs") is causing non-deterministic memory corruption within my local build of
rustc
itself:(but I have not yet observed such memory corruption on the playpen itself.)
Click for gdb run of rustc with backtrace
(I'm not adding it as a test case since we don't currently have a policy of adding tests that are known to fail, especially not in this manner. But it might be good to get to the bottom of this.)
Update: The failure noted here may be an instance of long-standing (but improperly tracked) bugs with our implementation of
#[linkage]
. See also #29603 (comment) and #29603 (comment)Rollup merge of rust-lang#61231 - pnkfelix:issue-59548-linkage-diagno…
Rollup merge of rust-lang#61231 - pnkfelix:issue-59548-linkage-diagno…