[PATCH 1/2] codetag: Use dot prefix for section name

From: Ard Biesheuvel
Date: Mon Oct 14 2024 - 08:57:29 EST


From: Ard Biesheuvel <ardb@xxxxxxxxxx>

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.

Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
---
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 = .;

#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