blob: 003cfbc8d89cd7ce7ea9d7a7b9a5147bc7af58e9 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 3e1d00481093e10775eaf69d619c45b32a4aa7dc Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= <martin@geanix.com>
3Date: Tue, 6 Nov 2018 14:50:47 +0100
4Subject: [PATCH] buildinfo: strip sysroot and debug-prefix-map from compiler
5 info
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10The openssl build system generates buildinf.h containing the full
11compiler command line used to compile objects. This breaks
12reproducibility, as the compile command is baked into libcrypto, where
13it is used when running `openssl version -f`.
14
15Add stripped build variables for the compiler and cflags lines, and use
16those when generating buildinfo.h.
17
18This is based on a similar patch for older openssl versions:
19https://patchwork.openembedded.org/patch/147229/
20
21Upstream-Status: Inappropriate [OE specific]
22Signed-off-by: Martin HundebΓΈll <martin@geanix.com>
Brad Bishop19323692019-04-05 15:28:33 -040023
24
25Update to fix buildpaths qa issue for '-fmacro-prefix-map'.
26
27Signed-off-by: Kai Kang <kai.kang@windriver.com>
Andrew Geisslerc926e172021-05-07 16:11:35 -050028
29Update to fix buildpaths qa issue for '-ffile-prefix-map'.
30
31Signed-off-by: Khem Raj <raj.khem@gmail.com>
32
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080033---
34 Configurations/unix-Makefile.tmpl | 10 +++++++++-
35 crypto/build.info | 2 +-
36 2 files changed, 10 insertions(+), 2 deletions(-)
37
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080038--- a/Configurations/unix-Makefile.tmpl
39+++ b/Configurations/unix-Makefile.tmpl
Andrew Geisslerc926e172021-05-07 16:11:35 -050040@@ -420,13 +420,23 @@ BIN_LDFLAGS={- join(' ', $target{bin_lfl
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080041 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
42 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
43
44-# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
45+# *_Q variables are used for one thing only: to build up buildinf.h
46 CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
47 $cppflags2 =~ s|([\\"])|\\$1|g;
48 $lib_cppflags =~ s|([\\"])|\\$1|g;
49 join(' ', $lib_cppflags || (), $cppflags2 || (),
50 $cppflags1 || ()) -}
51
52+CFLAGS_Q={- for (@{$config{CFLAGS}}) {
53+ s|-fdebug-prefix-map=[^ ]+|-fdebug-prefix-map=|g;
Brad Bishop19323692019-04-05 15:28:33 -040054+ s|-fmacro-prefix-map=[^ ]+|-fmacro-prefix-map=|g;
Andrew Geisslerc926e172021-05-07 16:11:35 -050055+ s|-ffile-prefix-map=[^ ]+|-ffile-prefix-map=|g;
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080056+ }
57+ join(' ', @{$config{CFLAGS}}) -}
58+
59+CC_Q={- $config{CC} =~ s|--sysroot=[^ ]+|--sysroot=recipe-sysroot|g;
60+ join(' ', $config{CC}) -}
61+
62 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
63
64 # For x86 assembler: Set PROCESSOR to 386 if you want to support
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080065--- a/crypto/build.info
66+++ b/crypto/build.info
Andrew Geisslerc926e172021-05-07 16:11:35 -050067@@ -10,7 +10,7 @@ EXTRA= ../ms/uplink-x86.pl ../ms/uplink
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080068 ppccpuid.pl pariscid.pl alphacpuid.pl arm64cpuid.pl armv4cpuid.pl
69
70 DEPEND[cversion.o]=buildinf.h
71-GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(LIB_CFLAGS) $(CPPFLAGS_Q)" "$(PLATFORM)"
72+GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC_Q) $(CFLAGS_Q) $(CPPFLAGS_Q)" "$(PLATFORM)"
73 DEPEND[buildinf.h]=../configdata.pm
74
75 GENERATE[uplink-x86.s]=../ms/uplink-x86.pl $(PERLASM_SCHEME)