On 24 April 2007 15:50, Dave Korn wrote: > On 24 April 2007 15:34, Ian Lance Taylor wrote:
>> It looks like this comes from an inappropriate call to >> assemble_external. You should find out what is calling that for _ffs. Heh, surely you mean "You should find out what is calling that, ffs"! ;-) > Thanks, I will take a look. Didn't take long, and seems to show immediately what the problem is: Continuing. Breakpoint 2, assemble_external (decl=0x7ff08a40) at /tools/external_source/gnu/gcc-3.3.3/gcc/varasm.c:1712 (gdb) bt #0 assemble_external (decl=0x7ff08a40) at /tools/external_source/gnu/gcc-3.3.3/gcc/varasm.c:1712 #1 0x00417828 in build_external_ref (id=0x7ff32800, fun=1) at /tools/external_source/gnu/gcc-3.3.3/gcc/c-typeck.c:1453 #2 0x00405f24 in yyparse () at c-parse.y:615 #3 0x0040b699 in c_common_parse_file (set_yydebug=0) at /tools/external_source/gnu/gcc-3.3.3/gcc/c-lex.c:159 #4 0x00449808 in toplev_main (argc=5, argv=0xd38ca8) at /tools/external_source/gnu/gcc-3.3.3/gcc/toplev.c:2142 #5 0x0044437a in main (argc=5, argv=0xd38ca8) at /tools/external_source/gnu/gcc-3.3.3/gcc/main.c:35 (gdb) call debug_tree (decl) <function_decl 0x7ff08a40 __builtin_ffs type <function_type 0x7ff06510 type <integer_type 0x7ff003f0 int SI size <integer_cst 0x7fee0288 constant 32> unit size <integer_cst 0x7fee0330 constant 4> align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0x7fee0300 -2147483648> max <integer_cst 0x7fee0318 2147483647> pointer_to_this <pointer_type 0x7ff057f0>> DI size <integer_cst 0x7fee06a8 constant 64> unit size <integer_cst 0x7fee0900 constant 8> align 32 symtab 0 alias set -1 arg-types <tree_list 0x7fee1f08 value <integer_type 0x7ff003f0 int> chain <tree_list 0x7fee1c80 value <void_type 0x7ff017a0 void>>>> readonly nothrow public external built-in SI file <built-in> line 0 built-in BUILT_IN_NORMAL:BUILT_IN_FFS attributes <tree_list 0x7fee30c0> (mem:SI (symbol_ref:SI ("ffs")) [0 S4 A32]) chain <function_decl 0x7ff089d0 bcmp>> Looking at the comments: 1700 /* Output something to declare an external symbol to the assembler. 1701 (Most assemblers don't need this, so we normally output nothing.) 1702 Do nothing if DECL is not external. */ 1703 1704 void 1705 assemble_external (decl) 1706 tree decl ATTRIBUTE_UNUSED; - 1707 { 1708 /* Because most platforms do not define ASM_OUTPUT_EXTERNAL, the 1709 main body of this code is only rarely exercised. To provide some 1710 testing, on all platforms, we make sure that the ASM_OUT_FILE is 1711 open. If it's not, we should not be calling this function. */ and the internals manual: `ASM_OUTPUT_EXTERNAL (STREAM, DECL, NAME)' A C statement (sans semicolon) to output to the stdio stream STREAM any text necessary for declaring the name of an external symbol named NAME which is referenced in this compilation but not defined. The value of DECL is the tree node for the declaration. This macro need not be defined if it does not need to output anything. The GNU assembler and most Unix assemblers don't require anything. I'd say that I've inherited a thinko-fied version of ASM_OUTPUT_EXTERNAL that is emitting a .global directive when it should be emitting a .extern (or, as the Fine Manual says, just not bothering at all since I'm using GAS). Thanks for the well-tuned hint! cheers, DaveK -- Can't think of a witty .sigline today....