Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 288980

Summary: sys-devel/gcc-4.3.4 -ffast-math option leads to undefined symbol
Product: Gentoo Linux Reporter: Hugo Mildenberger <Hugo.Mildenberger>
Component: HardenedAssignee: The Gentoo Linux Hardened Team <hardened>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Hugo Mildenberger 2009-10-14 01:06:32 UTC
Compiling mesa on hardened ~x86, configure bailed out stating that gcc could not produce executables. It turned out that any attempt to compile a program using the -ffast-math option leads to an undefined symbol error:

gcc -ffast-math test.c -o test
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/crtfastmath.o:(.ctors+0x0): undefined reference to `no symbol'
collect2: ld gab 1 als Ende-Status zurück


$ gcc -ffast-math test.c -o test.o -c
$ readelf -s test.o

Symbol table '.symtab' contains 14 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 FILE    LOCAL  DEFAULT  ABS test.c
     2: 00000000     0 SECTION LOCAL  DEFAULT    2
     3: 00000000     0 SECTION LOCAL  DEFAULT    4
     4: 00000000     0 SECTION LOCAL  DEFAULT    5
     5: 00000000     0 SECTION LOCAL  DEFAULT    6
     6: 00000000     0 SECTION LOCAL  DEFAULT    8
     7: 00000000     0 SECTION LOCAL  DEFAULT    9
     8: 00000000     0 SECTION LOCAL  DEFAULT    7
     9: 00000000     0 SECTION LOCAL  DEFAULT    1
    10: 00000000    58 FUNC    GLOBAL DEFAULT    2 main
    11: 00000000     0 FUNC    GLOBAL HIDDEN    8 __i686.get_pc_thunk.bx
    12: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND _GLOBAL_OFFSET_TABLE_
    13: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND puts

There shouldn't be any FP-operation in test.c:

include <stdio.h>
int main()
{
        printf("hello world\n");
        return 0;
}

Linking -lm explictly doesn't help. The generated assembly and object files are identical, with and without-ffast-math, while only the link without -ffast-math succeeds. I use sys-devel/binutils-2.19-r1.
Comment 1 Hugo Mildenberger 2009-10-14 01:27:50 UTC

*** This bug has been marked as a duplicate of bug 288977 ***