build: Switch to SHA1 build IDs

Currently, you have to build the relocatable package tarball with
./reloc/build_reloc.sh to be able to build an RPM out of it. You need to
do this because RPMS require SHA1 build-ids, but the build system does
not enforce that.

To prepare for adding RPM target to the ninja build, let's switch to
SHA1 build ID conditionally, because the performance difference between
xxhash and SHA1 is neglible. Rafael Avila de Espindola writes:

  [...] the sha1 implementation in current lld is pretty fast. Linking
  release scylla the times I get are

  lld in fedora
    fast 2.83739
    sha1 3.51990

  current lld
    fast 2.6936
    sha1 2.90250

  And the sha1 implementation might get even faster:

  https://bugs.llvm.org/show_bug.cgi?id=44138.
Message-Id: <20200303131806.22422-1-penberg@scylladb.com>
This commit is contained in:
Pekka Enberg
2020-03-03 15:18:06 +02:00
committed by Nadav Har'El
parent 82b76163e3
commit 325c3e13eb
2 changed files with 7 additions and 8 deletions

View File

@@ -1144,6 +1144,12 @@ extra_cxxflags["release.cc"] = "-DSCYLLA_VERSION=\"\\\"" + scylla_version + "\\\
for m in ['debug', 'release', 'sanitize']:
modes[m]['cxxflags'] += ' ' + dbgflag
# The default build-id used by lld is xxhash, which is 8 bytes long, but RPM
# requires build-ids to be at least 16 bytes long
# (https://github.com/rpm-software-management/rpm/issues/950), so let's
# explicitly ask for SHA1 build-ids.
args.user_ldflags = '-Wl,--build-id=sha1' + ' ' + args.user_ldflags
seastar_cflags = args.user_cflags
if args.target != '':
seastar_cflags += ' -march=' + args.target

View File

@@ -2,13 +2,6 @@
. /etc/os-release
# The default build-id used by lld is xxhash, which is 8 bytes
# long. rpm requires build-ids to be at least 16 bytes long
# (https://github.com/rpm-software-management/rpm/issues/950). We
# force using sha1 for now. That has no impact in gold and bfd since
# that is their default. We set it in here instead of configure.py to
# not slow down regular builds.
# The relocatable package includes its own dynamic linker. We don't
# know the path it will be installed to, so for now use a very long
# path so that patchelf doesn't need to edit the program headers. The
@@ -24,7 +17,7 @@
ORIGINAL_DYNAMIC_LINKER=$(gcc -### /dev/null -o t 2>&1 | perl -n -e '/-dynamic-linker ([^ ]*) / && print $1')
DYNAMIC_LINKER=$(printf "%2000s$ORIGINAL_DYNAMIC_LINKER" | sed 's| |/|g')
COMMON_FLAGS="--enable-dpdk --cflags=-ffile-prefix-map=$PWD=. --ldflags=-Wl,--build-id=sha1,--dynamic-linker=$DYNAMIC_LINKER"
COMMON_FLAGS="--enable-dpdk --cflags=-ffile-prefix-map=$PWD=. --ldflags=-Wl,--dynamic-linker=$DYNAMIC_LINKER"
DEFAULT_MODE="release"