* [PATCH 7/7] Use --build-id ld option
@ 2007-07-11 19:05 Roland McGrath
2007-07-12 4:48 ` Jeremy Fitzhardinge
0 siblings, 1 reply; 6+ messages in thread
From: Roland McGrath @ 2007-07-11 19:05 UTC (permalink / raw)
To: Andrew Morton, Linus Torvalds; +Cc: linux-kernel
This change passes the --build-id when linking the kernel and when
linking modules, if ld supports it. This is a new GNU ld option that
synthesizes an ELF note section inside the read-only data. The note in
this section contains unique identifying bits called the "build ID",
which are generated so as to be different for any two linked ELF files
that aren't identical. The build ID can be recovered from stripped
files, memory dumps, etc. and used to look up the original program
built, locate debuginfo or other details or history associated with it.
For normal program linking, the compiler passes --build-id to ld by
default, but the option is needed when using ld directly as we do.
Signed-off-by: Roland McGrath <roland@redhat.com>
---
Makefile | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index 88b2252..1e11ceb 100644
--- a/Makefile
+++ b/Makefile
@@ -514,6 +514,12 @@ CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
# disable pointer signed / unsigned warnings in gcc 4.0
CFLAGS += $(call cc-option,-Wno-pointer-sign,)
+# Use --build-id when available.
+LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
+ $(call ld-option, -Wl$(comma)--build-id,))
+LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
+LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
+
# Default kernel image to build when no specific target is given.
# KBUILD_IMAGE may be overruled on the command line or
# set in the environment
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 7/7] Use --build-id ld option
2007-07-11 19:05 [PATCH 7/7] Use --build-id ld option Roland McGrath
@ 2007-07-12 4:48 ` Jeremy Fitzhardinge
2007-07-12 6:24 ` Roland McGrath
0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Fitzhardinge @ 2007-07-12 4:48 UTC (permalink / raw)
To: Roland McGrath; +Cc: Andrew Morton, Linus Torvalds, linux-kernel
Roland McGrath wrote:
> This change passes the --build-id when linking the kernel and when
> linking modules, if ld supports it. This is a new GNU ld option that
> synthesizes an ELF note section inside the read-only data. The note in
> this section contains unique identifying bits called the "build ID",
> which are generated so as to be different for any two linked ELF files
> that aren't identical.
Does this mean that performing the same link twice *will* produce an
identical result?
J
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 7/7] Use --build-id ld option
2007-07-12 4:48 ` Jeremy Fitzhardinge
@ 2007-07-12 6:24 ` Roland McGrath
2007-07-14 1:23 ` Adrian Bunk
0 siblings, 1 reply; 6+ messages in thread
From: Roland McGrath @ 2007-07-12 6:24 UTC (permalink / raw)
To: Jeremy Fitzhardinge; +Cc: Andrew Morton, Linus Torvalds, linux-kernel
> Does this mean that performing the same link twice *will* produce an
> identical result?
Yes.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 7/7] Use --build-id ld option
2007-07-12 6:24 ` Roland McGrath
@ 2007-07-14 1:23 ` Adrian Bunk
2007-07-14 1:26 ` Jeremy Fitzhardinge
0 siblings, 1 reply; 6+ messages in thread
From: Adrian Bunk @ 2007-07-14 1:23 UTC (permalink / raw)
To: Roland McGrath
Cc: Jeremy Fitzhardinge, Andrew Morton, Linus Torvalds, linux-kernel
On Wed, Jul 11, 2007 at 11:24:58PM -0700, Roland McGrath wrote:
> > Does this mean that performing the same link twice *will* produce an
> > identical result?
>
> Yes.
But note that twice compiling a kernel with the same .config will result
in a different one.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 7/7] Use --build-id ld option
2007-07-14 1:23 ` Adrian Bunk
@ 2007-07-14 1:26 ` Jeremy Fitzhardinge
2007-07-14 1:36 ` Adrian Bunk
0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Fitzhardinge @ 2007-07-14 1:26 UTC (permalink / raw)
To: Adrian Bunk; +Cc: Roland McGrath, Andrew Morton, Linus Torvalds, linux-kernel
Adrian Bunk wrote:
> But note that twice compiling a kernel with the same .config will result
> in a different one.
Is that true even if you reset the .version counter each time? I'm
thinking of product build systems, in which they value being able to
reproduce the same build (ideally, bit for bit).
J
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 7/7] Use --build-id ld option
2007-07-14 1:26 ` Jeremy Fitzhardinge
@ 2007-07-14 1:36 ` Adrian Bunk
0 siblings, 0 replies; 6+ messages in thread
From: Adrian Bunk @ 2007-07-14 1:36 UTC (permalink / raw)
To: Jeremy Fitzhardinge
Cc: Roland McGrath, Andrew Morton, Linus Torvalds, linux-kernel
On Fri, Jul 13, 2007 at 06:26:35PM -0700, Jeremy Fitzhardinge wrote:
> Adrian Bunk wrote:
>> But note that twice compiling a kernel with the same .config will result
>> in a different one.
>
> Is that true even if you reset the .version counter each time? I'm
> thinking of product build systems, in which they value being able to
> reproduce the same build (ideally, bit for bit).
$ grep UTS_VERSION include/linux/compile.h
#define UTS_VERSION "#3 Sat Jul 14 03:21:18 CEST 2007"
$
> J
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-07-14 1:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-11 19:05 [PATCH 7/7] Use --build-id ld option Roland McGrath
2007-07-12 4:48 ` Jeremy Fitzhardinge
2007-07-12 6:24 ` Roland McGrath
2007-07-14 1:23 ` Adrian Bunk
2007-07-14 1:26 ` Jeremy Fitzhardinge
2007-07-14 1:36 ` Adrian Bunk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox