How define absolute local symbol by GNU as?

Oleksandr Gavenko gavenko@bifit.com.ua
Fri Jul 8 20:28:00 GMT 2011


On 08.07.2011 11:47, Oleksandr Gavenko wrote:
> On 07.07.2011 19:29, Andreas Schwab wrote:
>> Works for me.
>>
>> $ echo a=1 | as
>> $ nm
>> 00000001 a a
>>
> I try on Linux and FreeBSD host and get similar result (GOOD).
>
> But with Cygwin:
>
> /usr/bin/as
> /usr/bin/i686-pc-mingw32-as.exe
> /usr/bin/i686-w64-mingw32-as.exe
>
> with version:
>
> GNU assembler (GNU Binutils) 2.20.51.20100410
> GNU assembler (GNU Binutils) 2.21
> GNU assembler (GNU Binutils) 2.21.51.20110605
>
> $ echo a=1 | i686-pc-mingw32-as
> $ nm
> 00000000 b .bss
> 00000000 d .data
> 00000000 t .text
>
> I can not get same result. So this can be related to COFF format?
>
> --keep-locals also have no effect.
I try another approach:

   $ gcc -c  -o test.o -Wa,"-defsym,my=1" test.c
   $ objdump -t test.o
[  2](sec -1)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x00000001 my

To get same result I try write .s file:

   .def my; .scl 3; .endef

then I get:

   $ as -o test.o test.s; objdump -t test.o; nm test.o
[  8](sec  0)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 my
          U my


Note: scl is 2, not 3!! With:

   .def my; .scl 3; .val 1; .endef


   $ as -o test.o test.s; objdump -t test.o; nm test.o
2.s: Assembler messages:
2.s:14: Internal error!
Assertion failure in coff_frob_symbol at 
/netrel/src/binutils-2.20.51-2/gas/config/obj-coff.c line 1335.
Please report this bug.



More information about the Binutils mailing list