clangupc / clang-upc

Clang UPC Front-End
https://clangupc.github.io/
Other
16 stars 5 forks source link

Bad unwind tables on Solaris-11/x86-64 w/ "-m64" #76

Open PHHargrove opened 9 years ago

PHHargrove commented 9 years ago

With clang-upc as it exists in the repo currently, I have no problems with clang and the default ILP32 ABI on Solaris-11 for x86-64, except the already reported issue with stdarg.h.

With -m64, however, the system linker is unable to deal with the unwind tables that clang is generating:

{phargrov@pcp-j-20 ~}$ clang -m64 hello.c -fasynchronous-unwind-tables
ld: fatal: unwind table: file /tmp/hello-f265e5.o: section .eh_frame: bad cie version 0: offset 0x4

clang: error: linker command failed with exit code 1 (use -v to see invocation)

On a per-compilation basis I can work-around with -fno-asynchronous-unwind-tables. However, I am currently building on Solaris-11/x86-64 with the following patch instead, which may or may not be "overkill".

diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index b5df866..971414f 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -526,6 +526,7 @@ protected:
   Tool *buildAssembler() const override;
   Tool *buildLinker() const override;

+  bool IsUnwindTablesDefault() const override { return false; }
 };
PHHargrove commented 9 years ago

Sorry, I committed the issue before I had proof-read it (and got the title wrong as a result).

I should have mentioned for clarity that -fasynchronous-unwind-tables in the example is required to reproduce the error message with the patched build. Prior to the one-line patch the error message would appear when invoking clang with just -m64 and a filename.