On Wednesday 20. December 2017 14.46.12 James Cowgill wrote: > > There are probably two bugs here. Firstly, ld shouldn't trigger an > internal error when printing the error message...
Perhaps. I didn't know how to interpret that. > > Relocation section '.rel.text.startup' at offset 0x5398 contains 24 entries: > > Offset Info Type Sym.Value Sym. Name > > > > 00000000 00001f05 R_MIPS_HI16 00000000 _gp_disp > > 00000004 00001f06 R_MIPS_LO16 00000000 _gp_disp > > 00000014 0000240b R_MIPS_CALL16 00000000 l4re_util_cap_alloc > > 0000004c 00002509 R_MIPS_GOT16 00000000 l4re_global_env > > 00000058 00000409 R_MIPS_GOT16 00000000 .bss > > 0000005c 00002425 R_MIPS_JALR 00000000 l4re_util_cap_alloc > > 00000060 00000406 R_MIPS_LO16 00000000 .bss > > 00000074 00000406 R_MIPS_LO16 00000000 .bss > > 00000124 00000406 R_MIPS_LO16 00000000 .bss > > 000001e0 00000406 R_MIPS_LO16 00000000 .bss > > 000001f8 00000209 R_MIPS_GOT16 00000000 .text > > 00000200 00000409 R_MIPS_GOT16 00000000 .bss > > ... and this relocation section is corrupt. It is illegal to use a GOT16 > relocation without a LO16 relocation somewhere after it (as the ld error > says). Therefore the bug is in whatever created your main.o file (this > is likely to be another part of binutils though). I looked at other files of this nature - it is a specific example program that exhibits this problem, so I had a look at other examples - and they seem to have what you have described as being expected. For example: Relocation section '.rel.text.startup' at offset 0x6ab0 contains 47 entries: Offset Info Type Sym.Value Sym. Name 00000000 00002105 R_MIPS_HI16 00000000 _gp_disp 00000004 00002106 R_MIPS_LO16 00000000 _gp_disp 00000014 0000240b R_MIPS_CALL16 00000000 puts 00000010 00001609 R_MIPS_GOT16 00000000 $LC0 0000002c 00001606 R_MIPS_LO16 00000000 $LC0 0000005c 00002509 R_MIPS_GOT16 00000000 l4re_global_env 00000070 00002425 R_MIPS_JALR 00000000 puts 00000088 00001309 R_MIPS_GOT16 00000018 $LC1 00000094 00001306 R_MIPS_LO16 00000018 $LC1 00000090 00000209 R_MIPS_GOT16 00000000 .text 00000098 00000206 R_MIPS_LO16 00000000 .text > It would be useful to have a reduced .c file which can reproduce this > bug and then decide if its a bug in gcc or binutils. The offending program is this one: https://svn.l4re.org/repos/oc/l4re/trunk/l4/pkg/examples/sys/utcb-ipc/main.c However, this is more for general reference given that it is something that gets built in a specific way and has plenty of its own baggage. I shall try and follow up with the L4Re people to see if they have any insights. Thanks for taking a look! Paul