[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210127061752.120083-1-jim.cromie@gmail.com>
Date: Tue, 26 Jan 2021 23:17:52 -0700
From: Jim Cromie <jim.cromie@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Jim Cromie <jim.cromie@...il.com>, Arnd Bergmann <arnd@...db.de>,
linux-arch@...r.kernel.org
Subject: [PATCH 19/20] dyndbg: try conditional linker expression in KEEP - RFC
This is the last patch in v3 of patchest Ive sent previously:
v2: https://lore.kernel.org/lkml/?q=Cromie+v2+00%2F19+2020-12-25+-Re
It isolates my only issue now, Id appreciate advice, and dont want to
distract you with the 18 previous commits.
Im trying to use ? : inside a KEEP(*(expression)) to only include
A_header when A has content.
IE:
KEEP(*( A ? A_header : ))
It fails with inscrutable linker error.
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
ld:./arch/x86/kernel/vmlinux.lds:46: syntax error
Is this possible by other modes of expression ?
I tried inserting {} 1st, that failed, appearing to foreclose any
foreach-like construct. I also tried () around each term, and a
preceding, embedded "_loc=.;" statement to test the parser.
I didnt try doing this with 2 separate KEEPs; while it would be
simple, it defeats the adjacency guaranteed by *(.text .rdata), which
is the point of this.
If this were to be possible, it opens up interesting options to
statically construct table headers, and possibly even tree structures
in the linker script. Id use it to add 1 header for each module, and
strip a column out of the table.
Ive pulled binutils to take a look at the source; having never done
anything bison-ish, I anticipate a long study without some focused
primer knowledge.
Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
include/asm-generic/vmlinux.lds.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 87868c5a980a..6198cc850f9b 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -329,10 +329,10 @@
#define DYNAMIC_DEBUG_DATA() \
. = ALIGN(8); \
__start___dyndbg_sites = .; \
- KEEP(*(__dyndbg_sites .gnu.linkonce.*.dyndbg_site)) \
+ KEEP(*(__dyndbg_sites ? .gnu.linkonce.*.dyndbg_site : )) \
__stop___dyndbg_sites = .; \
__start___dyndbg = .; \
- KEEP(*(__dyndbg .gnu.linkonce.*.dyndbg)) \
+ KEEP(*(__dyndbg ? .gnu.linkonce.*.dyndbg : )) \
__stop___dyndbg = .;
#else
#define DYNAMIC_DEBUG_DATA()
--
2.29.2
Powered by blists - more mailing lists