Message ID | 20241014125703.2287936-5-ardb+git@google.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Use dot prefixes for section names | expand |
On Mon, Oct 14, 2024 at 5:57 AM Ard Biesheuvel <ardb+git@google.com> wrote: > > From: Ard Biesheuvel <ardb@kernel.org> > > Sections typically use leading dots in their names, and deviating from > this breaks some assumptions in the existing code, e.g., in strip_relocs > on x86, which filters out .rela.* and .rela__* sections. > > [65] alloc_tags PROGBITS 0000000000000000 03a57958 > 0000000000026340 0000000000000000 WA 0 0 8 > [66] .relaalloc_tags RELA 0000000000000000 08dbb868 > 0000000000044c40 0000000000000018 I 280 65 8 > > So use a leading dot for the alloc_tags sections. No issues with renaming the section but please note that I posted a patch [1] today that will have conflicts with this renaming. [1] https://lore.kernel.org/all/20241014203646.1952505-3-surenb@google.com/ > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org> > --- > include/asm-generic/codetag.lds.h | 2 +- > include/linux/alloc_tag.h | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/asm-generic/codetag.lds.h b/include/asm-generic/codetag.lds.h > index 64f536b80380..dcd18351ba2f 100644 > --- a/include/asm-generic/codetag.lds.h > +++ b/include/asm-generic/codetag.lds.h > @@ -5,7 +5,7 @@ > #define SECTION_WITH_BOUNDARIES(_name) \ > . = ALIGN(8); \ > __start_##_name = .; \ > - KEEP(*(_name)) \ > + KEEP(*(. ## _name)) \ > __stop_##_name = .; I think leaving the SECTION_WITH_BOUNDARIES() definition as is and changing its users to pass the name with the dot would be more explicit and more flexible. The only user today is CODETAG_SECTIONS() at [2], so I would add the dot in there instead. [2] https://elixir.bootlin.com/linux/v6.12-rc2/source/include/asm-generic/codetag.lds.h#L12 Thanks, Suren. > > #define CODETAG_SECTIONS() \ > diff --git a/include/linux/alloc_tag.h b/include/linux/alloc_tag.h > index 1f0a9ff23a2c..d45a8a582970 100644 > --- a/include/linux/alloc_tag.h > +++ b/include/linux/alloc_tag.h > @@ -76,7 +76,7 @@ DECLARE_PER_CPU(struct alloc_tag_counters, _shared_alloc_tag); > > #define DEFINE_ALLOC_TAG(_alloc_tag) \ > static struct alloc_tag _alloc_tag __used __aligned(8) \ > - __section("alloc_tags") = { \ > + __section(".alloc_tags") = { \ > .ct = CODE_TAG_INIT, \ > .counters = &_shared_alloc_tag }; > > @@ -85,7 +85,7 @@ DECLARE_PER_CPU(struct alloc_tag_counters, _shared_alloc_tag); > #define DEFINE_ALLOC_TAG(_alloc_tag) \ > static DEFINE_PER_CPU(struct alloc_tag_counters, _alloc_tag_cntr); \ > static struct alloc_tag _alloc_tag __used __aligned(8) \ > - __section("alloc_tags") = { \ > + __section(".alloc_tags") = { \ > .ct = CODE_TAG_INIT, \ > .counters = &_alloc_tag_cntr }; > > -- > 2.47.0.rc1.288.g06298d1525-goog >
diff --git a/include/asm-generic/codetag.lds.h b/include/asm-generic/codetag.lds.h index 64f536b80380..dcd18351ba2f 100644 --- a/include/asm-generic/codetag.lds.h +++ b/include/asm-generic/codetag.lds.h @@ -5,7 +5,7 @@ #define SECTION_WITH_BOUNDARIES(_name) \ . = ALIGN(8); \ __start_##_name = .; \ - KEEP(*(_name)) \ + KEEP(*(. ## _name)) \ __stop_##_name = .; #define CODETAG_SECTIONS() \ diff --git a/include/linux/alloc_tag.h b/include/linux/alloc_tag.h index 1f0a9ff23a2c..d45a8a582970 100644 --- a/include/linux/alloc_tag.h +++ b/include/linux/alloc_tag.h @@ -76,7 +76,7 @@ DECLARE_PER_CPU(struct alloc_tag_counters, _shared_alloc_tag); #define DEFINE_ALLOC_TAG(_alloc_tag) \ static struct alloc_tag _alloc_tag __used __aligned(8) \ - __section("alloc_tags") = { \ + __section(".alloc_tags") = { \ .ct = CODE_TAG_INIT, \ .counters = &_shared_alloc_tag }; @@ -85,7 +85,7 @@ DECLARE_PER_CPU(struct alloc_tag_counters, _shared_alloc_tag); #define DEFINE_ALLOC_TAG(_alloc_tag) \ static DEFINE_PER_CPU(struct alloc_tag_counters, _alloc_tag_cntr); \ static struct alloc_tag _alloc_tag __used __aligned(8) \ - __section("alloc_tags") = { \ + __section(".alloc_tags") = { \ .ct = CODE_TAG_INIT, \ .counters = &_alloc_tag_cntr };