Closed GoogleCodeExporter closed 9 years ago
It sounds like your odcctools is misconfigured, because "ldm" is definitely a
valid ARM instruction. Make sure
that you specified the correct path to your arm-apple-darwin-as with --with-as
when configuring LLVM-GCC,
and make sure that you specified --target=arm-apple-darwin when configuring
odcctools.
Original comment by nightwat...@gmail.com
on 12 Sep 2007 at 4:13
Original comment by nightwat...@gmail.com
on 12 Sep 2007 at 5:04
Thanks! Trying now...
Original comment by x...@hdm.io
on 12 Sep 2007 at 5:46
Looks like I forgot to add the /usr/local/bin directory to my PATH (things are
chugging along now, should know if this is resolved within 20 minutes). Thanks!
Original comment by x...@hdm.io
on 12 Sep 2007 at 5:50
Going to go ahead and close this then. A note has been added to the build
instructions to ensure that
/usr/local/bin is in your PATH.
Original comment by nightwat...@gmail.com
on 12 Sep 2007 at 7:33
Same error after a complete recheckout, rebuild, with proper paths, etc. Still
trying
to figure out why its not using the right assembler. All the odcc stuff is in
the
correct place.
Original comment by x...@hdm.io
on 12 Sep 2007 at 7:43
Adding output of configure:
# ../llvm-gcc-4.0-iphone/configure --enable-llvm=$LLVMOBJDIR --enable-languages=c,
c++,objc,obj-c++ --target=arm-apple-darwin --enable-sjlj-exceptions
--with-heavenly=$HEAVENLY --with-as=/usr/local/bin/arm-apple-darwin-as
--with-ld=/usr/local/bin/arm-apple-darwin-ld
creating cache ./config.cache
checking host system type... i686-pc-linux-gnu
checking target system type... arm-apple-darwin
checking build system type... i686-pc-linux-gnu
checking for a BSD compatible install... /bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for gnatbind... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1
$$f2
checking for correct version of gmp.h... yes
checking for MPFR... yes
*** This configuration is not supported in the following subdirectories:
target-libmudflap target-libobjc target-libffi target-boehm-gc target-zlib
target-libjava target-libada target-libgfortran zlib fastjar
(Any other directories should still work fine.)
checking for bison... bison
checking for bison... bison -y
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... makeinfo
checking for i686-pc-linux-gnu-ar... i686-pc-linux-gnu-ar
checking for i686-pc-linux-gnu-as... i686-pc-linux-gnu-as
checking for i686-pc-linux-gnu-dlltool... no
checking for dlltool... dlltool
checking for i686-pc-linux-gnu-ld...
/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../../i686-pc-linux-gnu/bin/ld
checking for i686-pc-linux-gnu-nm... i686-pc-linux-gnu-nm
checking for i686-pc-linux-gnu-ranlib... i686-pc-linux-gnu-ranlib
checking for i686-pc-linux-gnu-windres... no
checking for windres... windres
checking for i686-pc-linux-gnu-objcopy... i686-pc-linux-gnu-objcopy
checking for i686-pc-linux-gnu-objdump... i686-pc-linux-gnu-objdump
checking for arm-apple-darwin-ar... arm-apple-darwin-ar
checking for arm-apple-darwin-as... arm-apple-darwin-as
checking for arm-apple-darwin-dlltool... no
checking for arm-apple-darwin-ld... arm-apple-darwin-ld
checking for arm-apple-darwin-lipo... arm-apple-darwin-lipo
checking for arm-apple-darwin-nm... arm-apple-darwin-nm
checking for arm-apple-darwin-ranlib... arm-apple-darwin-ranlib
checking for arm-apple-darwin-strip... arm-apple-darwin-strip
checking for arm-apple-darwin-windres... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking if symbolic links between directories work... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
Original comment by x...@hdm.io
on 12 Sep 2007 at 7:47
The proper assembler is being called (the one installed by odcctools):
451 [ffffe410] execve("/usr/local/libexec/as/arm/as",
["/usr/local/libexec/as/arm/as", "-arch", "arm", "-force_cpusubtype_ALL", "-o",
"libgcc/./_udivsi3_s.o"], [/* 171 vars */] <unfinished ...>
449 [ffffe410] open("../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm",
O_RDONLY|O_NOCTTY) = 3
Original comment by x...@hdm.io
on 12 Sep 2007 at 7:57
# echo "nop" | /usr/local/libexec/as/arm/as -arch arm -force_cpusubtype_ALL -o
test.o; ls -la test.o; file test.o
-rw-r--r-- 1 root root 156 Sep 12 15:01 test.o
test.o: Mach-O object acorn
Original comment by x...@hdm.io
on 12 Sep 2007 at 8:00
# echo "ldm" | /usr/local/libexec/as/arm/as -arch arm -force_cpusubtype_ALL -o
tes
t.o
{standard input}:1:Unknown instruction 'ldm'
{standard input}:1:syntax error, unexpected $end
Original comment by x...@hdm.io
on 12 Sep 2007 at 8:03
I'll take a look at lib1funcs.asm.
Original comment by nightwat...@gmail.com
on 12 Sep 2007 at 8:05
Right, "ldm" by itself is not a valid assembler instruction, it needs to be
ldmia. I misspoke... and I wrote the
damn assembler ;) Now the problem is that I can't reproduce your bug at all. It
assembles just fine for me. This
could be a bug in the assembler that manifests itself with your glibc or
something. Unless you can provide me
with a macro-expanded assembler file there isn't a whole lot I can do...
Original comment by nightwat...@gmail.com
on 12 Sep 2007 at 8:12
Ah, OK. I don't know ARM :-) The following works. Whats the equivalent of CPP
for as
to provide you with the expanded file?
# echo -ne "ldmia r0,0x0\n" | ./as
Thanks for taking the time.
Original comment by x...@hdm.io
on 12 Sep 2007 at 8:20
The problem is that it wouldn't be enough; the problem looks like it's in the
preprocessor itself. That's hard for
me to pinpoint if I can't reproduce the bug.
Original comment by nightwat...@gmail.com
on 12 Sep 2007 at 8:24
Can you give me the version of GCC and glibc that you used to compile the
assembler? I can try to reproduce it
that way.
Original comment by nightwat...@gmail.com
on 12 Sep 2007 at 8:30
Doh. Including the pre-processor output for now, will keep messing with it
(gates the
rest of the dev work).
# /downloads/iphone-dev/iphone-dev/llvm-gcc-4.0-iphone-build/gcc/xgcc
-B/downloads/iphone-dev/iphone-dev/llvm-gcc-4.0-iphone-build/gcc/
-B/usr/local/arm-apple-darwin/bin/ -B/usr/local/arm-apple-darwin/lib/ -isystem
/usr/local/arm-apple-darwin/include -isystem
/usr/local/arm-apple-darwin/sys-include
-O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem
./include
-fPIC -pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
-Dinhibit_libc -I. -I. -I../../llvm-gcc-4.0-iphone/gcc
-I../../llvm-gcc-4.0-iphone/gcc/. -I../../llvm-gcc-4.0-iphone/gcc/../include
-I../../llvm-gcc-4.0-iphone/gcc/../libcpp/include
-I/downloads/iphone-dev/llvm-svn/include
-I/downloads/iphone-dev/llvm-svn//include
-DSHARED -DL_udivsi3 -xassembler-with-cpp -c
../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm -S
# 1 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
# 1 "/downloads/iphone-dev/iphone-dev/llvm-gcc-4.0-iphone-build/gcc//"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
@ libgcc routines for ARM cpu.
@ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk)
# 65 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
@ This selects the minimum architecture level required.
# 121 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
.macro RETLDM regs=, cond=, dirn=ia
# 130 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
.ifc "\regs",""
ldr\cond pc, [sp], #4
.else
ldm\cond\dirn sp!, {\regs, pc}
.endif
.endm
.macro ARM_LDIV0
Ldiv0:
str lr, [sp, #-4]!
bl ___div0
mov r0, #0 @ About as wrong as it could be.
RETLDM
.endm
.macro THUMB_LDIV0
Ldiv0:
push { lr }
bl ___div0
mov r0, #0 @ About as wrong as it could be.
pop { pc }
.endm
.macro FUNC_END name
.endm
.macro DIV_FUNC_END name
ARM_LDIV0
FUNC_END \name
.endm
.macro THUMB_FUNC_START name
.globl _\name
.thumb_func
_\name:
.endm
# 195 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
.macro FUNC_START name
.text
.globl ___\name
.align 0
___\name:
.endm
# 225 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
.macro ARM_FUNC_START name
.text
.globl ___\name
.align 0
.arm
___\name:
.endm
.macro ARM_CALL name
bl __\name
.endm
.macro FUNC_ALIAS new old
.globl ___\new
.set ___\new, ___\old
.endm
.macro ARM_FUNC_ALIAS new old
.globl ___\new
.set ___\new, ___\old
.endm
# 276 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
.macro ARM_DIV_BODY dividend, divisor, result, curbit
clz \curbit, \dividend
clz \result, \divisor
sub \curbit, \result, \curbit
rsbs \curbit, \curbit, #31
addne \curbit, \curbit, \curbit, lsl #1
mov \result, #0
addne pc, pc, \curbit, lsl #2
nop
.set shift, 32
.rept 32
.set shift, shift - 1
cmp \dividend, \divisor, lsl #shift
adc \result, \result, \result
subcs \dividend, \dividend, \divisor, lsl #shift
.endr
# 360 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
.endm
.macro ARM_DIV2_ORDER divisor, order
clz \order, \divisor
rsb \order, \order, #31
# 390 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
.endm
.macro ARM_MOD_BODY dividend, divisor, order, spare
clz \order, \divisor
clz \spare, \dividend
sub \order, \order, \spare
rsbs \order, \order, #31
addne pc, pc, \order, lsl #3
nop
.set shift, 32
.rept 32
.set shift, shift - 1
cmp \dividend, \divisor, lsl #shift
subcs \dividend, \dividend, \divisor, lsl #shift
.endr
# 479 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
.endm
.macro THUMB_DIV_MOD_BODY modulo
@ Load the constant 0x10000000 into our work register.
mov work, #1
lsl work, #28
Loop1:
@ Unless the divisor is very big, shift it up in multiples of
@ four bits, since this is the amount of unwinding in the main
@ division loop. Continue shifting until the divisor is
@ larger than the dividend.
cmp divisor, work
bhs Lbignum
cmp divisor, dividend
bhs Lbignum
lsl divisor, #4
lsl curbit, #4
b Loop1
Lbignum:
@ Set work to 0x80000000
lsl work, #3
Loop2:
@ For very big divisors, we must shift it a bit at a time, or
@ we will be in danger of overflowing.
cmp divisor, work
bhs Loop3
cmp divisor, dividend
bhs Loop3
lsl divisor, #1
lsl curbit, #1
b Loop2
Loop3:
@ Test for possible subtractions ...
.if \modulo
@ ... On the final pass, this may subtract too much from the dividend,
@ so keep track of which subtractions are done, we can fix them up
@ afterwards.
mov overdone, #0
cmp dividend, divisor
blo Lover1
sub dividend, dividend, divisor
Lover1:
lsr work, divisor, #1
cmp dividend, work
blo Lover2
sub dividend, dividend, work
mov ip, curbit
mov work, #1
ror curbit, work
orr overdone, curbit
mov curbit, ip
Lover2:
lsr work, divisor, #2
cmp dividend, work
blo Lover3
sub dividend, dividend, work
mov ip, curbit
mov work, #2
ror curbit, work
orr overdone, curbit
mov curbit, ip
Lover3:
lsr work, divisor, #3
cmp dividend, work
blo Lover4
sub dividend, dividend, work
mov ip, curbit
mov work, #3
ror curbit, work
orr overdone, curbit
mov curbit, ip
Lover4:
mov ip, curbit
.else
@ ... and note which bits are done in the result. On the final pass,
@ this may subtract too much from the dividend, but the result will be ok,
@ since the "bit" will have been shifted out at the bottom.
cmp dividend, divisor
blo Lover1
sub dividend, dividend, divisor
orr result, result, curbit
Lover1:
lsr work, divisor, #1
cmp dividend, work
blo Lover2
sub dividend, dividend, work
lsr work, curbit, #1
orr result, work
Lover2:
lsr work, divisor, #2
cmp dividend, work
blo Lover3
sub dividend, dividend, work
lsr work, curbit, #2
orr result, work
Lover3:
lsr work, divisor, #3
cmp dividend, work
blo Lover4
sub dividend, dividend, work
lsr work, curbit, #3
orr result, work
Lover4:
.endif
cmp dividend, #0 @ Early termination?
beq Lover5
lsr curbit, #4 @ No, any more bits to do?
beq Lover5
lsr divisor, #4
b Loop3
Lover5:
.if \modulo
@ Any subtractions that we should not have done will be recorded in
@ the top three bits of "overdone". Exactly which were not needed
@ are governed by the position of the bit, stored in ip.
mov work, #0xe
lsl work, #28
and overdone, work
beq Lgot_result
@ If we terminated early, because dividend became zero, then the
@ bit in ip will not be in the bottom nibble, and we should not
@ perform the additions below. We must test for this though
@ (rather relying upon the TSTs to prevent the additions) since
@ the bit in ip could be in the top two bits which might then match
@ with one of the smaller RORs.
mov curbit, ip
mov work, #0x7
tst curbit, work
beq Lgot_result
mov curbit, ip
mov work, #3
ror curbit, work
tst overdone, curbit
beq Lover6
lsr work, divisor, #3
add dividend, work
Lover6:
mov curbit, ip
mov work, #2
ror curbit, work
tst overdone, curbit
beq Lover7
lsr work, divisor, #2
add dividend, work
Lover7:
mov curbit, ip
mov work, #1
ror curbit, work
tst overdone, curbit
beq Lgot_result
lsr work, divisor, #1
add dividend, work
.endif
Lgot_result:
.endm
FUNC_START udivsi3
FUNC_ALIAS aeabi_uidiv udivsi3
# 666 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
subs r2, r1, #1
bxeq lr
bcc Ldiv0
cmp r0, r1
bls 11f
tst r1, r2
beq 12f
ARM_DIV_BODY r0, r1, r2, r3
mov r0, r2
bx lr
11: moveq r0, #1
movne r0, #0
bx lr
12: ARM_DIV2_ORDER r1, r2
mov r0, r0, lsr r2
bx lr
DIV_FUNC_END udivsi3
FUNC_START aeabi_uidivmod
# 701 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
stmfd sp!, { r0, r1, lr }
bl ___udivsi3
ldmfd sp!, { r1, r2, lr }
mul r3, r2, r0
sub r1, r1, r3
bx lr
FUNC_END aeabi_uidivmod
# 1239 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm"
# 1 "../../llvm-gcc-4.0-iphone/gcc/config/arm/ieee754-df.S" 1
# 44 "../../llvm-gcc-4.0-iphone/gcc/config/arm/ieee754-df.S"
@ For FPA, float words are always big-endian.
@ For VFP, floats words follow the memory system mode.
# 1240 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm" 2
# 1 "../../llvm-gcc-4.0-iphone/gcc/config/arm/ieee754-sf.S" 1
# 1241 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm" 2
# 1 "../../llvm-gcc-4.0-iphone/gcc/config/arm/bpabi.S" 1
# 1242 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm" 2
# 1 "../../llvm-gcc-4.0-iphone/gcc/config/arm/libunwind.S" 1
# 1244 "../../llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm" 2
Original comment by x...@hdm.io
on 12 Sep 2007 at 8:35
shank gcc # gcc -v
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/specs
Configured with: /home/portage/portage/gcc-3.4.6/work/gcc-3.4.6/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.4.6
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/include/g++-v3
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--enable-nls
--without-included-gettext --with-system-zlib --disable-checking
--disable-werror
--disable-libunwind-exceptions --disable-multilib --disable-libgcj
--enable-languages=c,c++,f77 --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.6 (Gentoo 3.4.6, ssp-3.4.5-1.0, pie-8.7.9)
shank gcc # ld -v
GNU ld version 2.17
sys-libs/glibc-2.5 was built with the following:
CFLAGS="-O2 -fno-strict-aliasing -march=pentium4"
CXXFLAGS="-O2 -fno-strict-aliasing -march=pentium4"
Time for a gcc upgrade here?
Original comment by x...@hdm.io
on 12 Sep 2007 at 8:50
I would recommend it. I think everyone who has gotten the toolchain to work has
done so with gcc 4.x. I'm going
to try compiling with gcc 3.x here in a few minutes, once I get cygwin up and
running, so if you're stuck with
that hang on for a bit.
Original comment by nightwat...@gmail.com
on 12 Sep 2007 at 9:35
Just got a duplicate of this bug on GCC 4.x. Hmm.
Original comment by nightwat...@gmail.com
on 12 Sep 2007 at 10:55
Updated to 4.0.2, still an issue here as well.
Original comment by x...@hdm.io
on 12 Sep 2007 at 11:23
Lyxdesic: I mean 4.2.0:
# gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with:
/home/portage/portage/sys-devel/gcc-4.2.0/work/gcc-4.2.0/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.2.0
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.2.0
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.2.0/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.2.0/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/include/g++-v4
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--enable-nls
--without-included-gettext --with-system-zlib --disable-checking
--disable-werror
--enable-secureplt --disable-libunwind-exceptions --disable-multilib
--enable-libmudflap --disable-libssp --disable-libgcj --with-arch=i686
--enable-languages=c,c++,fortran --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.2.0 (Gentoo 4.2.0 p1.4)
Original comment by x...@hdm.io
on 12 Sep 2007 at 11:23
Got another report of this, on ubuntu feisty. Bumping priority to high since it
seems to be a VERY common
problem.
Original comment by nightwat...@gmail.com
on 13 Sep 2007 at 2:35
Successfully reproduced this error, finally, after reinstalling Ubuntu from
scratch. I'll take a look at it tomorrow.
Original comment by nightwat...@gmail.com
on 13 Sep 2007 at 5:31
Fixed, it was a memory corruption bug - but see issue 29.
Original comment by nightwat...@gmail.com
on 13 Sep 2007 at 8:07
Original comment by nightwat...@gmail.com
on 13 Sep 2007 at 8:07
Original issue reported on code.google.com by
x...@hdm.io
on 12 Sep 2007 at 4:08