public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* dwarf_nextcu can't handle abbrev offset correctly ?
@ 2022-12-01 15:34 Hengqi Chen
  2022-12-01 15:54 ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Hengqi Chen @ 2022-12-01 15:34 UTC (permalink / raw)
  To: elfutils-devel

Hi,

I am using pahole (which relies on libelf) to process an elf file ([0]):

    LLVM_OBJCOPY="objcopy" pahole -J --btf_gen_floats --btf_base vmlinux adl_pci9111.ko

This failed with:

    die__process: DW_TAG_compile_unit, DW_TAG_type_unit, DW_TAG_partial_unit or DW_TAG_skeleton_unit expected got member (0xd)!

The .ko contains two CU, readelf says that the abbrev offsets are at 0 and 0x907,
but dwarf_nextcu reports that abbrev offsets are both at 0.

pahole expects to find DW_TAG_compile_unit, but seams that the wrong abbrev offset causes the failure.


  [0]: https://gitlab.com/chenhengqi/loong-debug


--
Hengqi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dwarf_nextcu can't handle abbrev offset correctly ?
  2022-12-01 15:34 dwarf_nextcu can't handle abbrev offset correctly ? Hengqi Chen
@ 2022-12-01 15:54 ` Mark Wielaard
  2022-12-02  2:03   ` Hengqi Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2022-12-01 15:54 UTC (permalink / raw)
  To: Hengqi Chen, elfutils-devel

Hi Hengqi,

On Thu, 2022-12-01 at 23:34 +0800, Hengqi Chen via Elfutils-devel
wrote:
> I am using pahole (which relies on libelf) to process an elf file
> ([0]):
> 
>     LLVM_OBJCOPY="objcopy" pahole -J --btf_gen_floats --btf_base
> vmlinux adl_pci9111.ko
> 
> This failed with:
> 
>     die__process: DW_TAG_compile_unit, DW_TAG_type_unit,
> DW_TAG_partial_unit or DW_TAG_skeleton_unit expected got member
> (0xd)!
> 
> The .ko contains two CU, readelf says that the abbrev offsets are at
> 0 and 0x907,
> but dwarf_nextcu reports that abbrev offsets are both at 0.
> 
> pahole expects to find DW_TAG_compile_unit, but seams that the wrong
> abbrev offset causes the failure.
> 
> 
>   [0]: https://gitlab.com/chenhengqi/loong-debug

I took a quick look at the adl_pci9111.ko there. And the issue is that
elfutils doesn't know how to handle the relocations for LoongArch yet.

Specifically the backend should implement the reloc_simple_type hook.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dwarf_nextcu can't handle abbrev offset correctly ?
  2022-12-01 15:54 ` Mark Wielaard
@ 2022-12-02  2:03   ` Hengqi Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Hengqi Chen @ 2022-12-02  2:03 UTC (permalink / raw)
  To: Mark Wielaard, elfutils-devel

Hi Mark,

On 2022/12/1 23:54, Mark Wielaard wrote:
> Hi Hengqi,
> 
> On Thu, 2022-12-01 at 23:34 +0800, Hengqi Chen via Elfutils-devel
> wrote:
>> I am using pahole (which relies on libelf) to process an elf file
>> ([0]):
>>
>>     LLVM_OBJCOPY="objcopy" pahole -J --btf_gen_floats --btf_base
>> vmlinux adl_pci9111.ko
>>
>> This failed with:
>>
>>     die__process: DW_TAG_compile_unit, DW_TAG_type_unit,
>> DW_TAG_partial_unit or DW_TAG_skeleton_unit expected got member
>> (0xd)!
>>
>> The .ko contains two CU, readelf says that the abbrev offsets are at
>> 0 and 0x907,
>> but dwarf_nextcu reports that abbrev offsets are both at 0.
>>
>> pahole expects to find DW_TAG_compile_unit, but seams that the wrong
>> abbrev offset causes the failure.
>>
>>
>>   [0]: https://gitlab.com/chenhengqi/loong-debug
> 
> I took a quick look at the adl_pci9111.ko there. And the issue is that
> elfutils doesn't know how to handle the relocations for LoongArch yet.
> 
> Specifically the backend should implement the reloc_simple_type hook.
> 
> Cheers,
> 
> Mark

That's great. Thanks for the pointer. Will try to implement it.


Cheers,
---
Hengqi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-02  2:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01 15:34 dwarf_nextcu can't handle abbrev offset correctly ? Hengqi Chen
2022-12-01 15:54 ` Mark Wielaard
2022-12-02  2:03   ` Hengqi Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).