Comment 8 for bug 432222

Revision history for this message
David Hedberg (david-hedberg) wrote : Re: boot fails, mountall likely culprit

Yes, maybe it is a compiler issue. I tried to write a small test case that isolates the problem, and I think that I have succeeded. It needs to be (like mountall) compiled with both -fPIE and -Os to actually show the problem, so my guess is that something important is being optimized away.

This is the output from the "problematic system":
david@ibook:~$ uname -a
Linux ibook 2.6.31-10-powerpc #34-Ubuntu Tue Sep 15 23:53:36 UTC 2009 ppc GNU/Linux
david@ibook:~$ gcc --version | head -n1
gcc (Ubuntu 4.4.1-4ubuntu1) 4.4.1
david@ibook:~$ gcc -fPIE -Os test.c -o gcc-test && ./gcc-test
a in extern_func: 123456789
a in intern_func: -1077763264

This is the output from an x86 system running debian, showing the "expected" output:
david@fww:~$ uname -a
Linux fww 2.6.26-2-686 #1 SMP Fri Aug 14 01:27:18 UTC 2009 i686 GNU/Linux
david@fww:~$ gcc --version | head -n 1
gcc (Debian 4.3.2-1.1) 4.3.2
david@fww:~$ gcc -fPIE -Os test.c -o gcc-test && ./gcc-test
a in extern_func: 123456789
a in intern_func: 123456789

As you can see the compilers aren't exactly comparable, but nevertheless it seems to point at a real problem with gcc.

Test app is attached. As said, this seems to happen only if the flags -fPIE and -Os are specified.