[PATCH] backends,bpf: add proper relocation support

2018-06-15 Thread Yonghong Song
Due to libdw does not have proper BPF relocation support, the pahole cannot display filenames correctly for objects with default llvm options. So we have to invent a special option "llc -march=bpf -mattr=dwarfris" to prevent llvm from generating cross-section dwarf relocation records (https://revie

Re: [PATCH] readelf: While printing .debug_loc make sure that next_off doesn't overflow.

2018-06-15 Thread Mark Wielaard
On Wed, Jun 13, 2018 at 03:24:45PM +0200, Mark Wielaard wrote: > Found by the afl fuzzer. The next offset (after a locview) comes from a > DIE loclist attribute. This could be a bogus value so large it overflows > the buffer and makes us print past the end of buffer. Pushed to master.

Re: [PATCH] readelf: Handle signedness of DW_FORM_implicit_const and DW_AT_const_value.

2018-06-15 Thread Mark Wielaard
On Wed, Jun 13, 2018 at 02:51:43PM +0200, Mark Wielaard wrote: > We only handles DW_FORM_sdata as a signed form, but DW_FORM_implicit_const > is also signed by default. For DW_AT_const_value we can do a little better. > GCC encodes some const_values with signed forms, even though the type > is unsi

[PATCH] libdw, readelf: Don't handle DW_FORM_data16 as expression block/location.

2018-06-15 Thread Mark Wielaard
Also found by afl-fuzz on the varlocs testcase. DW_FORM_data16 is constant from according to the DWARF5 spec. But since it is 128bits it isn't really representable as Dwarf_Word. So we treat it as block form. But we cannot treat it as an expression block. Make sure readelf prints it as a regular bl