Re: .version keeps being updated

From: Olaf Hering
Date: Wed Jan 10 2007 - 15:03:49 EST


On Wed, Jan 10, Olaf Hering wrote:

> On Wed, Jan 10, Linus Torvalds wrote:
>
> > Grr.
>
> It did work for me for some reason, but I was wondering why it did work.

with such a change, it will always be first. Tested on powerpc.
I could even add an ELF parser and look for the first bytes in the
.rodata section.

diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9fcc8d9..2050d8e 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -11,6 +11,11 @@ #define ALIGN_FUNCTION() . = ALIGN(8)

#define RODATA \
. = ALIGN(4096); \
+ \
+ .rodata.uts : AT(ADDR(.data.uts) - LOAD_OFFSET) { \
+ *(.data.uts) \
+ } \
+ \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start_rodata) = .; \
*(.rodata) *(.rodata.*) \
diff --git a/init/version.c b/init/version.c
index 9d96d36..03f5916 100644
--- a/init/version.c
+++ b/init/version.c
@@ -19,6 +19,8 @@ #define version_string(a) version(a)

int version_string(LINUX_VERSION_CODE);

+const char __attribute__ ((__section__ (".rodata.uts"))) get_kernel_version[] = "fiXme Linux version " UTS_RELEASE;
+
struct uts_namespace init_uts_ns = {
.kref = {
.refcount = ATOMIC_INIT(2),
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/