lkml.org 
[lkml]   [2022]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] ARM: module: Add all unwind tables when load module
On Thu, Mar 31, 2022 at 05:09:09PM +0800, Chen Zhongjin wrote:
> for (s = sechdrs; s < sechdrs_end; s++) {
> const char *secname = secstrs + s->sh_name;
> + const Elf_Shdr *txt_sec = find_mod_section(hdr, sechdrs,
> + strcmp(".ARM.exidx", secname) ?
> + secname + strlen(".ARM.exidx") : ".text");

In addition to my comments on the above...

>
> - if (!(s->sh_flags & SHF_ALLOC))
> + if (!(s->sh_flags & SHF_ALLOC) ||
> + s->sh_type != ELF_SECTION_UNWIND)

Please align "s->sh_type" with the ! on the line above (don't use a tab
for this!)

> continue;
>
> - if (strcmp(".ARM.exidx.init.text", secname) == 0)
> - maps[ARM_SEC_INIT].unw_sec = s;
> - else if (strcmp(".ARM.exidx", secname) == 0)
> - maps[ARM_SEC_CORE].unw_sec = s;
> - else if (strcmp(".ARM.exidx.exit.text", secname) == 0)
> - maps[ARM_SEC_EXIT].unw_sec = s;
> - else if (strcmp(".ARM.exidx.text.unlikely", secname) == 0)
> - maps[ARM_SEC_UNLIKELY].unw_sec = s;
> - else if (strcmp(".ARM.exidx.text.hot", secname) == 0)
> - maps[ARM_SEC_HOT].unw_sec = s;
> - else if (strcmp(".init.text", secname) == 0)
> - maps[ARM_SEC_INIT].txt_sec = s;
> - else if (strcmp(".text", secname) == 0)
> - maps[ARM_SEC_CORE].txt_sec = s;
> - else if (strcmp(".exit.text", secname) == 0)
> - maps[ARM_SEC_EXIT].txt_sec = s;
> - else if (strcmp(".text.unlikely", secname) == 0)
> - maps[ARM_SEC_UNLIKELY].txt_sec = s;
> - else if (strcmp(".text.hot", secname) == 0)
> - maps[ARM_SEC_HOT].txt_sec = s;
> + if (txt_sec) {
> + struct unwind_table *table =
> + unwind_table_add(s->sh_addr,
> + s->sh_size,
> + txt_sec->sh_addr,
> + txt_sec->sh_size);

blank line here please.

> + list_add(&table->mod_list, &unwind_list->mod_list);

and here.

Otherwise, looks good. Thanks.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

\
 
 \ /
  Last update: 2022-03-31 12:38    [W:0.040 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site