On 24 April 2007 15:34, Ian Lance Taylor wrote:
> "Dave Korn" 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 could well be an assembler issue then, but yes, it certainly ends up as a
type 'U' symbol in the output object. (I was fooled by that seeming label
'foo' at the start of the .global line; in fact, that's an artefact of
outputting to the console, it comes from stderr not stdout.)
> It looks like this comes from an inappropriate call to
> assemble_external. You should find out what is calling that for _ffs.
Thanks, I will take a look.
cheers,
DaveK
--
Can't think of a witty .sigline today....