"Dave Korn" <[EMAIL PROTECTED]> writes: > Although I'm seeing this on 3.3.3, it appears to be determined by the > backend, so I think it's still reasonable to ask: > > I have some code that calls __builtin_ffs, but entirely on compile-time > constants. When I compile it (using an inhouse custom ELF-target backend) > with -O2, it gets totally optimised away, but the compiler still emits an > undefined symbol reference to the library ffs() function: > > ---------------------------------<snip!>--------------------------------- > /tmp $ ${libexecdir}/3.3.3/cc1.exe -O2 - -o - > > int foo () > { > return __builtin_ffs (32); > } > > .file "<stdin>" > foo .global _ffs
Is this really a reference? It just looks like a declaration. A typical ELF assembler will not generate an undefined symbol merely because it sees a .global pseudo-op. It looks like this comes from an inappropriate call to assemble_external. You should find out what is calling that for _ffs. Ian