Skip to content
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

A number of tests fails with undefined references to `rust_eh_unwind_resume` when codegen-units > 1 #43095

Closed
petrochenkov opened this Issue Jul 6, 2017 · 5 comments

Comments

Projects
None yet
3 participants
@petrochenkov
Copy link
Contributor

petrochenkov commented Jul 6, 2017

#42899 looks like a likely reason
cc @alexcrichton @japaric

Affected run-pass tests (there are also failing tests in other groups):

    [run-pass] run-pass\debuginfo-lto.rs
    [run-pass] run-pass\panic-runtime\lto-abort.rs
    [run-pass] run-pass\panic-runtime\lto-unwind.rs
    [run-pass] run-pass\sepcomp-lib-lto.rs

Failures look like this:

---- [run-pass] run-pass\sepcomp-lib-lto.rs stdout ----

error: compilation failed!
status: exit code: 101
command: PATH="blahblahblah" C:\msys64\home\we\rust\build\build\x86_64-pc-windows-gnu\stage2\bin\rustc.exe C:/msys64/home/we/rust\src/test\run-pass\sepcomp-lib-lto.rs -L C:\msys64\home\we\rust\build\build\x86_64-pc-windows-gnu\test\run-pass --target=x86_64-pc-windows-gnu -L C:\msys64\home\we\rust\build\build\x86_64-pc-windows-gnu\test\run-pass\sepcomp-lib-lto.stage2-x86_64-pc-windows-gnu.run-pass.libaux -o C:\msys64\home\we\rust\build\build\x86_64-pc-windows-gnu\test\run-pass\sepcomp-lib-lto.stage2-x86_64-pc-windows-gnu.exe -Crpath -O -Lnative=C:\msys64\home\we\rust\build\build\x86_64-pc-windows-gnu\native\rust-test-helpers -C lto -g
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
error: linking with `gcc` failed: exit code: 1
  |
  = note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\\msys64\\home\\we\\rust\\build\\build\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "C:\\msys64\\home\\we\\rust\\build\\build\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\msys64\\home\\we\\rust\\build\\build\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "C:\\msys64\\home\\we\\rust\\build\\build\\x86_64-pc-windows-gnu\\test\\run-pass\\sepcomp-lib-lto.0.o" "-o" "C:\\msys64\\home\\we\\rust\\build\\build\\x86_64-pc-windows-gnu\\test\\run-pass\\sepcomp-lib-lto.stage2-x86_64-pc-windows-gnu.exe" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:\\msys64\\home\\we\\rust\\build\\build\\x86_64-pc-windows-gnu\\test\\run-pass" "-L" "C:\\msys64\\home\\we\\rust\\build\\build\\x86_64-pc-windows-gnu\\test\\run-pass\\sepcomp-lib-lto.stage2-x86_64-pc-windows-gnu.run-pass.libaux" "-L" "C:\\msys64\\home\\we\\rust\\build\\build\\x86_64-pc-windows-gnu\\native\\rust-test-helpers" "-L" "C:\\msys64\\home\\we\\rust\\build\\build\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "C:\\Users\\we\\AppData\\Local\\Temp\\rustc.awTF0ygPNTLw\\libstd-0159a69b5420bf5d.rlib" "C:\\msys64\\home\\we\\rust\\build\\build\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-9fc12bc5201b06f7.rlib" "-Wl,-Bdynamic" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-Wl,-Bstatic" "-l" "gcc_eh" "-l" "pthread" "-Wl,-Bdynamic" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\msys64\\home\\we\\rust\\build\\build\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
  = note: C:\msys64\home\we\rust\build\build\x86_64-pc-windows-gnu\stage2\lib\rustlib\x86_64-pc-windows-gnu\lib\libcompiler_builtins-9fc12bc5201b06f7.rlib(compiler_builtins-9fc12bc5201b06f7.0.o):(.text+0xd3): undefined reference to `rust_eh_unwind_resume'
          C:\msys64\home\we\rust\build\build\x86_64-pc-windows-gnu\stage2\lib\rustlib\x86_64-pc-windows-gnu\lib\libcompiler_builtins-9fc12bc5201b06f7.rlib(compiler_builtins-9fc12bc5201b06f7.0.o):(.text+0x105): undefined reference to `rust_eh_unwind_resume'
          C:\msys64\home\we\rust\build\build\x86_64-pc-windows-gnu\stage2\lib\rustlib\x86_64-pc-windows-gnu\lib\libcompiler_builtins-9fc12bc5201b06f7.rlib(compiler_builtins-9fc12bc5201b06f7.0.o):(.text+0x200): undefined reference to `rust_eh_unwind_resume'
          C:\msys64\home\we\rust\build\build\x86_64-pc-windows-gnu\stage2\lib\rustlib\x86_64-pc-windows-gnu\lib\libcompiler_builtins-9fc12bc5201b06f7.rlib(compiler_builtins-9fc12bc5201b06f7.0.o):(.text+0x242): undefined reference to `rust_eh_unwind_resume'
          C:\msys64\home\we\rust\build\build\x86_64-pc-windows-gnu\stage2\lib\rustlib\x86_64-pc-windows-gnu\lib\libcompiler_builtins-9fc12bc5201b06f7.rlib(compiler_builtins-9fc12bc5201b06f7.0.o):(.text+0x339): undefined reference to `rust_eh_unwind_resume'
          C:\msys64\home\we\rust\build\build\x86_64-pc-windows-gnu\stage2\lib\rustlib\x86_64-pc-windows-gnu\lib\libcompiler_builtins-9fc12bc5201b06f7.rlib(compiler_builtins-9fc12bc5201b06f7.0.o):(.text+0x37e): more undefined references to `rust_eh_unwind_resume' follow
          collect2.exe: error: ld returned 1 exit status


error: aborting due to previous error


------------------------------------------

thread '[run-pass] run-pass\sepcomp-lib-lto.rs' panicked at 'explicit panic', C:\msys64\home\we\rust\src\tools\compiletest\src\runtest.rs:2473:8

This happens on Windows/GNU (which seems to be the only target using rust_eh_unwind_resume).

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jul 10, 2017

One cause of this is #43150 as we shouldn't codegen these function calls anyway, still investigating.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jul 10, 2017

Ok looks like this is also due to #43151.

I think to paper over this issue we should just unconditionally compile compiler-builtins with panic=abort. This in theory is as easy as adding a clause here to also check for compiler_builtins, but I believe this will thwart the compiler's internal check that all crates are compiled with the same panic mode, so it's unlikely to be this trivial.

I'm going to tag this as a regression as I think this won't affect just the bootstrap, but any builds with LTO that end up not using symbols from core.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jul 10, 2017

I've also filed rust-lang-nursery/compiler-builtins#177 to track the fix there. That includes a test which fails today and when passing should solve this issue.

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Jul 13, 2017

Compiler team might want to be aware of this. It seems to just impact our own bootstrap though. P-?

bors added a commit that referenced this issue Jul 16, 2017

Auto merge of #43258 - petrochenkov:cbabort, r=alexcrichton
Compile `compiler_builtins` with `abort` panic strategy

A workaround for #43095

In case this causes unexpected consequences, I use a simpler workaround locally:
```diff
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -175,7 +175,9 @@ fn main() {
         }

         if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") {
-            cmd.arg("-C").arg(format!("codegen-units={}", s));
+            if crate_name != "compiler_builtins" {
+                cmd.arg("-C").arg(format!("codegen-units={}", s));
+            }
         }

         // Emit save-analysis info.
```

r? @alexcrichton

bors added a commit that referenced this issue Jul 17, 2017

Auto merge of #43258 - petrochenkov:cbabort, r=alexcrichton
Compile `compiler_builtins` with `abort` panic strategy

A workaround for #43095

In case this causes unexpected consequences, I use a simpler workaround locally:
```diff
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -175,7 +175,9 @@ fn main() {
         }

         if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") {
-            cmd.arg("-C").arg(format!("codegen-units={}", s));
+            if crate_name != "compiler_builtins" {
+                cmd.arg("-C").arg(format!("codegen-units={}", s));
+            }
         }

         // Emit save-analysis info.
```

r? @alexcrichton
@petrochenkov

This comment has been minimized.

Copy link
Contributor Author

petrochenkov commented Jul 19, 2017

I'll close this since the immediate problem is fixed and the underlying issues have their own issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.