On 5/1/17 8:03 PM, David Miller wrote:
From: Alexei Starovoitov <ast@xxxxxx> Date: Mon, 1 May 2017 19:49:21 -0700On 4/30/17 11:21 AM, David Miller wrote:built with: clang -O2 -target bpfel -g -c x.c -o x.o readelf can see it just fine: [davem@localhost binutils]$ ./readelf --debug-dump=loc ./xel.o Contents of the .debug_loc section: Offset Begin End Expression 00000000 0000000000000000 0000000000000010 (DW_OP_reg1 (r1)) 00000013 <End of list> 00000023 0000000000000010 0000000000000020 (DW_OP_constu: 590618314553; DW_OP_stack_value) 0000003d 0000000000000020 0000000000000030 (DW_OP_reg1 (r1)) 00000050 <End of list> But with big-endian: [davem@localhost binutils]$ ./readelf --debug-dump=loc ./xeb.o readelf: Warning: Invalid pointer size (0) in compunit header, using 4 instead readelf: Warning: Bogus end-of-siblings marker detected at offset 27 in .debug_info section readelf: Warning: Bogus end-of-siblings marker detected at offset 28 in .debug_info section readelf: Warning: DIE at offset 0x29 refers to abbreviation number 48 which does not exist readelf: Warning: Unable to load/parse the .debug_info section, so cannot interpret the .debug_loc section.yeah. clang emitted dwarf for big-endian is broken. This dwarf stuff is too complicated for normal human beings. The tight packing making debugging it quite painful.But doesn't the CLANG DWARF2 emission code look at the target endianness?
it certainly does and on bpf backend side I'm not doing anything special comparing to what other bi-endian architectures like ppc and mips are doing. Obviously I missed something.