From: Jim Cromie <jim.cromie@gmail.com>
To: linux-kernel@vger.kernel.org, jbaron@akamai.com,
gregkh@linuxfoundation.org
Cc: Jim Cromie <jim.cromie@gmail.com>
Subject: [PATCH 1/1] vmlinux.lds.h: improve BOUNDED_SECTION macros
Date: Fri, 11 Nov 2022 16:53:41 -0700 [thread overview]
Message-ID: <20221111235341.567987-1-jim.cromie@gmail.com> (raw)
1- replace _s_ & _e_ with the more visibly obvious _BEGIN_ & _END_.
2- add a new _HDR_ linker symbol before the KEEP(*(.gnu.linkonce.##_sec_)).
This gives the optional header record an extern'd name/address,
which is "_hdr_", b4/after the _sec_/_label_.
3- move existing _BEGIN_ linker symbol after the KEEP.
This insures the extern'd name always points at the data,
independent of whether a header has been defined.
NOTE: if (start - hdr) { /* section has a header record */ }
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
include/asm-generic/vmlinux.lds.h | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index cfad4511cd68..c9b204b0364c 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -199,20 +199,22 @@
# endif
#endif
-#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _s_, _e_) \
- _s_##_label_ = .; \
+#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \
+ _HDR_##_label_ = .; \
KEEP(*(.gnu.linkonce.##_sec_)) \
+ _BEGIN_##_label_ = .; \
KEEP(*(_sec_)) \
- _e_##_label_ = .;
+ _END_##_label_ = .;
-#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _s_, _e_) \
- _label_##_s_ = .; \
+#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \
+ _label_##_HDR_ = .; \
KEEP(*(.gnu.linkonce.##_sec_)) \
+ _label_##_BEGIN_ = .; \
KEEP(*(_sec_)) \
- _label_##_e_ = .;
+ _label_##_END_ = .;
#define BOUNDED_SECTION_BY(_sec_, _label_) \
- BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop)
+ BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop, _hdr_)
#define BOUNDED_SECTION(_sec) BOUNDED_SECTION_BY(_sec, _sec)
--
2.38.1
next reply other threads:[~2022-11-11 23:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-11 23:53 Jim Cromie [this message]
2022-11-11 23:58 ` jim.cromie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221111235341.567987-1-jim.cromie@gmail.com \
--to=jim.cromie@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jbaron@akamai.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®