[crosstool-ng] error building x86 toolchain
Khem Raj
raj.khem@gmail.com
Tue Jan 6 00:23:00 GMT 2009
On (02/01/09 18:52), Matthias Kaehlcke wrote:
> hi,
>
> i ran into an error during the crosstool-ng build for a x86
> toolchain in the compilation of pthread_rwlock_tryrdlock.c:
>
> [ALL ] pthread_rwlock_tryrdlock.c: Assembler messages:
> [ALL ] pthread_rwlock_tryrdlock.c:52: Error: suffix or operands
> invalid for `mov'
> [ERROR] make[3]: ***
> [/data/prog/embedded/toolchains/ct-ng-build/targets/i386-unknown-linux-gnu/build/build-libc/nptl/pthread_rwlock_tryrdlock.o]
> Error 1
I think this error is coming from lll_lock defined in
./nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h. In the inline asm it
says "g" (private) this tells compiler to chose from any
register, memory or immediate integer operand. So in your case compiler
choses register bl because __shared is unsigned chari and this instruction does not expect that. Note that
its not possible to do a lot of checks on inline code for the compiler
where as assembler can do better here in catching the error and it does.
what opt level are you using? for me it works with -O2 and above
but I get same errors with O O1 or Os
may be typecasting private to (int) private would help here try this
patch attached it might help.
Thx
-Khem
-------------- next part --------------
--- /tmp/glibc-2.7/nptl/../nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h.org 2009-01-05 16:15:47.000000000 -0800
+++ ./nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h 2009-01-05 13:57:01.000000000 -0800
@@ -323,7 +328,7 @@
"=m" (futex), "=&d" (ignore3) \
: "1" (1), "m" (futex), \
"i" (MULTIPLE_THREADS_OFFSET), "0" (0), \
- "g" (private) \
+ "g" ((int) (private)) \
: "memory"); \
} \
})
@@ -345,7 +350,7 @@
"18:" \
: "=a" (result), "=c" (ignore1), "=m" (futex), \
"=&d" (ignore2) \
- : "0" (0), "1" (id), "m" (futex), "g" (private) \
+ : "0" (0), "1" (id), "m" (futex), "g" ((int) (private))\
: "memory"); \
result; })
@@ -370,7 +375,7 @@
"18:" \
: "=a" (ignore1), "=c" (ignore2), "=m" (futex), \
"=&d" (ignore3) \
- : "0" (0), "1" (2), "m" (futex), "g" (private) \
+ : "0" (0), "1" (2), "m" (futex), "g" ((int) (private))\
: "memory"); \
})
@@ -393,7 +398,7 @@
: "=a" (result), "=c" (ignore1), "=m" (futex), \
"=&d" (ignore2) \
: "0" (0), "1" (id | FUTEX_WAITERS), "m" (futex), \
- "g" (private) \
+ "g" ((int) (private)) \
: "memory"); \
result; })
@@ -416,7 +421,7 @@
: "=a" (result), "=c" (ignore1), "=&d" (ignore2), \
"=m" (futex), "=S" (ignore3) \
: "0" (0), "1" (1), "m" (futex), "m" (timeout), \
- "4" (private) \
+ "4" ((int) (private)) \
: "memory"); \
result; })
@@ -439,7 +444,7 @@
: "=a" (result), "=c" (ignore1), "=&d" (ignore2), \
"=m" (futex), "=S" (ignore3) \
: "0" (0), "1" (id), "m" (futex), "m" (timeout), \
- "4" (private) \
+ "4" ((int) (private)) \
: "memory"); \
result; })
@@ -489,7 +494,7 @@
"18:" \
: "=m" (futex), "=&a" (ignore), "=&c" (ignore2) \
: "i" (MULTIPLE_THREADS_OFFSET), "m" (futex), \
- "g" (private) \
+ "g" ((int) (private)) \
: "memory"); \
} \
})
@@ -511,7 +516,8 @@
LLL_STUB_UNWIND_INFO_4 \
"18:" \
: "=m" (futex), "=&a" (ignore), "=&c" (ignore2) \
- : "i" (FUTEX_WAITERS), "m" (futex), "g" (private) \
+ : "i" (FUTEX_WAITERS), "m" (futex), \
+ "g" ((int) (private)) \
: "memory"); \
})
-------------- next part --------------
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list