0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. From 5985253f2c9025d7c127443a3a9938946f80c2a1 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= <martin@geanix.com>
  3. Date: Tue, 6 Nov 2018 14:50:47 +0100
  4. Subject: [PATCH] buildinfo: strip sysroot and debug-prefix-map from compiler
  5. info
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. The openssl build system generates buildinf.h containing the full
  10. compiler command line used to compile objects. This breaks
  11. reproducibility, as the compile command is baked into libcrypto, where
  12. it is used when running `openssl version -f`.
  13. Add stripped build variables for the compiler and cflags lines, and use
  14. those when generating buildinfo.h.
  15. This is based on a similar patch for older openssl versions:
  16. https://patchwork.openembedded.org/patch/147229/
  17. Upstream-Status: Inappropriate [OE specific]
  18. Signed-off-by: Martin Hundebøll <martin@geanix.com>
  19. Update to fix buildpaths qa issue for '-fmacro-prefix-map'.
  20. Signed-off-by: Kai Kang <kai.kang@windriver.com>
  21. Update to fix buildpaths qa issue for '-ffile-prefix-map'.
  22. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  23. ---
  24. Configurations/unix-Makefile.tmpl | 16 +++++++++++++++-
  25. crypto/build.info | 2 +-
  26. 2 files changed, 16 insertions(+), 2 deletions(-)
  27. diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
  28. index 09303c4..011bda1 100644
  29. --- a/Configurations/unix-Makefile.tmpl
  30. +++ b/Configurations/unix-Makefile.tmpl
  31. @@ -513,13 +513,27 @@ BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
  32. '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
  33. BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
  34. -# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
  35. +# *_Q variables are used for one thing only: to build up buildinf.h
  36. CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
  37. + $cppflags1 =~ s|-isystem/[^ ]+/usr/include||g;
  38. $cppflags2 =~ s|([\\"])|\\$1|g;
  39. + $cppflags2 =~ s|-isystem/[^ ]+/usr/include||g;
  40. $lib_cppflags =~ s|([\\"])|\\$1|g;
  41. + $lib_cppflags =~ s|-isystem/[^ ]+/usr/include||g;
  42. join(' ', $lib_cppflags || (), $cppflags2 || (),
  43. $cppflags1 || ()) -}
  44. +CFLAGS_Q={- for (@{$config{CFLAGS}}) {
  45. + s|-fdebug-prefix-map=[^ ]+|-fdebug-prefix-map=|g;
  46. + s|-fmacro-prefix-map=[^ ]+|-fmacro-prefix-map=|g;
  47. + s|-ffile-prefix-map=[^ ]+|-ffile-prefix-map=|g;
  48. + s|-isystem/[^ ]+/usr/include ||g;
  49. + }
  50. + join(' ', @{$config{CFLAGS}}) -}
  51. +
  52. +CC_Q={- $config{CC} =~ s|--sysroot=[^ ]+|--sysroot=recipe-sysroot|g;
  53. + join(' ', $config{CC}) -}
  54. +
  55. PERLASM_SCHEME= {- $target{perlasm_scheme} -}
  56. # For x86 assembler: Set PROCESSOR to 386 if you want to support
  57. diff --git a/crypto/build.info b/crypto/build.info
  58. index aee5c46..95c9577 100644
  59. --- a/crypto/build.info
  60. +++ b/crypto/build.info
  61. @@ -115,7 +115,7 @@ DEFINE[../libcrypto]=$UPLINKDEF
  62. DEPEND[info.o]=buildinf.h
  63. DEPEND[cversion.o]=buildinf.h
  64. -GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(LIB_CFLAGS) $(CPPFLAGS_Q)" "$(PLATFORM)"
  65. +GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC_Q) $(CFLAGS_Q) $(CPPFLAGS_Q)" "$(PLATFORM)"
  66. GENERATE[uplink-x86.S]=../ms/uplink-x86.pl
  67. GENERATE[uplink-x86_64.s]=../ms/uplink-x86_64.pl