Showing results for 
Search instead for 
Did you mean: 
Valued Contributor III

Assembler 'gas' bugs?



I'd compiled the library 'glib' and experienced a strange phenomenon. The attached file 'garray.s' is the assembly one that is generated from 'garray.c' of 'glib-2.24.2'. When I assembled it, the relocation date for 'R_NIOS2_PCREL_LO' inside the function 'g_ptr_array_new' became 


00001390 00003817 R_NIOS2_CALL16 00000000 memset + 0 000013d4 0000351b R_NIOS2_PCREL_HA 00000000 _GLOBAL_OFFSET_TABLE_ + 0 000013d8 0000351a R_NIOS2_PCREL_LO 00000000 _GLOBAL_OFFSET_TABLE_ + 20 <--- 000013e4 00005317 R_NIOS2_CALL16 00001404 g_ptr_array_sized_new + 0 . Of course the right relocation data must be 


00001390 00003417 R_NIOS2_CALL16 00000000 memset + 0 000013d4 0000311b R_NIOS2_PCREL_HA 00000000 _GLOBAL_OFFSET_TABLE_ + 0 000013d8 0000311a R_NIOS2_PCREL_LO 00000000 _GLOBAL_OFFSET_TABLE_ + 4 <--- 000013e4 00004f17 R_NIOS2_CALL16 00001404 g_ptr_array_sized_new + 0


I think this is a bug of 'gas' itself and not one of Nios ported part. Inside the 'gas', 'obstack chunk' is used to store the location data, but something is wrong to allocate a new chunk. The easiest and negative way to avoid this is only to increase the chunk size which is defined in the file 'as.c'. Please refer the attached 'diff' for the details.  


0 Kudos