I am using the toolchain: mips-4.3-51-mips-linux-gnu-i686-pc-linux-gnu.tar.bz2 When I go to compile valgrind using this toolchain, when it enters the drd directory, it stops compiling on the file drd_clientreq.c Reproducible: Always Steps to Reproduce: 1. Configure valgrind: # CFLAGS="-mips32r2" \ ./configure --host=mipsel-linux-uclibc --prefix=/usr --enable-only32bit 2. Run Make # make Actual Results: make[3]: Entering directory `/root/mips/valgrind/valgrind-3.9.0/drd' Making all in . make[4]: Entering directory `/root/mips/valgrind/valgrind-3.9.0/drd' mipsel-linux-uclibc-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../VEX/pub -DVGA_mips32=1 -DVGO_linux=1 -DVGP_mips32_linux=1 -DVGPV_mips32_linux_vanilla=1 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -mips32 --param inline-unit-growth=900 -O2 -Wextra -Wformat-nonliteral -Wno-inline -Wno-unused-parameter -Wno-long-long -mips32r2 -Wwrite-strings -fno-stack-protector -MT drd_mips32_linux-drd_barrier.o -MD -MP -MF .deps/drd_mips32_linux-drd_barrier.Tpo -c -o drd_mips32_linux-drd_barrier.o `test -f 'drd_barrier.c' || echo './'`drd_barrier.c mv -f .deps/drd_mips32_linux-drd_barrier.Tpo .deps/drd_mips32_linux-drd_barrier.Po mipsel-linux-uclibc-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../VEX/pub -DVGA_mips32=1 -DVGO_linux=1 -DVGP_mips32_linux=1 -DVGPV_mips32_linux_vanilla=1 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -mips32 --param inline-unit-growth=900 -O2 -Wextra -Wformat-nonliteral -Wno-inline -Wno-unused-parameter -Wno-long-long -mips32r2 -Wwrite-strings -fno-stack-protector -MT drd_mips32_linux-drd_clientobj.o -MD -MP -MF .deps/drd_mips32_linux-drd_clientobj.Tpo -c -o drd_mips32_linux-drd_clientobj.o `test -f 'drd_clientobj.c' || echo './'`drd_clientobj.c mv -f .deps/drd_mips32_linux-drd_clientobj.Tpo .deps/drd_mips32_linux-drd_clientobj.Po mipsel-linux-uclibc-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../VEX/pub -DVGA_mips32=1 -DVGO_linux=1 -DVGP_mips32_linux=1 -DVGPV_mips32_linux_vanilla=1 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -mips32 --param inline-unit-growth=900 -O2 -Wextra -Wformat-nonliteral -Wno-inline -Wno-unused-parameter -Wno-long-long -mips32r2 -Wwrite-strings -fno-stack-protector -MT drd_mips32_linux-drd_clientreq.o -MD -MP -MF .deps/drd_mips32_linux-drd_clientreq.Tpo -c -o drd_mips32_linux-drd_clientreq.o `test -f 'drd_clientreq.c' || echo './'`drd_clientreq.c drd_clientreq.c:79: warning: 'optimize' attribute directive ignored Expected Results: It should continue compiling The toolchain I am using is precompiled. You can download it from here: http://www.codesourcery.com/sgpp/lite/mips/portal/package3545/public/mips-linux-gnu/mips-4.3-51-mips-linux-gnu.src.tar.bz2 Running on Ubuntu 10.04.3 32-bit with 512 MB of ram.
Hi, try to change optimization level in drd/Makefile form O2 into O1 and it works fine.
I did notice, it also is settings the -O option twice. Even though it sets it to -O2, so when it's told to set it to -O1 in the code, since there is 2 of them, it can't. I will try it with setting it to -O1.
*** Bug 327155 has been marked as a duplicate of this bug. ***
Created attachment 83628 [details] changes Makefile.am and Makefile.in in drd directory to use -O1 instead of -O2
The attached patch will reduce performance on x86 and amd64 systems. The changes in drd/Makefile.am should be such that the optimization level is changed for the MIPS platform only.
Well since Makefile.in is generated by Makefile.am, then only Makefile.am only needs to be patched. But why is -O2 set twice in Makefile.am then? I think that's why it can't compile that one file. The warning says it can't change it: drd_clientreq.c:79: warning: 'optimize' attribute directive ignored And so it then hangs.
Created attachment 83643 [details] optimzation level set in drd directory Makefile.am is set to -O1 since Makefile.in is removed and recreated I now remove all Makefile.in files so that they are recreated
Latest patch I uploaded now just is applied against Makefile.am because I remove all Makefile.in and run ./autogen.sh
That second patch also changes the optimization level for all architectures instead of only for MIPS and hence is not acceptable - sorry. Have you considered to lower the optimization level only for the function(s) that causes the compiler to hang, e.g. by inserting code like the following above each function that causes the compiler to hang ? #if defined(VGP_mips32_linux) || defined(VGP_mips64_linux) /* Avoid that this function triggers a bug in the MIPS compiler that causes gcc to hang. */ __attribute__((optimize("O1"))) #endif
That has already been added to drd_clientreq.c as you can see and is part of the release of valgrind. And when it attempts to do that, generates this warning where it doesn't lower it: drd_clientreq.c:79: warning: 'optimize' attribute directive ignored
(In reply to comment #10) > That has already been added to drd_clientreq.c as you can see and is part of > the release of valgrind. And when it attempts to do that, generates this > warning where it doesn't lower it: > > drd_clientreq.c:79: warning: 'optimize' attribute directive ignored Can you try to use any recent version of GCC? Working around issues in old versions of compilers may be endless job.
I can't change the toolchain I'm using because the system I'm using only supports that version. It is precompiled for me already.
(In reply to comment #12) > I can't change the toolchain I'm using because the system I'm using only > supports that version. It is precompiled for me already. I understand. Still, I do not think we should be putting workarounds in Valgrind for the issues with pre 4.5 GCC toolchains unless there is a really good reason to do it. Are you fine with having a local patch applied to Valgrind?
Yes I'm fine with that. Thank you.