Bug 331282 - Compilation failure on MIPS64 o32 ABI
Summary: Compilation failure on MIPS64 o32 ABI
Status: RESOLVED INTENTIONAL
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.9.0
Platform: unspecified Linux
: NOR major
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-18 17:38 UTC by Vicente Olivert Riera
Modified: 2014-03-05 14:42 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vicente Olivert Riera 2014-02-18 17:38:26 UTC
When I try to compile valgrind-3.9.0 on MIPS64 o32 it fails with the following error:

{standard input}: Assembler messages:
{standard input}:29: Error: relocation %highest isn't supported by the current ABI
{standard input}:30: Error: relocation %higher isn't supported by the current ABI
make[4]: *** [libcoregrind_mips64_linux_a-m_main.o] Error 1

MIPS32, MIPS64 n32 and MIPS64 n64 are ok.
Comment 1 Dejan Jevtic 2014-02-24 16:57:01 UTC
For what are you trying to compile Valgrind?
Currently Valgrind for mips is supporting only
mips32/o32 ABI and mips64/n64 ABI. If you are trying to compile V for
mips32/o32 you can try to configure V with extra CFLAGS and CXXFLAGS:

CFLAGS="-mips32 -mabi=32" CXXFLAGS="-mips32 -mabi=32"
or for mips64/n64
CFLAGS="-mips64 -mabi=64" CXXFLAGS="-mips64 -mabi=64"

If you are using 32bit system on 64bit hardware and you want to configure V for mips64/n64 you should add:
CFLAGS="-mabi=64" CXXFLAGS="-mabi=64"
just to be sure that you are using right ABI and not n32.
Comment 2 Vicente Olivert Riera 2014-02-25 10:18:38 UTC
(In reply to comment #1)
> For what are you trying to compile Valgrind?

I want to test it before adding support for it in BuildRoot distribution for MIPS architecture.

> Currently Valgrind for mips is supporting only
> mips32/o32 ABI and mips64/n64 ABI. If you are trying to compile V for
> mips32/o32 you can try to configure V with extra CFLAGS and CXXFLAGS:
> 
> CFLAGS="-mips32 -mabi=32" CXXFLAGS="-mips32 -mabi=32"
> or for mips64/n64
> CFLAGS="-mips64 -mabi=64" CXXFLAGS="-mips64 -mabi=64"
> 
> If you are using 32bit system on 64bit hardware and you want to configure V
> for mips64/n64 you should add:
> CFLAGS="-mabi=64" CXXFLAGS="-mabi=64"
> just to be sure that you are using right ABI and not n32.

I have tried to do the following compilations (all of them with the right FLAGS and ABI):

mips32   : OK
mips32r2 : OK
mips32el : OK
mips32el : OK

mips64     o32 : FAIL
mips64r2   o32 : FAIL
mips64el   o32 : FAIL
mips64r2el o32 : FAIL

mips64     n32 : OK
mips64r2   n32 : OK
mips64el   n32 : OK
mips64r2el n32 : OK

mips64     n64 : OK
mips64r2   n64 : OK
mips64el   n64 : OK
mips64r2el n64 : OK
Comment 3 Petar Jovanovic 2014-02-25 10:55:32 UTC
(In reply to comment #2)
> (In reply to comment #1)
> mips64     o32 : FAIL
> mips64r2   o32 : FAIL
> mips64el   o32 : FAIL
> mips64r2el o32 : FAIL

Can you share how you configure Valgrind in these cases?
Comment 4 Vicente Olivert Riera 2014-02-25 15:52:00 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > mips64     o32 : FAIL
> > mips64r2   o32 : FAIL
> > mips64el   o32 : FAIL
> > mips64r2el o32 : FAIL
> 
> Can you share how you configure Valgrind in these cases?

Here you have the first case, MIPS64 BigEndian o32 ABI. If you also want the other ones, I can share them too, but I think only one should be enough because the failure is always the same.

This is how valgrind is configured (extracted from config.log):

$ ./configure --target=mips64-buildroot-linux-gnu --host=mips64-buildroot-linux-gnu --build=x86_64-unknown-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --program-prefix= --disable-gtk-doc --disable-doc --disable-do     cs --disable-documentation --with-xmlto=no --with-fop=no --enable-ipv6 --enable-static --enable-shared --disable-tls

And this is the information of the mips64-buiildroot-linux-gnu toolchain:

$ ./output/host/usr/mips64-buildroot-linux-gnu/bin/gcc -v
Using built-in specs.
COLLECT_GCC=./output/host/usr/mips64-buildroot-linux-gnu/bin/gcc
Target: mips64-buildroot-linux-gnu
Configured with: ./configure --prefix=/home/test/buildroot/output/host/usr --sysconfdir=/home/test/buildroot/output/host/etc --enable-shared --enable-static --target=mips64-buildroot-linux-gnu --with-sysroot=/home/test/buildroot/output/host/usr/mips64-buildroot-linux-gnu/sysroot --disable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --with-gmp=/home/test/buildroot/output/host/usr --with-mpfr=/home/test/buildroot/output/host/usr --enable-target-optspace --disable-libquadmath --enable-tls --disable-libmudflap --enable-threads --with-mpc=/home/test/buildroot/output/host/usr --with-float=soft --disable-decimal-float --with-arch=mips64 --with-abi=32 --with-pkgversion='Buildroot 2014.02-rc3-00015-g70831d0-dirty' --with-bugurl=http://bugs.buildroot.net/ --enable-languages=c,c++ --with-build-time-tools=/home/test/buildroot/output/host/usr/mips64-buildroot-linux-gnu/bin --disable-libgomp
Thread model: posix
gcc version 4.7.3 (Buildroot 2014.02-rc3-00015-g70831d0-dirty) 

As you can see in that output, the toolchain generates code for MIPS64 BigEndian o32 ABI:
--with-arch=mips64 : MIPS64 BigEndian
--with-abi=32 : o32 ABI
Comment 5 Petar Jovanovic 2014-02-25 18:07:52 UTC
What is the meaning of -march=mips64 with -mabi=32?
What are you trying to achieve here?
Comment 6 Vicente Olivert Riera 2014-02-26 10:07:53 UTC
(In reply to comment #5)
> What is the meaning of -march=mips64 with -mabi=32?

MIPS has three main ABIs:
o32 (32-bit integer and pointer)
N32 (64-bit integer, 32-bit pointer)
N64 (64-bit integer and pointer)

You can use a MIPS 32-bit processor with the o32 ABI.
You can use a MIPS 64-bit processor with the o32, n32 and n64 ABIs.

> What are you trying to achieve here?

Nothing, but the combination of MIPS64 with o32 ABI is possible, so that's why I have opened this bug.
Comment 7 Petar Jovanovic 2014-02-26 11:26:53 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > What is the meaning of -march=mips64 with -mabi=32?
> 
> MIPS has three main ABIs:
> o32 (32-bit integer and pointer)
> N32 (64-bit integer, 32-bit pointer)
> N64 (64-bit integer and pointer)
> 
> You can use a MIPS 32-bit processor with the o32 ABI.
> You can use a MIPS 64-bit processor with the o32, n32 and n64 ABIs.
> 
> > What are you trying to achieve here?
> 
> Nothing, but the combination of MIPS64 with o32 ABI is possible, so that's
> why I have opened this bug.

Compiling code for mips64 with o32 ABI is not a regular case, at least
not that I am aware of.
Bear in mind that there is a difference between 1. mips64 code and
2. mips32 o32 code being executed on mips64 board.
Comment 8 Vicente Olivert Riera 2014-02-26 11:31:33 UTC
(In reply to comment #7)
> Compiling code for mips64 with o32 ABI is not a regular case, at least
> not that I am aware of.

Yes, is not a regular case, but it is a case :)

> Bear in mind that there is a difference between 1. mips64 code and
> 2. mips32 o32 code being executed on mips64 board.

Yes, but..., what's your point with that? I think is not related with the problem we are talking here.
Comment 9 Petar Jovanovic 2014-02-26 11:40:00 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > Compiling code for mips64 with o32 ABI is not a regular case, at least
> > not that I am aware of.
> 
> Yes, is not a regular case, but it is a case :)
> 
It's an irregular case nobody should try.

> > Bear in mind that there is a difference between 1. mips64 code and
> > 2. mips32 o32 code being executed on mips64 board.
> 
> Yes, but..., what's your point with that? I think is not related with the
> problem we are talking here.

My point is that - from what I understand from this bug report so far -
is that you are trying to compile mips64 o32 version of Valgring, which
is an irregular meaningless case that no one would benefit from.
Thus, it would be wrong to fix it.
Comment 10 Vicente Olivert Riera 2014-02-26 15:57:38 UTC
(In reply to comment #9)
> My point is that - from what I understand from this bug report so far -
> is that you are trying to compile mips64 o32 version of Valgring, which
> is an irregular meaningless case that no one would benefit from.
> Thus, it would be wrong to fix it.

So there won't be support for MIPS64 o32 in Valgrind, right?
Comment 11 Petar Jovanovic 2014-02-26 16:10:06 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > My point is that - from what I understand from this bug report so far -
> > is that you are trying to compile mips64 o32 version of Valgring, which
> > is an irregular meaningless case that no one would benefit from.
> > Thus, it would be wrong to fix it.
> 
> So there won't be support for MIPS64 o32 in Valgrind, right?

> So there won't be support for MIPS64 o32 in Valgrind, right?

I am not aware there is any program in use anywhere that is MIPS64 + o32.
So, no, we do not plan to do it for Valgrind.
Comment 12 Vicente Olivert Riera 2014-02-26 16:57:35 UTC
(In reply to comment #11)
> I am not aware there is any program in use anywhere that is MIPS64 + o32.
> So, no, we do not plan to do it for Valgrind.

Ok, maybe it doesn't have sense to make Valgrind compile on MIPS64 o32. But..., will Valgrind be able to handle o32 applications running on MIPS64?
Comment 13 Petar Jovanovic 2014-02-26 17:41:46 UTC
(In reply to comment #12)
> (In reply to comment #11)
> > I am not aware there is any program in use anywhere that is MIPS64 + o32.
> > So, no, we do not plan to do it for Valgrind.
> 
> Ok, maybe it doesn't have sense to make Valgrind compile on MIPS64 o32.
> But..., will Valgrind be able to handle o32 applications running on MIPS64?

Yes, this is already the case.
Comment 14 Vicente Olivert Riera 2014-02-27 09:53:52 UTC
(In reply to comment #13)
> Yes, this is already the case.

Then I guess this bug can be closed :-)