Skip to content

Commit 8319ef5

Browse files
committed
Auto merge of #50709 - alexcrichton:revert-musl, r=sfackler
Revert #50105 until regression is fixed Discovered at #50105 (comment) it looks like this caused a regression with i686 musl, so let's revert in the meantime while a fix is worked out
2 parents c6a1979 + acc874f commit 8319ef5

File tree

11 files changed

+15
-163
lines changed

11 files changed

+15
-163
lines changed

Diff for: src/bootstrap/bin/rustc.rs

-9
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,6 @@ fn main() {
268268
if let Ok(host_linker) = env::var("RUSTC_HOST_LINKER") {
269269
cmd.arg(format!("-Clinker={}", host_linker));
270270
}
271-
272-
if let Ok(s) = env::var("RUSTC_HOST_CRT_STATIC") {
273-
if s == "true" {
274-
cmd.arg("-C").arg("target-feature=+crt-static");
275-
}
276-
if s == "false" {
277-
cmd.arg("-C").arg("target-feature=-crt-static");
278-
}
279-
}
280271
}
281272

282273
if env::var_os("RUSTC_PARALLEL_QUERIES").is_some() {

Diff for: src/bootstrap/bootstrap.py

+3-30
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ def bin_root(self):
489489
"""
490490
return os.path.join(self.build_dir, self.build, "stage0")
491491

492-
def get_toml(self, key, section=None):
492+
def get_toml(self, key):
493493
"""Returns the value of the given key in config.toml, otherwise returns None
494494
495495
>>> rb = RustBuild()
@@ -501,29 +501,12 @@ def get_toml(self, key, section=None):
501501
502502
>>> rb.get_toml("key3") is None
503503
True
504-
505-
Optionally also matches the section the key appears in
506-
507-
>>> rb.config_toml = '[a]\\nkey = "value1"\\n[b]\\nkey = "value2"'
508-
>>> rb.get_toml('key', 'a')
509-
'value1'
510-
>>> rb.get_toml('key', 'b')
511-
'value2'
512-
>>> rb.get_toml('key', 'c') is None
513-
True
514504
"""
515-
516-
cur_section = None
517505
for line in self.config_toml.splitlines():
518-
section_match = re.match(r'^\s*\[(.*)\]\s*$', line)
519-
if section_match is not None:
520-
cur_section = section_match.group(1)
521-
522506
match = re.match(r'^{}\s*=(.*)$'.format(key), line)
523507
if match is not None:
524508
value = match.group(1)
525-
if section is None or section == cur_section:
526-
return self.get_string(value) or value.strip()
509+
return self.get_string(value) or value.strip()
527510
return None
528511

529512
def cargo(self):
@@ -606,17 +589,7 @@ def build_bootstrap(self):
606589
env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
607590
(os.pathsep + env["LIBRARY_PATH"]) \
608591
if "LIBRARY_PATH" in env else ""
609-
env["RUSTFLAGS"] = "-Cdebuginfo=2 "
610-
611-
build_section = "target.{}".format(self.build_triple())
612-
target_features = []
613-
if self.get_toml("crt-static", build_section) == "true":
614-
target_features += ["+crt-static"]
615-
elif self.get_toml("crt-static", build_section) == "false":
616-
target_features += ["-crt-static"]
617-
if target_features:
618-
env["RUSTFLAGS"] += "-C target-feature=" + (",".join(target_features)) + " "
619-
592+
env["RUSTFLAGS"] = "-Cdebuginfo=2"
620593
env["PATH"] = os.path.join(self.bin_root(), "bin") + \
621594
os.pathsep + env["PATH"]
622595
if not os.path.isfile(self.cargo()):

Diff for: src/bootstrap/builder.rs

-4
Original file line numberDiff line numberDiff line change
@@ -697,10 +697,6 @@ impl<'a> Builder<'a> {
697697
cargo.env("RUSTC_CRT_STATIC", x.to_string());
698698
}
699699

700-
if let Some(x) = self.crt_static(compiler.host) {
701-
cargo.env("RUSTC_HOST_CRT_STATIC", x.to_string());
702-
}
703-
704700
// Enable usage of unstable features
705701
cargo.env("RUSTC_BOOTSTRAP", "1");
706702
self.add_rust_test_threads(&mut cargo);

Diff for: src/librustc_codegen_llvm/back/link.rs

-27
Original file line numberDiff line numberDiff line change
@@ -625,11 +625,6 @@ fn link_natively(sess: &Session,
625625
if let Some(args) = sess.target.target.options.pre_link_args.get(&flavor) {
626626
cmd.args(args);
627627
}
628-
if let Some(args) = sess.target.target.options.pre_link_args_crt.get(&flavor) {
629-
if sess.crt_static() {
630-
cmd.args(args);
631-
}
632-
}
633628
if let Some(ref args) = sess.opts.debugging_opts.pre_link_args {
634629
cmd.args(args);
635630
}
@@ -644,18 +639,6 @@ fn link_natively(sess: &Session,
644639
cmd.arg(root.join(obj));
645640
}
646641

647-
if crate_type == config::CrateTypeExecutable && sess.crt_static() {
648-
for obj in &sess.target.target.options.pre_link_objects_exe_crt {
649-
cmd.arg(root.join(obj));
650-
}
651-
652-
for obj in &sess.target.target.options.pre_link_objects_exe_crt_sys {
653-
if flavor == LinkerFlavor::Gcc {
654-
cmd.arg(format!("-l:{}", obj));
655-
}
656-
}
657-
}
658-
659642
if sess.target.target.options.is_like_emscripten {
660643
cmd.arg("-s");
661644
cmd.arg(if sess.panic_strategy() == PanicStrategy::Abort {
@@ -677,16 +660,6 @@ fn link_natively(sess: &Session,
677660
for obj in &sess.target.target.options.post_link_objects {
678661
cmd.arg(root.join(obj));
679662
}
680-
if sess.crt_static() {
681-
for obj in &sess.target.target.options.post_link_objects_crt_sys {
682-
if flavor == LinkerFlavor::Gcc {
683-
cmd.arg(format!("-l:{}", obj));
684-
}
685-
}
686-
for obj in &sess.target.target.options.post_link_objects_crt {
687-
cmd.arg(root.join(obj));
688-
}
689-
}
690663
if let Some(args) = sess.target.target.options.post_link_args.get(&flavor) {
691664
cmd.args(args);
692665
}

Diff for: src/librustc_target/spec/linux_musl_base.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ pub fn opts() -> TargetOptions {
1515

1616
// Make sure that the linker/gcc really don't pull in anything, including
1717
// default objects, libs, etc.
18-
base.pre_link_args_crt.insert(LinkerFlavor::Gcc, Vec::new());
19-
base.pre_link_args_crt.get_mut(&LinkerFlavor::Gcc).unwrap().push("-nostdlib".to_string());
18+
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-nostdlib".to_string());
2019

2120
// At least when this was tested, the linker would not add the
2221
// `GNU_EH_FRAME` program header to executables generated, which is required
@@ -56,11 +55,9 @@ pub fn opts() -> TargetOptions {
5655
//
5756
// Each target directory for musl has these object files included in it so
5857
// they'll be included from there.
59-
base.pre_link_objects_exe_crt.push("crt1.o".to_string());
60-
base.pre_link_objects_exe_crt.push("crti.o".to_string());
61-
base.pre_link_objects_exe_crt_sys.push("crtbegin.o".to_string());
62-
base.post_link_objects_crt_sys.push("crtend.o".to_string());
63-
base.post_link_objects_crt.push("crtn.o".to_string());
58+
base.pre_link_objects_exe.push("crt1.o".to_string());
59+
base.pre_link_objects_exe.push("crti.o".to_string());
60+
base.post_link_objects.push("crtn.o".to_string());
6461

6562
// These targets statically link libc by default
6663
base.crt_static_default = true;

Diff for: src/librustc_target/spec/mod.rs

+7-28
Original file line numberDiff line numberDiff line change
@@ -422,26 +422,20 @@ pub struct TargetOptions {
422422
/// Linker to invoke
423423
pub linker: Option<String>,
424424

425-
/// Linker arguments that are passed *before* any user-defined libraries.
426-
pub pre_link_args: LinkArgs, // ... unconditionally
427-
pub pre_link_args_crt: LinkArgs, // ... when linking with a bundled crt
428-
/// Objects to link before all others, all except *_sys found within the
425+
/// Linker arguments that are unconditionally passed *before* any
426+
/// user-defined libraries.
427+
pub pre_link_args: LinkArgs,
428+
/// Objects to link before all others, always found within the
429429
/// sysroot folder.
430-
pub pre_link_objects_exe: Vec<String>, // ... when linking an executable, unconditionally
431-
pub pre_link_objects_exe_crt: Vec<String>, // ... when linking an executable with a bundled crt
432-
pub pre_link_objects_exe_crt_sys: Vec<String>, // ... when linking an executable with a bundled
433-
// crt, from the system library search path
430+
pub pre_link_objects_exe: Vec<String>, // ... when linking an executable
434431
pub pre_link_objects_dll: Vec<String>, // ... when linking a dylib
435432
/// Linker arguments that are unconditionally passed after any
436433
/// user-defined but before post_link_objects. Standard platform
437434
/// libraries that should be always be linked to, usually go here.
438435
pub late_link_args: LinkArgs,
439-
/// Objects to link after all others, all except *_sys found within the
436+
/// Objects to link after all others, always found within the
440437
/// sysroot folder.
441-
pub post_link_objects: Vec<String>, // ... unconditionally
442-
pub post_link_objects_crt: Vec<String>, // ... when linking with a bundled crt
443-
pub post_link_objects_crt_sys: Vec<String>, // ... when linking with a bundled crt, from the
444-
// system library search path
438+
pub post_link_objects: Vec<String>,
445439
/// Linker arguments that are unconditionally passed *after* any
446440
/// user-defined libraries.
447441
pub post_link_args: LinkArgs,
@@ -641,7 +635,6 @@ impl Default for TargetOptions {
641635
is_builtin: false,
642636
linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.to_string()),
643637
pre_link_args: LinkArgs::new(),
644-
pre_link_args_crt: LinkArgs::new(),
645638
post_link_args: LinkArgs::new(),
646639
asm_args: Vec::new(),
647640
cpu: "generic".to_string(),
@@ -675,12 +668,8 @@ impl Default for TargetOptions {
675668
position_independent_executables: false,
676669
relro_level: RelroLevel::None,
677670
pre_link_objects_exe: Vec::new(),
678-
pre_link_objects_exe_crt: Vec::new(),
679-
pre_link_objects_exe_crt_sys: Vec::new(),
680671
pre_link_objects_dll: Vec::new(),
681672
post_link_objects: Vec::new(),
682-
post_link_objects_crt: Vec::new(),
683-
post_link_objects_crt_sys: Vec::new(),
684673
late_link_args: LinkArgs::new(),
685674
link_env: Vec::new(),
686675
archive_format: "gnu".to_string(),
@@ -899,15 +888,10 @@ impl Target {
899888
key!(is_builtin, bool);
900889
key!(linker, optional);
901890
key!(pre_link_args, link_args);
902-
key!(pre_link_args_crt, link_args);
903891
key!(pre_link_objects_exe, list);
904-
key!(pre_link_objects_exe_crt, list);
905-
key!(pre_link_objects_exe_crt_sys, list);
906892
key!(pre_link_objects_dll, list);
907893
key!(late_link_args, link_args);
908894
key!(post_link_objects, list);
909-
key!(post_link_objects_crt, list);
910-
key!(post_link_objects_crt_sys, list);
911895
key!(post_link_args, link_args);
912896
key!(link_env, env);
913897
key!(asm_args, list);
@@ -1109,15 +1093,10 @@ impl ToJson for Target {
11091093
target_option_val!(is_builtin);
11101094
target_option_val!(linker);
11111095
target_option_val!(link_args - pre_link_args);
1112-
target_option_val!(link_args - pre_link_args_crt);
11131096
target_option_val!(pre_link_objects_exe);
1114-
target_option_val!(pre_link_objects_exe_crt);
1115-
target_option_val!(pre_link_objects_exe_crt_sys);
11161097
target_option_val!(pre_link_objects_dll);
11171098
target_option_val!(link_args - late_link_args);
11181099
target_option_val!(post_link_objects);
1119-
target_option_val!(post_link_objects_crt);
1120-
target_option_val!(post_link_objects_crt_sys);
11211100
target_option_val!(link_args - post_link_args);
11221101
target_option_val!(env - link_env);
11231102
target_option_val!(asm_args);

Diff for: src/test/run-make-fulldeps/issue-36710/Makefile

-12
This file was deleted.

Diff for: src/test/run-make-fulldeps/issue-36710/foo.cpp

-25
This file was deleted.

Diff for: src/test/run-make-fulldeps/issue-36710/foo.rs

-18
This file was deleted.

Diff for: src/test/run-make-fulldeps/tools.mk

-2
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,12 @@ endif
5959

6060
ifdef IS_MSVC
6161
COMPILE_OBJ = $(CC) -c -Fo:`cygpath -w $(1)` $(2)
62-
COMPILE_OBJ_CXX = $(CXX) -c -Fo:`cygpath -w $(1)` $(2)
6362
NATIVE_STATICLIB_FILE = $(1).lib
6463
NATIVE_STATICLIB = $(TMPDIR)/$(call NATIVE_STATICLIB_FILE,$(1))
6564
OUT_EXE=-Fe:`cygpath -w $(TMPDIR)/$(call BIN,$(1))` \
6665
-Fo:`cygpath -w $(TMPDIR)/$(1).obj`
6766
else
6867
COMPILE_OBJ = $(CC) -c -o $(1) $(2)
69-
COMPILE_OBJ_CXX = $(CXX) -c -o $(1) $(2)
7068
NATIVE_STATICLIB_FILE = lib$(1).a
7169
NATIVE_STATICLIB = $(call STATICLIB,$(1))
7270
OUT_EXE=-o $(TMPDIR)/$(1)

Diff for: src/tools/compiletest/src/runtest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2502,7 +2502,7 @@ impl<'test> TestCx<'test> {
25022502
.env("IS_WINDOWS", "1")
25032503
.env("MSVC_LIB", format!("'{}' -nologo", lib.display()))
25042504
.env("CC", format!("'{}' {}", self.config.cc, cflags))
2505-
.env("CXX", format!("'{}'", &self.config.cxx));
2505+
.env("CXX", &self.config.cxx);
25062506
} else {
25072507
cmd.env("CC", format!("{} {}", self.config.cc, self.config.cflags))
25082508
.env("CXX", format!("{} {}", self.config.cxx, self.config.cflags))

0 commit comments

Comments
 (0)