-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Build crtbegin.o/crtend.o from source code #85395
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
Test with the code from #47551 : #![feature(backtrace)]
#[derive(Clone, Copy)]
struct Foo {
array: [u64; 10240],
}
impl Foo {
const fn new() -> Self {
Self {
array: [0x1122_3344_5566_7788; 10240]
}
}
}
static BAR: [Foo; 10240] = [Foo::new(); 10240];
fn main() {
let bt = std::backtrace::Backtrace::force_capture();
println!("Hello, world! {:?}", bt);
println!("{:x}", BAR[0].array[0]);
} The broken rustc that don't link to crtbeginS.o/crtendS.o:
rustc in this PR:
|
r? @nagisa or @petrochenkov perhaps? I don't know too much about our crtbegin self-contained objects story, and whether building them ourselves (vs. using the ones in system roots) makes sense. |
gcc's crtbegin.o/crtend.o is built when gcc bootstrap. Those target use And the current copy mechanism don't work well when using clang as C compiler. |
A working clang toolchain will still link these objects from somewhere, so they can be copied from the same place. |
They are the same file. rust/src/ci/docker/host-x86_64/dist-various-1/Dockerfile Lines 63 to 78 in 1969c2e
Clang don't provided a command line to get the location of compiler-rt. And compiler-rt is optional for clang. |
It does:
|
This is intrinsics, not crtbegin.o/crtend.o. The logic in clang is at A full clang installation should have |
The files must always exist somewhere, otherwise the C toolchain will be non-functional. My main question is what is simpler, less error-prone and requires less support - implementing the object search for all platforms on which |
@12101111 |
@bors r+ |
📌 Commit 5b44522ff115b8a2ac82217c6a69233988aae84e has been approved by |
⌛ Testing commit 5b44522ff115b8a2ac82217c6a69233988aae84e with merge 5168f9db7cf61a646190550e7fd0c1165898ca49... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@bors r+ |
📌 Commit 61c1155 has been approved by |
☀️ Test successful - checks-actions |
…ulacrum [beta] backports * Disable the machine outliner by default rust-lang#86020 * Fix incorrect gating of nonterminals in key-value attributes rust-lang#85445 * Build crtbegin.o/crtend.o from source code rust-lang#85395 * Bring back x86_64-sun-solaris target to rustup rust-lang#85252 * Preserve SyntaxContext for invalid/dummy spans in crate metadata rust-lang#85211 * [beta] backport: Remove unsound TrustedRandomAccess implementations rust-lang#86222 r? `@Mark-Simulacrum`
Build crtbengin.o/crtend.o from source code instead of copying from gcc.
The crtbegin and crtend implementation from llvm don't need
crtbeginS.o
for PIC.crtbegin{,S,T}.o
is unified into one genericcrtbegin.o
. See the comments in https://reviews.llvm.org/D28791#1419436 and https://reviews.llvm.org/D28791#1420914fix: #85310 , fix: #47551 , fix: #84033