Index: dev/binutils/2.44/Makefile
===================================================================
--- dev/binutils/2.44/Makefile (revision 427)
+++ dev/binutils/2.44/Makefile (revision 428)
@@ -61,11 +61,14 @@
SOURCE_REQUIRES = sources/GNU/binutils
REQUIRES = libs/zlib/1.3.1
+REQUIRES += libs/zstd/1.5.6
ifneq ($(filter $(TOOLCHAIN),$(TOOLCHAIN_POWER8_GLIBC) $(TOOLCHAIN_POWER9_GLIBC)),)
REQUIRES += libs/zlib/1.3.1-ppc32
+REQUIRES += libs/zstd/1.5.6-ppc32
endif
ifneq ($(filter $(TOOLCHAIN),$(TOOLCHAIN_X86_64_GLIBC)),)
REQUIRES += libs/zlib/1.3.1-x86_32
+REQUIRES += libs/zstd/1.5.6-x86_32
endif
# ======= __END_OF_REQUIRES__ =======
@@ -143,7 +146,10 @@
extra_configure_switches += --sysconfdir=/etc
extra_configure_switches += --enable-shared
-extra_configure_switches += --disable-compressed-debug-sections
+extra_configure_switches += --enable-compressed-debug-sections=all
+extra_configure_switches += --enable-default-compressed-debug-sections-algorithm=zlib,zstd
+extra_configure_switches += --with-system-zlib
+extra_configure_switches += --with-zstd
# NOTE:
# --enable-threads, --enable-plugins - are GOLD related options
@@ -570,6 +576,7 @@
TARGET_BIN_RPATH = /lib$(LIBSUFFIX):/usr/lib$(LIBSUFFIX)
+TARGET_LIB_RPATH = /lib$(LIBSUFFIX):/usr/lib$(LIBSUFFIX):/usr/lib/../lib$(LIBSUFFIX)
####### Dependencies
@@ -587,7 +594,7 @@
$(TOOLCHAIN_POWER9LE_GLIBC)),)
# ======= On ppc64 and aarch64, we might use 64KiB pages =======
@( cd $(SRC_DIR) ; \
- sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*ppc.c ; \
+ sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$$/0x10000/' bfd/elf*ppc.c ; \
)
endif
@touch $@
@@ -651,10 +658,16 @@
# ======= remove target destination path from target libtool *.la files =======
@( cd $(BINUTILS_DEV_PKG)/usr/lib$(LIBSUFFIX) ; \
sed -i "s,$(TARGET_DEST_DIR),,g" libbfd.la libctf-nobfd.la libctf.la libopcodes.la libsframe.la ; \
+ if [ "x" != "x`find -iname 'libgprofng*' -exec echo '{}' \; -quit`" ] ; then \
+ sed -i "s,$(TARGET_DEST_DIR),,g" libgprofng.la ; \
+ fi ; \
)
# ======= remove target destination path from target libtool *.la files =======
@( cd $(BINUTILS_DEV_PKG)/usr/lib$(LIBSUFFIX) ; \
sed -i "s, -L$(CURDIR)/$(build_dir)/zlib,,g" libbfd.la libctf-nobfd.la libctf.la libopcodes.la ; \
+ if [ "x" != "x`find -iname 'libgprofng*' -exec echo '{}' \; -quit`" ] ; then \
+ sed -i "s, -L$(CURDIR)/$(build_dir)/zlib,,g" libgprofng.la ; \
+ fi ; \
)
# ======= remove (-L/usr/lib$(LIBSUFFIX) already set) libiberty.a search path in libtool *.la files too =======
@( cd $(BINUTILS_DEV_PKG)/usr/lib$(LIBSUFFIX) ; \
@@ -661,9 +674,22 @@
sed -i "s,-L$(CURDIR)/$(build_dir)/bfd/../libiberty/pic,,g" libbfd.la libctf-nobfd.la libctf.la libopcodes.la ; \
sed -i "s,-L$(CURDIR)/$(build_dir)/libctf/../libiberty/pic,,g" libbfd.la libctf-nobfd.la libctf.la libopcodes.la ; \
sed -i "s,-L$(CURDIR)/$(build_dir)/opcodes/../libiberty/pic,,g" libbfd.la libctf-nobfd.la libctf.la libopcodes.la ; \
+ if [ "x" != "x`find -iname 'libgprofng*' -exec echo '{}' \; -quit`" ] ; then \
+ sed -i "s,-L$(CURDIR)/$(build_dir)/bfd/../libiberty/pic,,g" libgprofng.la ; \
+ sed -i "s,-L$(CURDIR)/$(build_dir)/libctf/../libiberty/pic,,g" libgprofng.la ; \
+ sed -i "s,-L$(CURDIR)/$(build_dir)/opcodes/../libiberty/pic,,g" libgprofng.la ; \
+ fi ; \
sed -i "s,-L$(CURDIR)/$(build_dir)/bfd/../libiberty,,g" libbfd.la libctf-nobfd.la libctf.la libopcodes.la ; \
sed -i "s,-L$(CURDIR)/$(build_dir)/libctf/../libiberty,,g" libbfd.la libctf-nobfd.la libctf.la libopcodes.la ; \
sed -i "s,-L$(CURDIR)/$(build_dir)/opcodes/../libiberty,,g" libbfd.la libctf-nobfd.la libctf.la libopcodes.la ; \
+ if [ "x" != "x`find -iname 'libgprofng*' -exec echo '{}' \; -quit`" ] ; then \
+ sed -i "s,-L$(CURDIR)/$(build_dir)/bfd/../libiberty,,g" libgprofng.la ; \
+ sed -i "s,-L$(CURDIR)/$(build_dir)/libctf/../libiberty,,g" libgprofng.la ; \
+ sed -i "s,-L$(CURDIR)/$(build_dir)/opcodes/../libiberty,,g" libgprofng.la ; \
+ fi ; \
+ if [ "x" != "x`find -iname 'libgprofng*' -exec echo '{}' \; -quit`" ] ; then \
+ sed -i "s,-L$(CURDIR)/$(build_dir)/libiberty/pic,,g" libgprofng.la ; \
+ fi ; \
)
@if [ -r $(BINUTILS_DEV_PKG)/usr/bin/$(DEFAULT_LD) ] ; then \
( cd $(BINUTILS_DEV_PKG)/usr/bin ; rm -f ld ; ln -sf $(DEFAULT_LD) ld ) \
@@ -672,7 +698,7 @@
@( cd $(BINUTILS_DEV_PKG)/usr/$(TARGET) ; \
rm -rf lib ; \
ln -s ../lib$(LIBSUFFIX) . ; \
- for FILE in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib readelf strip ; do \
+ for FILE in ar as ld ld.bfd nm objcopy objdump ranlib readelf strip ; do \
if [ -r ../bin/$$FILE ]; then \
rm -f bin/$$FILE ; \
ln -s ../../bin/$$FILE bin/$$FILE ; \
@@ -705,6 +731,10 @@
@( cd $(TARGET_DEST_DIR)/usr/lib$(LIBSUFFIX) ; \
sed -i "s,/usr,$(TARGET_DEST_DIR)/usr,g" libbfd.la libctf-nobfd.la libctf.la libopcodes.la libsframe.la ; \
sed -i "s,L/lib,L$(TARGET_DEST_DIR)/lib,g" libbfd.la libctf-nobfd.la libctf.la libopcodes.la libsframe.la ; \
+ if [ "x" != "x`find -iname 'libgprofng*' -exec echo '{}' \; -quit`" ] ; then \
+ sed -i "s,/usr,$(TARGET_DEST_DIR)/usr,g" libgprofng.la ; \
+ sed -i "s,L/lib,L$(TARGET_DEST_DIR)/lib,g" libgprofng.la ; \
+ fi ; \
)
# ======= Strip binaries =======
@( cd $(BINUTILS_DEV_PKG) ; \
@@ -712,6 +742,26 @@
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs $(STRIP) --strip-unneeded 2> /dev/null ; \
find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs $(STRIP) -g 2> /dev/null \
)
+ifneq ($(PATCHELF),)
+ # ======= Set RPATH/RUNPATH for target binaries =======
+ @( cd $(BINUTILS_DEV_PKG)/usr/bin ; \
+ for file in `find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs echo` ; do \
+ rpath=`$(PATCHELF) --print-rpath $$file 2> /dev/null` ; \
+ if echo "$$rpath" | grep -q "$(TARGET_DEST_DIR)" ; then \
+ $(PATCHELF) --set-rpath $(TARGET_BIN_RPATH) $$file 1> /dev/null 2> /dev/null ; \
+ fi ; \
+ done ; \
+ )
+ # ======= Set RPATH/RUNPATH for target shared objects =======
+ @( cd $(BINUTILS_DEV_PKG)/usr/lib$(LIBSUFFIX) ; \
+ for file in `find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs echo` ; do \
+ rpath=`$(PATCHELF) --print-rpath $$file 2> /dev/null` ; \
+ if echo "$$rpath" | grep -q "$(TARGET_DEST_DIR)" ; then \
+ $(PATCHELF) --set-rpath $(TARGET_LIB_RPATH) $$file 1> /dev/null 2> /dev/null ; \
+ fi ; \
+ done ; \
+ )
+endif
@touch $@
$(BINUTILS_DEV_PKG_DESCRIPTION_FILE): $(BINUTILS_DEV_PKG_DESCRIPTION_FILE_IN)