llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Support for X32 ABI

Open llvmbot opened this issue 14 years ago • 12 comments

Bugzilla Link 13666
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @bjacquin,@svenha,@darkbuck,@pageexec,@tycho

Extended Description

Linux since version 3.4 and GCC since version 4.7 support X32 ABI. https://sites.google.com/site/x32abi/ LLVM could also support it.

llvmbot avatar Aug 22 '12 16:08 llvmbot

Repro command line:

"/usr/bin/clang" "-cc1" "-triple" "x86_64-unknown-linux-gnux32" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-main-file-name" "test.c" "-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu" "x86-64" "-target-linker-version" "2.25.0" "-dwarf-column-info" "-ferror-limit" "19" "-fmessage-length" "133" "-mstackrealign" "-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-x" "c" "test.c"

tycho avatar Mar 11 '15 11:03 tycho

switch statement with jump table Here's a repro using a bogus switch statement large enough to create a jump table. I could get a reduced test case from a larger project facing this issue, but let's start with the dead simple handmade one.

tycho avatar Mar 11 '15 11:03 tycho

could you post the test case? C source or LLVM IR?

darkbuck avatar Mar 11 '15 08:03 darkbuck

Any chance of getting this fixed? Still seeing this on LLVM trunk, and it makes me sad:

fatal error: error in backend: Cannot select: 0x45b1b80: ch = brind 0x45b1630:1, 0x45b1630 [ORD=1] [ID=10] 0x45b1630: i32,ch = load 0x45b2ec0:1, 0x45c5b30, 0x45c5800<LD4[JumpTable]> [ORD=1] [ID=9] 0x45c5b30: i32 = add 0x45b1da0, 0x45b2a80 [ORD=1] [ID=8] 0x45b1da0: i32 = shl 0x45b2ec0, 0x45c5e60 [ORD=1] [ID=7] 0x45b2ec0: i32,ch = CopyFromReg 0x450c9d0, 0x45b2ca0 [ORD=1] [ID=5] 0x45b2ca0: i32 = Register %vreg204 [ID=1] 0x45c5e60: i8 = Constant<2> [ID=4] 0x45b2a80: i32 = X86ISD::Wrapper 0x45b2fd0 [ID=6] 0x45b2fd0: i32 = TargetJumpTable<0> [ID=3] 0x45c5800: i32 = undef [ID=2

tycho avatar Mar 07 '15 01:03 tycho

atomic-dbf708.sh

bjacquin avatar Apr 02 '14 23:04 bjacquin

atomic-dbf708.c

bjacquin avatar Apr 02 '14 23:04 bjacquin

build.log Here is an update build log for llvm-3.4

bjacquin avatar Apr 02 '14 23:04 bjacquin

gcc_personality_v0-JKxFgr.c As requested by :

COMPILE: clang_linux/full-x86_64/x86_64: /var/tmp/portage/sys-devel/clang-9999/work/llvm/projects/compiler-rt/lib/lshrti3.c /var/tmp/portage/sys-devel/clang-9999/work/llvm/Release/bin/clang -fPIC -Wall -Werror -O3 -fomit-frame-pointer -m64 --sysroot=/var /tmp/portage/sys-devel/clang-9999/work/llvm/projects/compiler-rt/SDKs/linux -c -o /var/tmp/portage/sys-devel/clang-9999/work/llvm/ tools/clang/runtime/compiler-rt/clang_linux/full-x86_64/x86_64/SubDir.lib/lshrti3.o /var/tmp/portage/sys-devel/clang-9999/work/llv m/projects/compiler-rt/lib/lshrti3.c fatal error: error in backend: Cannot select: 0x3381998: ch = brind 0x3381ff8:1, 0x3384af8 [ID=11] 0x3384af8: i32 = add 0x3381ff8, 0x3381910 [ID=10] 0x3381ff8: i32,ch = load 0x3381888:1, 0x3384e28, 0x3384eb0<LD4[JumpTable]> [ID=9] 0x3384e28: i32 = add 0x3384c90, 0x3381910 [ID=8] 0x3384c90: i32 = shl 0x3381888, 0x3381cc8 [ID=7] 0x3381888: i32,ch = CopyFromReg 0x334eb4c, 0x3384da0 [ID=5] 0x3384da0: i32 = Register %vreg36 [ID=1] 0x3381cc8: i8 = Constant<2> [ID=4] 0x3381910: i32 = X86ISD::WrapperRIP 0x3381778 [ID=6] 0x3381778: i32 = TargetJumpTable<0> [ID=3] 0x3384eb0: i32 = undef [ID=2] 0x3381910: i32 = X86ISD::WrapperRIP 0x3381778 [ID=6] 0x3381778: i32 = TargetJumpTable<0> [ID=3] In function: readEncodedPointer clang: error: clang frontend command failed with exit code 70 (use -v to see invocation) clang version 3.3 (trunk) Target: x86_64-pc-linux-gnux32 Thread model: posix clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed sou rce, and associated run script. clang: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang: note: diagnostic msg: /var/tmp/portage/sys-devel/clang-9999/temp/gcc_personality_v0-JKxFgr.c clang: note: diagnostic msg: /var/tmp/portage/sys-devel/clang-9999/temp/gcc_personality_v0-JKxFgr.sh clang: note: diagnostic msg:


bjacquin avatar Apr 27 '13 03:04 bjacquin

gcc_personality_v0-JKxFgr.sh As requested by :

COMPILE: clang_linux/full-x86_64/x86_64: /var/tmp/portage/sys-devel/clang-9999/work/llvm/projects/compiler-rt/lib/lshrti3.c /var/tmp/portage/sys-devel/clang-9999/work/llvm/Release/bin/clang -fPIC -Wall -Werror -O3 -fomit-frame-pointer -m64 --sysroot=/var /tmp/portage/sys-devel/clang-9999/work/llvm/projects/compiler-rt/SDKs/linux -c -o /var/tmp/portage/sys-devel/clang-9999/work/llvm/ tools/clang/runtime/compiler-rt/clang_linux/full-x86_64/x86_64/SubDir.lib/lshrti3.o /var/tmp/portage/sys-devel/clang-9999/work/llv m/projects/compiler-rt/lib/lshrti3.c fatal error: error in backend: Cannot select: 0x3381998: ch = brind 0x3381ff8:1, 0x3384af8 [ID=11] 0x3384af8: i32 = add 0x3381ff8, 0x3381910 [ID=10] 0x3381ff8: i32,ch = load 0x3381888:1, 0x3384e28, 0x3384eb0<LD4[JumpTable]> [ID=9] 0x3384e28: i32 = add 0x3384c90, 0x3381910 [ID=8] 0x3384c90: i32 = shl 0x3381888, 0x3381cc8 [ID=7] 0x3381888: i32,ch = CopyFromReg 0x334eb4c, 0x3384da0 [ID=5] 0x3384da0: i32 = Register %vreg36 [ID=1] 0x3381cc8: i8 = Constant<2> [ID=4] 0x3381910: i32 = X86ISD::WrapperRIP 0x3381778 [ID=6] 0x3381778: i32 = TargetJumpTable<0> [ID=3] 0x3384eb0: i32 = undef [ID=2] 0x3381910: i32 = X86ISD::WrapperRIP 0x3381778 [ID=6] 0x3381778: i32 = TargetJumpTable<0> [ID=3] In function: readEncodedPointer clang: error: clang frontend command failed with exit code 70 (use -v to see invocation) clang version 3.3 (trunk) Target: x86_64-pc-linux-gnux32 Thread model: posix clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed sou rce, and associated run script. clang: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang: note: diagnostic msg: /var/tmp/portage/sys-devel/clang-9999/temp/gcc_personality_v0-JKxFgr.c clang: note: diagnostic msg: /var/tmp/portage/sys-devel/clang-9999/temp/gcc_personality_v0-JKxFgr.sh clang: note: diagnostic msg:


bjacquin avatar Apr 27 '13 03:04 bjacquin

build.log Here is some trace while building clang trunk on Revision 180652 with ABI=x32 on a gentoo system.

LLVM is SVN revision 180652 too.

I'm open to patch and testing if needed.

This first file is the complete output (xz as original file is ~3MB) while next files are the requested file attachement as showned in crash report.

bjacquin avatar Apr 27 '13 03:04 bjacquin

An initial X32 patch at http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-June/050360.html and re-posted with split patches.

darkbuck avatar Aug 22 '12 22:08 darkbuck