Re: [PATCH dwarves v1] btf_encoder: handle .BTF_ids section endianness when cross-compiling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2024-11-26 at 13:51 -0800, Andrii Nakryiko wrote:

[...]

> > When I tried 'data->d_type = ELF_T_WORD' + gelf_xlatetom() snippet
> > suggested by Tony Ambardar some time ago, I got a write protection error.
> > Concluded that this is so, because file is opened in O_RDONLY mode.
> 
> Ok, maybe don't follow my words *exactly*, just in spirit ;) I see
> there is elf_getdata_rawchunk() API in libelf, which seems useful:
> 
> /* Get data translated from a chunk of the file contents as section data
>    would be for TYPE.  The resulting Elf_Data pointer is valid until
>    elf_end (ELF) is called.  */
> extern Elf_Data *elf_getdata_rawchunk (Elf *__elf,
>                                        int64_t __offset, size_t __size,
>                                        Elf_Type __type);
> 
> I don't know the surrounding code, I was just hoping to leverage
> libelf's byte swapping support (which I think I learned from Tony as
> well). But if it's too inconvenient, so be it.

I missed this API, it works and makes the patch much smaller,
thank you for finding it.






[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux