Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRustc produces bad binaries on Fedora 14, Centos 6.6, 32 bit #27543
Comments
This comment has been minimized.
This comment has been minimized.
|
I believe this is the same issue encountered in https://users.rust-lang.org/t/illegal-instruction-when-i-run-main-rs/2199 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Non-working was linked with gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) / GNU ld version 2.20.51.0.7-8.fc14 20100318 |
This comment has been minimized.
This comment has been minimized.
|
Notably the left side(.init_array/.fini_array) is working one and right side (.ctors/.dtors) is non-working. |
This comment has been minimized.
This comment has been minimized.
|
http://mcpherrin.ca/tmp/badrust.bin Here is a sample bad binary, which is "fn main() println!("Hello, World!")" compiled on Centos 6.6 32 bit in Virtualbox, with a Rust 1.2 stable candidate. |
brson
added
I-nominated
T-libs
labels
Aug 6, 2015
This comment has been minimized.
This comment has been minimized.
|
A debug, non-optimised binary: http://mcpherrin.ca/tmp/badrust-dbg.bin EDIT: my investigation so far shows that jemalloc is able to setup thread local storage for its own use just fine, which suggests the issue is on our side. |
This comment has been minimized.
This comment has been minimized.
|
Here's a similar sample, but with debug symbols |
This comment has been minimized.
This comment has been minimized.
|
These initialiser sections, apparently, are completely irrelevant; we initialise all our thread locals lazily on first use (and initialisers are stored in Over 1.5 days of debugging I managed to observe symptoms mostly indicative of invalid memory reads (e.g. SIGSEGVs after null pointer deref inside |
This comment has been minimized.
This comment has been minimized.
|
@nagisa could you detail a bit more how you reproduced this?
This may just be a case where we need to not use ELF-based TLS on older systems, but detecting that will not be easy unfortunately. |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton I was using Fedora 14; since the package repositories are not working anymore, I didn’t bother updating anything, that includes the ld or ld-linux.so.2. In cases #27598 wasn’t hit, I could reliably reproduce the same issue and backtrace as reported in the internals thread. I did try using ld.gold ( Interestingly, the stage1 rustc compiler built on the same fedora machine works just fine. Hand-crafted snippets of code that do not use std implementation of thread locals also seem to work fine and correctly. So it is most likely either something we do in start_lang implementation before setting thread info or the std implementation of TLS is wrong. |
This comment has been minimized.
This comment has been minimized.
|
Oh it looks like I've actually already investigated this exact same bug before. As discovered in #20440 we depend on binutils 2.22 for an apparent bugfix with TLS, so I'm going to close this as basically a linker bug we can't do much about |
mcpherrinm commentedAug 5, 2015
I think it's because of the TLS setup not working properly
Here's a (sorry, screenshot) of vimdiff of readelf of a working and non-working binary https://i.imgur.com/zfdDYss.png -- Both compiled with the same rustc binary, but different host OSes.
I believe this is related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770