Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix checkPhase for cross builds
fixes #417
  • Loading branch information
Mic92 committed Nov 6, 2022
commit f7b184c0044d32924f01b8b8003e59d1ac49ba00
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@
patchelf = patchelfFor nixpkgs.legacyPackages.${system};
default = self.packages.${system}.patchelf;

# This is a good test to see if packages can be cross-compiled. It also
# tests if our testsuite uses target-prefixed executable names.
patchelf-musl-cross = patchelfFor nixpkgs.legacyPackages.${system}.pkgsCross.musl64;

patchelf-win32 = (patchelfFor (pkgsCrossForMingw system).mingw32).overrideAttrs (old: {
NIX_CFLAGS_COMPILE = "-static";
});
Expand Down
2 changes: 1 addition & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ TESTS = $(src_TESTS) $(build_TESTS)

EXTRA_DIST = no-rpath-prebuild $(src_TESTS) no-rpath-prebuild.sh invalid-elf endianness empty-note

TESTS_ENVIRONMENT = PATCHELF_DEBUG=1 OBJDUMP=$(OBJDUMP) READELF=$(READELF)
TESTS_ENVIRONMENT = PATCHELF_DEBUG=1 OBJDUMP=$(OBJDUMP) READELF=$(READELF) OBJCOPY=$(OBJCOPY)

$(no_rpath_arch_TESTS): no-rpath-prebuild.sh
@ln -s $< $@
Expand Down
2 changes: 1 addition & 1 deletion tests/build-id.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ long_rpath="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
--set-rpath "$long_rpath" "${SCRATCH}/libbuildid.so"

# older readelf versions do not recognize build id, but we can grep by constant
readelf -n "${SCRATCH}/libbuildid.so" | grep -q -F -e 'Build ID' -e 'Unknown note type: (0x00000003)'
${READELF} -n "${SCRATCH}/libbuildid.so" | grep -q -F -e 'Build ID' -e 'Unknown note type: (0x00000003)'
2 changes: 1 addition & 1 deletion tests/force-rpath.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh -e
SCRATCH=scratch/$(basename $0 .sh)
OBJDUMP=${OBJDDUMP:-objdump}
OBJDUMP=${OBJDUMP:-objdump}

rm -rf ${SCRATCH}
mkdir -p ${SCRATCH}
Expand Down
3 changes: 2 additions & 1 deletion tests/no-gnu-hash.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#! /bin/sh -e
SCRATCH=scratch/$(basename $0 .sh)
STRIP=${STRIP:-strip}

rm -rf ${SCRATCH}
mkdir -p ${SCRATCH}

cp simple ${SCRATCH}/

strip --remove-section=.gnu.hash ${SCRATCH}/simple
${STRIP} --remove-section=.gnu.hash ${SCRATCH}/simple

# Check if patchelf handles binaries with GNU_HASH in dynamic section but
# without .gnu.hash section
Expand Down
3 changes: 2 additions & 1 deletion tests/no-rpath-pie-powerpc.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#! /bin/sh -e
set -x
SCRATCH=scratch/no-rpath-pie-powerpc
READELF=${READELF:-readelf}

no_rpath_bin="${srcdir}/no-rpath-prebuild/no-rpath-pie-powerpc"

Expand All @@ -27,7 +28,7 @@ if ! echo "$newRPath" | grep -q '/foo:/bar'; then
fi

# Tests for powerpc PIE endianness regressions
readelfData=$(readelf -l ${SCRATCH}/no-rpath 2>&1)
readelfData=$(${READELF} -l ${SCRATCH}/no-rpath 2>&1)

if [ $(echo "$readelfData" | grep --count "PHDR") != 1 ]; then
# Triggered if PHDR errors appear on stderr
Expand Down
3 changes: 2 additions & 1 deletion tests/phdr-corruption.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PATCHELF="../src/patchelf"
SONAME="phdr-corruption.so"
SCRATCH="scratch/$(basename $0 .sh)"
SCRATCH_SO="${SCRATCH}/${SONAME}"
READELF=${READELF:-readelf}

rm -rf "${SCRATCH}"
mkdir -p "${SCRATCH}"
Expand All @@ -12,7 +13,7 @@ cp "${SONAME}" "${SCRATCH}"
"${PATCHELF}" --set-rpath "$(pwd)" "${SCRATCH_SO}"

# Check for PT_PHDR entry VirtAddr corruption
readelfData=$(readelf -l "${SCRATCH_SO}" 2>&1)
readelfData=$(${READELF} -l "${SCRATCH_SO}" 2>&1)

if [ $(echo "$readelfData" | grep --count "PHDR") != 1 ]; then
# Triggered if PHDR errors appear on stderr
Expand Down