From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: Jerin Jacob <jerinj@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
david.marchand@redhat.com, thomas@monjalon.net,
Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH v2] eal: provide macro to allocate and name a section or segment
Date: Mon, 12 Feb 2024 12:51:46 -0800 [thread overview]
Message-ID: <1707771106-29545-1-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1698878822-17099-1-git-send-email-roretzla@linux.microsoft.com>
Provide __rte_section(name) macro that allocates and names a section
or segment that works with both MSVC and GCC.
Update RTE_TRACE_POINT_REGISTER with __rte_section("__rte_trace_point")
instead of __attribute__(section(name)) so the macro may be compatibly
expanded when using MSVC.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
v2:
* Define an internal macro __rte_section for the trace point
allocation and use it in RTE_TRACE_POINT_REGISTER instead of
duplicating original macro expansion for MSVC.
lib/eal/include/rte_common.h | 11 +++++++++++
lib/eal/include/rte_trace_point_register.h | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index c1ba32d..612f87b 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -178,6 +178,17 @@
#endif
/**
+ * specify data or function section/segment
+ */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_section(name) \
+ __pragma(data_seg(name)) __declspec(allocate(name))
+#else
+#define __rte_section(name) \
+ __attribute__((section(name)))
+#endif
+
+/**
* Tells compiler that the function returns a value that points to
* memory, where the size is given by the one or two arguments.
* Used by compiler to validate object size.
diff --git a/lib/eal/include/rte_trace_point_register.h b/lib/eal/include/rte_trace_point_register.h
index a9682d3..41260e5 100644
--- a/lib/eal/include/rte_trace_point_register.h
+++ b/lib/eal/include/rte_trace_point_register.h
@@ -19,7 +19,7 @@
RTE_DECLARE_PER_LCORE(volatile int, trace_point_sz);
#define RTE_TRACE_POINT_REGISTER(trace, name) \
-rte_trace_point_t __attribute__((section("__rte_trace_point"))) __##trace; \
+rte_trace_point_t __rte_section("__rte_trace_point") __##trace; \
static const char __##trace##_name[] = RTE_STR(name); \
RTE_INIT(trace##_init) \
{ \
--
1.8.3.1
next prev parent reply other threads:[~2024-02-12 20:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-01 22:47 [PATCH] eal: provide trace point register macro for MSVC Tyler Retzlaff
2023-11-06 16:40 ` Thomas Monjalon
2023-11-06 17:30 ` Tyler Retzlaff
2023-11-12 12:04 ` Thomas Monjalon
2024-02-12 20:51 ` Tyler Retzlaff [this message]
2024-02-13 8:51 ` [PATCH v2] eal: provide macro to allocate and name a section or segment Morten Brørup
2024-02-13 11:28 ` Thomas Monjalon
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=1707771106-29545-1-git-send-email-roretzla@linux.microsoft.com \
--to=roretzla@linux.microsoft.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=skori@marvell.com \
--cc=thomas@monjalon.net \
/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;
as well as URLs for NNTP newsgroup(s).