1From 5985253f2c9025d7c127443a3a9938946f80c2a1 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> 23 24Update to fix buildpaths qa issue for '-fmacro-prefix-map'. 25 26Signed-off-by: Kai Kang <kai.kang@windriver.com> 27 28Update to fix buildpaths qa issue for '-ffile-prefix-map'. 29 30Signed-off-by: Khem Raj <raj.khem@gmail.com> 31 32--- 33 Configurations/unix-Makefile.tmpl | 16 +++++++++++++++- 34 crypto/build.info | 2 +- 35 2 files changed, 16 insertions(+), 2 deletions(-) 36 37diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl 38index 09303c4..011bda1 100644 39--- a/Configurations/unix-Makefile.tmpl 40+++ b/Configurations/unix-Makefile.tmpl 41@@ -502,13 +502,27 @@ BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (), 42 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 43 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) 44 45-# CPPFLAGS_Q is used for one thing only: to build up buildinf.h 46+# *_Q variables are used for one thing only: to build up buildinf.h 47 CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g; 48+ $cppflags1 =~ s|-isystem/[^ ]+/usr/include||g; 49 $cppflags2 =~ s|([\\"])|\\$1|g; 50+ $cppflags2 =~ s|-isystem/[^ ]+/usr/include||g; 51 $lib_cppflags =~ s|([\\"])|\\$1|g; 52+ $lib_cppflags =~ s|-isystem/[^ ]+/usr/include||g; 53 join(' ', $lib_cppflags || (), $cppflags2 || (), 54 $cppflags1 || ()) -} 55 56+CFLAGS_Q={- for (@{$config{CFLAGS}}) { 57+ s|-fdebug-prefix-map=[^ ]+|-fdebug-prefix-map=|g; 58+ s|-fmacro-prefix-map=[^ ]+|-fmacro-prefix-map=|g; 59+ s|-ffile-prefix-map=[^ ]+|-ffile-prefix-map=|g; 60+ s|-isystem/[^ ]+/usr/include ||g; 61+ } 62+ join(' ', @{$config{CFLAGS}}) -} 63+ 64+CC_Q={- $config{CC} =~ s|--sysroot=[^ ]+|--sysroot=recipe-sysroot|g; 65+ join(' ', $config{CC}) -} 66+ 67 PERLASM_SCHEME= {- $target{perlasm_scheme} -} 68 69 # For x86 assembler: Set PROCESSOR to 386 if you want to support 70diff --git a/crypto/build.info b/crypto/build.info 71index aee5c46..95c9577 100644 72--- a/crypto/build.info 73+++ b/crypto/build.info 74@@ -115,7 +115,7 @@ DEFINE[../libcrypto]=$UPLINKDEF 75 76 DEPEND[info.o]=buildinf.h 77 DEPEND[cversion.o]=buildinf.h 78-GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(LIB_CFLAGS) $(CPPFLAGS_Q)" "$(PLATFORM)" 79+GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC_Q) $(CFLAGS_Q) $(CPPFLAGS_Q)" "$(PLATFORM)" 80 81 GENERATE[uplink-x86.S]=../ms/uplink-x86.pl 82 GENERATE[uplink-x86_64.s]=../ms/uplink-x86_64.pl 83