[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13353: Coreutils-8.20 mips build broken
From: |
Pádraig Brady |
Subject: |
bug#13353: Coreutils-8.20 mips build broken |
Date: |
Fri, 04 Jan 2013 12:12:37 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 |
On 01/04/2013 05:45 AM, Marko Lindqvist wrote:
I've tried to update coreutils version used in OpenEmbedded. I've been
building for x86, arm, and mips architectures. Coreutils-8.19 builds
fine for all three, but 8.20 fails on mips with lots of "unable to
emulate 'TI'" errors and "right whift count >= width of type" warnings
from src/factor.c. First error comes from line 766.
That's umul_ppmm() which is coming from longlong.h
#if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
#if __GMP_GNUC_PREREQ (4,4)
#define umul_ppmm(w1, w0, u, v) \
do { \
typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \
__ll_UTItype __ll = (__ll_UTItype)(u) * (v); \
w1 = __ll >> 64; \
w0 = __ll; \
} while (0)
#endif
I've only gcc (RAYS 4.3.0-4.rays0) 4.3.1 20080501 (prerelease)
on an ICT Loongson-2 V0.3 FPU V0.1
but that allows me to check various macros to key on....
$ for abi in 32 o64 n32 64; do
for cpu in mips1 mips2 mips3 mips4 mips32 mips32r2 mips64; do
echo "--------- $cpu/$abi --------"
cpp -mabi=$abi -march=$cpu -dM /dev/null |
grep -Ei "__mips |LP|_MPIS_SZ"
done
done
--------- mips1/32 --------
#define __mips 1
--------- mips2/32 --------
#define __mips 2
--------- mips3/32 --------
#define __mips 3
--------- mips4/32 --------
#define __mips 4
--------- mips32/32 --------
#define __mips 32
--------- mips32r2/32 --------
#define __mips 32
--------- mips64/32 --------
#define __mips 64
--------- mips1/o64 --------
cc1: error: '-march=mips1' is not compatible with the selected ABI
--------- mips2/o64 --------
cc1: error: '-march=mips2' is not compatible with the selected ABI
--------- mips3/o64 --------
#define __mips 3
--------- mips4/o64 --------
#define __mips 4
--------- mips32/o64 --------
cc1: error: '-march=mips32' is not compatible with the selected ABI
--------- mips32r2/o64 --------
cc1: error: '-march=mips32r2' is not compatible with the selected ABI
--------- mips64/o64 --------
#define __mips 64
--------- mips1/n32 --------
cc1: error: '-march=mips1' is not compatible with the selected ABI
--------- mips2/n32 --------
cc1: error: '-march=mips2' is not compatible with the selected ABI
--------- mips3/n32 --------
#define __mips 3
--------- mips4/n32 --------
#define __mips 4
--------- mips32/n32 --------
cc1: error: '-march=mips32' is not compatible with the selected ABI
--------- mips32r2/n32 --------
cc1: error: '-march=mips32r2' is not compatible with the selected ABI
--------- mips64/n32 --------
#define __mips 64
--------- mips1/64 --------
cc1: error: '-march=mips1' is not compatible with the selected ABI
--------- mips2/64 --------
cc1: error: '-march=mips2' is not compatible with the selected ABI
--------- mips3/64 --------
#define __LP64__ 1
#define _LP64 1
#define __mips 3
--------- mips4/64 --------
#define __LP64__ 1
#define _LP64 1
#define __mips 4
--------- mips32/64 --------
cc1: error: '-march=mips32' is not compatible with the selected ABI
--------- mips32r2/64 --------
cc1: error: '-march=mips32r2' is not compatible with the selected ABI
--------- mips64/64 --------
#define __LP64__ 1
#define _LP64 1
#define __mips 64
Notice that the macro in longlong.h checks __mips > 3
but note that that can be 32 or 64 dependent on --march.
In any case it looks like we also need to key on _LP64.
So could you try the following patch.
With your compiler options it will probably avoid
the code in longlong.h, or you may also like to
try -mabi=64 --march=from-abi if appropriate.
diff src/longlong.h.orig src/longlong.h
1240c1240
< #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
---
> #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64 && defined (_LP64)
thanks,
Pádraig.