Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Douglas Royds <douglas.royds@taitradio.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] glibc: Fix non-IA reproducibility for shared libraries
Date: Wed,  3 Oct 2018 17:26:53 +1300	[thread overview]
Message-ID: <20181003042653.4264-1-douglas.royds@taitradio.com> (raw)
In-Reply-To: <2f47bda4-deb2-9603-a151-8330f0d52e08@taitradio.com>

Compute a relative path to build-arm-tait-linux-gnueabi/csu/
for each library subdirectory.

Signed-off-by: Douglas Royds <douglas.royds@taitradio.com>
---
 meta/conf/bitbake.conf                        |  2 +-
 ...34-reproducible-makehack-shared-libs.patch | 48 +++++++++++++++++++
 meta/recipes-core/glibc/glibc_2.28.bb         |  1 +
 3 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-core/glibc/glibc/0034-reproducible-makehack-shared-libs.patch

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 93aee1ae46..6c0b3c239f 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -482,7 +482,7 @@ HOSTTOOLS += " \
     fgrep file find flock g++ gawk gcc getconf getopt git grep gunzip gzip \
     head hostname id install ld ldd ln ls make makeinfo md5sum mkdir mknod \
     mktemp mv nm objcopy objdump od patch perl pod2man pr printf pwd python python2 \
-    python2.7 python3 ranlib readelf readlink rm rmdir rpcgen sed sh sha256sum \
+    python2.7 python3 ranlib readelf readlink realpath rm rmdir rpcgen sed sh sha256sum \
     sleep sort split stat strings strip tail tar tee test touch tr true uname \
     uniq wc wget which xargs \
 "
diff --git a/meta/recipes-core/glibc/glibc/0034-reproducible-makehack-shared-libs.patch b/meta/recipes-core/glibc/glibc/0034-reproducible-makehack-shared-libs.patch
new file mode 100644
index 0000000000..11902be523
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0034-reproducible-makehack-shared-libs.patch
@@ -0,0 +1,48 @@
+diff --git a/Makerules b/Makerules
+index a10a0b4d70..cacddb8784 100644
+--- a/Makerules
++++ b/Makerules
+@@ -606,10 +606,11 @@ lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(link-libc-deps)
+ 	$(build-shlib) $(link-libc-args)
+ 	$(call after-link,$@)
+ 
++csu-objpfx-relative = $(shell realpath --relative-to=`pwd` $(csu-objpfx))/
+ define build-shlib-helper
+ $(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \
+ 	  $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(rtld-LDFLAGS) \
+-	  $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
++	  $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx-relative) \
+ 	  $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
+ 	  -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
+ 	  $(LDFLAGS.so) $(LDFLAGS-lib.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
+@@ -662,13 +663,13 @@ endif
+ 
+ define build-shlib
+ $(build-shlib-helper) -o $@ $(shlib-lds-flags) \
+-	  $(csu-objpfx)abi-note.o $(build-shlib-objlist)
++	  $(csu-objpfx-relative)abi-note.o $(build-shlib-objlist)
+ endef
+ 
+ define build-module-helper
+ $(LINK.o) -shared -static-libgcc $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
+ 	  $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) \
+-	  -B$(csu-objpfx) $(load-map-file) \
++	  -B$(csu-objpfx-relative) $(load-map-file) \
+ 	  $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
+ 	  -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
+ endef
+@@ -679,12 +680,12 @@ endef
+ # not for shared objects
+ define build-module
+ $(build-module-helper) -o $@ $(shlib-lds-flags) \
+-	  $(csu-objpfx)abi-note.o $(build-module-objlist) $(link-libc-args)
++	  $(csu-objpfx-relative)abi-note.o $(build-module-objlist) $(link-libc-args)
+ $(call after-link,$@)
+ endef
+ define build-module-asneeded
+ $(build-module-helper) -o $@ $(shlib-lds-flags) \
+-	  $(csu-objpfx)abi-note.o \
++	  $(csu-objpfx-relative)abi-note.o \
+ 	  -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed \
+ 	  $(link-libc-args)
+ $(call after-link,$@)
diff --git a/meta/recipes-core/glibc/glibc_2.28.bb b/meta/recipes-core/glibc/glibc_2.28.bb
index 804b7891ec..5508be13f7 100644
--- a/meta/recipes-core/glibc/glibc_2.28.bb
+++ b/meta/recipes-core/glibc/glibc_2.28.bb
@@ -48,6 +48,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch \
            file://0032-soft-fp-ignore-maybe-uninitialized.patch \
            file://0001-Linux-gethostid-Check-for-NULL-value-from-gethostbyn.patch \
+           file://0034-reproducible-makehack-shared-libs.patch \
 "
 
 NATIVESDKFIXES ?= ""
-- 
2.17.1



  parent reply	other threads:[~2018-10-03  4:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27  0:18 glibc binary reproducibility Douglas Royds
2018-09-27  0:54 ` Douglas Royds
2018-09-27  8:37 ` Richard Purdie
2018-10-02 16:58 ` Richard Purdie
2018-10-03  2:37   ` Douglas Royds
2018-10-03  2:43     ` Douglas Royds
2018-10-03 11:25       ` Richard Purdie
2018-10-03 13:31         ` Khem Raj
2018-10-03 20:55         ` Douglas Royds
2018-10-03  4:26 ` Douglas Royds [this message]
2018-10-03  4:34 ` ✗ patchtest: failure for glibc: Fix non-IA reproducibility for shared libraries Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181003042653.4264-1-douglas.royds@taitradio.com \
    --to=douglas.royds@taitradio.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox