[llvm-bugs] [Bug 50148] New: [X32] Wrong exception table generation

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 27 14:58:29 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50148

            Bug ID: 50148
           Summary: [X32] Wrong exception table generation
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: harald at gigawatt.nl
          Reporter: harald at gigawatt.nl
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, pengfei.wang at intel.com,
                    spatel+llvm at rotateright.com

$ clang++ --version
clang version 11.1.0
Target: x86_64-unknown-linux-gnux32
Thread model: posix
InstalledDir: /usr/bin

$ cat test.ii
class E {};
void f();
void g() throw(E) { f(); }

$ clang++ -mx32 -c -O2 test.ii

$ objdump -rj .gcc_except_table test.o

test.o:     file format elf32-x86-64

RELOCATION RECORDS FOR [.gcc_except_table]:
OFFSET   TYPE              VALUE 
00000010 R_X86_64_32       _ZTI1E



$ clang++ -mx32 -c -O2 -fPIC test.ii

$ objdump -rj .gcc_except_table test.o

test.o:     file format elf32-x86-64

RELOCATION RECORDS FOR [.gcc_except_table]:
OFFSET   TYPE              VALUE 
00000010 R_X86_64_PC64     .data


With -fPIC we suddenly have a 64-bit relocation. That's wrong and causes a
linker error later on.

The above is tested with LLVM 11 with various cherry-picked patches from LLVM
12, but this is still an issue on LLVM 12 and trunk as well. Reporting to make
sure I don't forget about it, assigning to myself.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210427/c1f10167/attachment.html>


More information about the llvm-bugs mailing list