[PATCH v6 48/57] dyndbg: add .gnu.linkonce slot in vmlinux.lds.h KEEPs

Jim Cromie jim.cromie at gmail.com
Sun Sep 4 21:41:25 UTC 2022


Add linker symbols and KEEPs for .gnu.linkonce.dyndbg and
.gnu.linkonce.dyndbg_sites sections, placing them in front of their
respective dyndbg and dyndbg_sites sections.

This placement gives us a known relative offset (ie -1) from the start
of the vector to the header, letting us use container_of to get it.
The _index added previously allows determining &descs[0] from any
desc[N].

The .gnu.linkonce. collapses possible multiple declarations into a
single allocation, with a single address.

todo: will need similar for modules.lds.h

Signed-off-by: Jim Cromie <jim.cromie at gmail.com>
---
 include/asm-generic/vmlinux.lds.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 1e7ee65e8591..20fdea9efd78 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -348,9 +348,13 @@
 	__start___dyndbg_classes = .;					\
 	KEEP(*(__dyndbg_classes))					\
 	__stop___dyndbg_classes = .;					\
+	__dyndbg_header = .;						\
+	KEEP(*(.gnu.linkonce.dyndbg))					\
 	__start___dyndbg = .;						\
 	KEEP(*(__dyndbg))						\
 	__stop___dyndbg = .;						\
+	__dyndbg_site_header = .;					\
+	KEEP(*(.gnu.linkonce.dyndbg_sites))				\
 	__start___dyndbg_sites = .;					\
 	KEEP(*(__dyndbg_sites))						\
 	__stop___dyndbg_sites = .;					\
-- 
2.37.2



More information about the amd-gfx mailing list