Skip to content

Commit d153f4f

Browse files
committed
Drop long-section-names linker workaround for windows-gnu
1 parent 98c173a commit d153f4f

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

src/librustc_target/spec/windows_base.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,6 @@ use std::default::Default;
44
pub fn opts() -> TargetOptions {
55
let mut pre_link_args = LinkArgs::new();
66
pre_link_args.insert(LinkerFlavor::Gcc, vec![
7-
// And here, we see obscure linker flags #45. On windows, it has been
8-
// found to be necessary to have this flag to compile liblibc.
9-
//
10-
// First a bit of background. On Windows, the file format is not ELF,
11-
// but COFF (at least according to LLVM). COFF doesn't officially allow
12-
// for section names over 8 characters, apparently. Our metadata
13-
// section, ".note.rustc", you'll note is over 8 characters.
14-
//
15-
// On more recent versions of gcc on mingw, apparently the section name
16-
// is *not* truncated, but rather stored elsewhere in a separate lookup
17-
// table. On older versions of gcc, they apparently always truncated th
18-
// section names (at least in some cases). Truncating the section name
19-
// actually creates "invalid" objects [1] [2], but only for some
20-
// introspection tools, not in terms of whether it can be loaded.
21-
//
22-
// Long story short, passing this flag forces the linker to *not*
23-
// truncate section names (so we can find the metadata section after
24-
// it's compiled). The real kicker is that rust compiled just fine on
25-
// windows for quite a long time *without* this flag, so I have no idea
26-
// why it suddenly started failing for liblibc. Regardless, we
27-
// definitely don't want section name truncation, so we're keeping this
28-
// flag for windows.
29-
//
30-
// [1] - https://sourceware.org/bugzilla/show_bug.cgi?id=13130
31-
// [2] - https://code.google.com/p/go/issues/detail?id=2139
32-
"-Wl,--enable-long-section-names".to_string(),
33-
347
// Tell GCC to avoid linker plugins, because we are not bundling
358
// them with Windows installer, and Rust does its own LTO anyways.
369
"-fno-use-linker-plugin".to_string(),

0 commit comments

Comments
 (0)