Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

case branch tables: as complains "complex expression, absolute segment assumed" #958

Closed Quuxplusone closed 14 years ago

Quuxplusone commented 17 years ago
Bugzilla Link PR958
Status RESOLVED FIXED
Importance P release blocker
Reported by Scott Michel (scooter.phd@gmail.com)
Reported on 2006-10-19 17:20:28 -0700
Last modified on 2010-02-22 12:44:08 -0800
Version trunk
Hardware Macintosh MacOS X
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
Not sure if the problem is with the assembler or if it is a gcc frontend issue.
However, for gcc/config/darwin-crt3.c:run_routines as well as numerous messages
from compiling gcc/unwind-dw2-fde.c, it's clear that case statements are a
problem. I've attached a patch to work around this issue for the time being to
get a working front end, but clearly this will be an issue.

The version of as installed on my Mac OS 10.4.8 system reports itself as "Apple
Computer, Inc. version cctools-590.18.obj~10, GNU assembler version 1.38" (which
may be the problem, but it's also an issue on 10.3.9 systems too.)

The as statements look like:

LBB8_8: ;bb17

; ...

LBB8_11:    ;bb22

; ...

    blr
    .align  2
    .set L8_0_set_8,LBB8_8-LJTI8_0      ; "complex expression, absolute segment
assumed"
    .set L8_0_set_11,LBB8_11-LJTI8_0    ; "complex expression, absolute segment
assumed"
LJTI8_0:
    .long    L8_0_set_8
    .long    L8_0_set_11
    .long    L8_0_set_8
    .long    L8_0_set_11
    .long    L8_0_set_8
    .long    L8_0_set_11
Quuxplusone commented 17 years ago
Ugh. Even with unwrapping the switch/case statements to equivalent if
statements, gcc decides (even with -O0) to create jump tables. Of course, this
wreaks havoc in the assembler and I'm back at square 0.
Quuxplusone commented 17 years ago
Yup, it's the assembler. Recommended workaround is to install odcctools from
DarwinPorts (or equivalent upgraded binutils) and run configure for the C
frontend as follows:

env AS=/opt/local/bin/odas LD=/opt/local/bin/odld ../configure
--prefix=/Users/scottm/play/llvm-cfrontend/obj/../powerpc-apple-darwin8.0
--program-prefix=llvm- --enable-llvm=`pwd`/../../llvm/obj/
--enable-languages=c,c++ --with-as=/opt/local/bin/odas --with-
ld=/opt/local/bin/odld