Skip to content

Conversation

@ovpanait
Copy link
Contributor

@ovpanait ovpanait commented Aug 4, 2021

Add a testcase for the following reported alignment issue with contiguous note
sections (#275):

"""
If a binary has multiple SHT_NOTE sections and corresponding PT_NOTE
headers, we can see the error:

patchelf: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections

if the SHT_NOTE sections aren't sized to end on aligned boundaries. An example
would be a binary with:

[ 2] .note.ABI-tag NOTE 00000000000002f4 000002f4
0000000000000020 0000000000000000 A 0 0 4
[ 3] .note.gnu.propert NOTE 0000000000000318 00000318
0000000000000030 0000000000000000 A 0 0 8
[ 4] .note.gnu.build-i NOTE 0000000000000348 00000348
0000000000000024 0000000000000000 A 0 0 4

NOTE 0x0000000000000318 0x0000000000000318 0x0000000000000318
0x0000000000000030 0x0000000000000030 R 0x8
NOTE 0x00000000000002f4 0x00000000000002f4 0x00000000000002f4
0x0000000000000078 0x0000000000000074 R 0x4

since the PT_NOTE section at 2f4 covers [2] and [3] but the code
calclates curr_off should be 314, not the 318 in the binary. This
is an alignment issue.
"""

Signed-off-by: Ovidiu Panait ovidiu.panait@windriver.com

Add a testcase for the following reported alignment issue with contiguous note
sections (NixOS#275):

"""
If a binary has multiple SHT_NOTE sections and corresponding PT_NOTE
headers, we can see the error:

patchelf: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections

if the SHT_NOTE sections aren't sized to end on aligned boundaries. An example
would be a binary with:

[ 2] .note.ABI-tag NOTE 00000000000002f4 000002f4
0000000000000020 0000000000000000 A 0 0 4
[ 3] .note.gnu.propert NOTE 0000000000000318 00000318
0000000000000030 0000000000000000 A 0 0 8
[ 4] .note.gnu.build-i NOTE 0000000000000348 00000348
0000000000000024 0000000000000000 A 0 0 4

NOTE 0x0000000000000318 0x0000000000000318 0x0000000000000318
0x0000000000000030 0x0000000000000030 R 0x8
NOTE 0x00000000000002f4 0x00000000000002f4 0x00000000000002f4
0x0000000000000078 0x0000000000000074 R 0x4

since the PT_NOTE section at 2f4 covers [2] and [3] but the code
calclates curr_off should be 314, not the 318 in the binary. This
is an alignment issue.
"""

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
@ovpanait
Copy link
Contributor Author

ovpanait commented Aug 4, 2021

Hi @domenkozar

I have updated the testcase to package the linker script and also provide "-pie" flag so that it works in the nix environment too (previously, I have only tested locally on my Ubuntu host).

Here is the output of "nix-build -A hydraJobs.release" with this test and #275 fix:

$ nix-build -A hydraJobs.release
these derivations will be built:
  /nix/store/iz3bnw09m08g300bparn05azm4krak5q-patchelf-tarball-0.12.19700101.6452a59.drv
  /nix/store/qsdcfnbxvwwq246byzx2j8rw18rrmp7s-patchelf-0.12.19700101.6452a59.drv
  /nix/store/wfqf15ff9mg33d9nxs0dbqby8dcknqjc-patchelf-0.12.19700101.6452a59.drv
  /nix/store/j01f1088c3gw19qjlcws8in9mfh0zhrl-patchelf-0.12.19700101.6452a59.drv
building '/nix/store/iz3bnw09m08g300bparn05azm4krak5q-patchelf-tarball-0.12.19700101.6452a59.drv'...
unpacking sources
unpacking source archive /nix/store/bfyy0sqahlrjxg8zxyi2q0xvsp2pzjmi-source
source root is source
patching sources
autoconfPhase
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force --warnings=all 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: creating directory build-aux
autoreconf: configure.ac: not using Libtool
autoreconf: running: /nix/store/nlxwqib9h0kd440va4ycq8lm5x2ajccs-autoconf-2.69/bin/autoconf --force --warnings=all
autoreconf: configure.ac: not using Autoheader
autoreconf: running: automake --add-missing --copy --force-missing --warnings=all
configure.ac:7: installing 'build-aux/compile'
configure.ac:5: installing 'build-aux/install-sh'
configure.ac:5: installing 'build-aux/missing'
src/Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
autoreconf: Leaving directory `.'
configuring
configure flags: --disable-dependency-tracking --prefix=/build/tmp_prefix
checking for a BSD-compatible install... /nix/store/w9wc0d31p4z93cbgxijws03j5s2c4gyf-coreutils-8.31/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /nix/store/w9wc0d31p4z93cbgxijws03j5s2c4gyf-coreutils-8.31/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... none
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... none
checking dependency style of gcc... none
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating patchelf.spec
config.status: executing depfiles commands
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/4zvrqs1503ii1vghillimkiwlbjxryk8-patchelf-tarball-0.12.19700101.6452a59
strip is /nix/store/p792j5f44l3f0xi7ai5jllwnxqwnka88-binutils-2.31.1/bin/strip
patching script interpreter paths in /nix/store/4zvrqs1503ii1vghillimkiwlbjxryk8-patchelf-tarball-0.12.19700101.6452a59
checking for references to /build/ in /nix/store/4zvrqs1503ii1vghillimkiwlbjxryk8-patchelf-tarball-0.12.19700101.6452a59...
distPhase
dist flags: %q dist
make  dist-bzip2 dist-gzip am__post_remove_distdir='@:'
make[1]: Entering directory '/build/source'
make  distdir-am
make[2]: Entering directory '/build/source'
if test -d "patchelf-0.12.19700101.6452a59"; then find "patchelf-0.12.19700101.6452a59" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -rf "patchelf-0.12.19700101.6452a59" || { sleep 5 && rm -rf "patchelf-0.12.19700101.6452a59"; }; else :; fi
test -d "patchelf-0.12.19700101.6452a59" || mkdir "patchelf-0.12.19700101.6452a59"
 (cd src && make  top_distdir=../patchelf-0.12.19700101.6452a59 distdir=../patchelf-0.12.19700101.6452a59/src \
     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)
make[3]: Entering directory '/build/source/src'
make  distdir-am
make[4]: Entering directory '/build/source/src'
make[4]: Leaving directory '/build/source/src'
make[3]: Leaving directory '/build/source/src'
 (cd tests && make  top_distdir=../patchelf-0.12.19700101.6452a59 distdir=../patchelf-0.12.19700101.6452a59/tests \
     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)
make[3]: Entering directory '/build/source/tests'
make  distdir-am
make[4]: Entering directory '/build/source/tests'
make[4]: Leaving directory '/build/source/tests'
make[3]: Leaving directory '/build/source/tests'
test -n "" \
|| find "patchelf-0.12.19700101.6452a59" -type d ! -perm -755 \
        -exec chmod u+rwx,go+rx {} \; -o \
  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
  ! -type d ! -perm -444 -exec /nix/store/2jysm3dfsgby5sw5jgj43qjrb5v79ms9-bash-4.4-p23/bin/bash /build/source/build-aux/install-sh -c -m a+r {} {} \; \
|| chmod -R a+r "patchelf-0.12.19700101.6452a59"
make[2]: Leaving directory '/build/source'
tardir=patchelf-0.12.19700101.6452a59 && ${TAR-tar} chof - "$tardir" | BZIP2=${BZIP2--9} bzip2 -c >patchelf-0.12.19700101.6452a59.tar.bz2
tardir=patchelf-0.12.19700101.6452a59 && ${TAR-tar} chof - "$tardir" | eval GZIP= gzip --best -c >patchelf-0.12.19700101.6452a59.tar.gz
make[1]: Leaving directory '/build/source'
if test -d "patchelf-0.12.19700101.6452a59"; then find "patchelf-0.12.19700101.6452a59" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -rf "patchelf-0.12.19700101.6452a59" || { sleep 5 && rm -rf "patchelf-0.12.19700101.6452a59"; }; else :; fi
'patchelf-0.12.19700101.6452a59.tar.gz' -> '/nix/store/4zvrqs1503ii1vghillimkiwlbjxryk8-patchelf-tarball-0.12.19700101.6452a59/tarballs/patchelf-0.12.19700101.6452a59.tar.gz'
'patchelf-0.12.19700101.6452a59.tar.bz2' -> '/nix/store/4zvrqs1503ii1vghillimkiwlbjxryk8-patchelf-tarball-0.12.19700101.6452a59/tarballs/patchelf-0.12.19700101.6452a59.tar.bz2'
finalPhase
build time elapsed:  0m0.097s 0m0.020s 0m2.999s 0m0.588s
building '/nix/store/qsdcfnbxvwwq246byzx2j8rw18rrmp7s-patchelf-0.12.19700101.6452a59.drv'...
unpacking sources
unpacking source archive /nix/store/4zvrqs1503ii1vghillimkiwlbjxryk8-patchelf-tarball-0.12.19700101.6452a59/tarballs/patchelf-0.12.19700101.6452a59.tar.bz2
source root is patchelf-0.12.19700101.6452a59
setting SOURCE_DATE_EPOCH to timestamp 1628069394 of file patchelf-0.12.19700101.6452a59/patchelf.spec
warning: file patchelf-0.12.19700101.6452a59/patchelf.spec may be generated; SOURCE_DATE_EPOCH may be non-deterministic
patching sources
configuring
configure flags: --disable-dependency-tracking --prefix=/nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59
checking for a BSD-compatible install... /nix/store/w9wc0d31p4z93cbgxijws03j5s2c4gyf-coreutils-8.31/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /nix/store/w9wc0d31p4z93cbgxijws03j5s2c4gyf-coreutils-8.31/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... none
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... none
checking dependency style of gcc... none
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating patchelf.spec
config.status: executing depfiles commands
building
build flags: SHELL=/nix/store/2jysm3dfsgby5sw5jgj43qjrb5v79ms9-bash-4.4-p23/bin/bash
Making all in src
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59/src'
g++ -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.    -Wall -std=c++11 -D_FILE_OFFSET_BITS=64  -g -O2 -c -o patchelf.o patchelf.cc
g++ -Wall -std=c++11 -D_FILE_OFFSET_BITS=64  -g -O2   -o patchelf patchelf.o  
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/src'
Making all in tests
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59'
running tests
check flags: SHELL=/nix/store/2jysm3dfsgby5sw5jgj43qjrb5v79ms9-bash-4.4-p23/bin/bash VERBOSE=y check
Making check in src
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59/src'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/src'
Making check in tests
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
make  simple main main-scoped big-dynstr no-rpath contiguous_note_sections libfoo.so libfoo-scoped.so libbar.so libbar-scoped.so libsimple.so libbuildid.so
make[2]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.     -g -O2 -c -o simple-simple.o `test -f 'simple.c' || echo './'`simple.c
gcc  -g -O2   -o simple simple-simple.o  
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.    -fpic -g -O2 -c -o main.o main.c
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.    -fpic -g -O2 -c -o foo.o foo.c
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.    -fpic -g -O2 -c -o bar.o bar.c
gcc -fpic -g -O2 -Wl,--disable-new-dtags -shared -L.  -Wl,-rpath,`pwd`/no-such-path  -o libbar.so bar.o  
gcc -fpic -g -O2 -Wl,--disable-new-dtags -shared -L.   -o libfoo.so foo.o -lbar  
gcc -fpic -g -O2 -Wl,--disable-new-dtags -Wl,-rpath-link=. -L.   -o main main.o -lfoo  
gcc -fpic -g -O2 -Wl,--disable-new-dtags -shared -L.   -o libbar-scoped.so bar.o  
gcc -fpic -g -O2 -Wl,--disable-new-dtags -shared -L.   -o libfoo-scoped.so foo.o -lbar-scoped  
gcc -fpic -g -O2 -Wl,--disable-new-dtags -Wl,-rpath-link=. -L.   -o main-scoped main.o -lfoo-scoped  
cat main.c > big-dynstr.c
for i in $(seq 1 2000); do echo "void f$i(void) { };" >> big-dynstr.c; done
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.    -fpic -g -O2 -c -o big-dynstr.o big-dynstr.c
gcc -fpic -g -O2 -Wl,--disable-new-dtags -Wl,-rpath-link=. -L.   -o big-dynstr big-dynstr.o -lfoo  
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.     -g -O2 -c -o no_rpath-no-rpath.o `test -f 'no-rpath.c' || echo './'`no-rpath.c
gcc  -g -O2   -o no-rpath no_rpath-no-rpath.o  
gcc  -g -O2 -c -o contiguous_note_sections.o contiguous_note_sections.s
gcc -pie -g -O2 -nostdlib -T contiguous_note_sections.ld  -o contiguous_note_sections contiguous_note_sections.o  
make[2]: 'libfoo.so' is up to date.
make[2]: 'libfoo-scoped.so' is up to date.
make[2]: 'libbar.so' is up to date.
make[2]: 'libbar-scoped.so' is up to date.
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.    -fpic -g -O2 -c -o simple.o simple.c
gcc -fpic -g -O2 -Wl,--disable-new-dtags -shared -L.   -o libsimple.so simple.o  
gcc -fpic -g -O2 -Wl,--disable-new-dtags -shared -L.  -Wl,-build-id  -o libbuildid.so simple.o  
make[2]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make  check-TESTS
make[2]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[3]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
PASS: plain-fail.sh
PASS: plain-run.sh
PASS: shrink-rpath.sh
PASS: set-interpreter-short.sh
PASS: set-interpreter-long.sh
PASS: set-rpath.sh
PASS: no-rpath.sh
PASS: big-dynstr.sh
PASS: set-rpath-library.sh
PASS: soname.sh
PASS: shrink-rpath-with-allowed-prefixes.sh
PASS: force-rpath.sh
PASS: plain-needed.sh
PASS: output-flag.sh
PASS: no-rpath-pie-powerpc.sh
PASS: build-id.sh
PASS: invalid-elf.sh
PASS: contiguous_note_sections.sh
PASS: no-rpath-amd64.sh
PASS: no-rpath-armel.sh
PASS: no-rpath-armhf.sh
PASS: no-rpath-hurd-i386.sh
PASS: no-rpath-i386.sh
PASS: no-rpath-ia64.sh
PASS: no-rpath-kfreebsd-amd64.sh
PASS: no-rpath-kfreebsd-i386.sh
PASS: no-rpath-mips.sh
PASS: no-rpath-mipsel.sh
PASS: no-rpath-powerpc.sh
PASS: no-rpath-s390.sh
PASS: no-rpath-sh4.sh
PASS: no-rpath-sparc.sh
============================================================================
Testsuite summary for patchelf 0.12.19700101.6452a59
============================================================================
# TOTAL: 32
# PASS:  32
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[2]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59'
make[1]: Nothing to be done for 'check-am'.
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59'
installing
install flags: SHELL=/nix/store/2jysm3dfsgby5sw5jgj43qjrb5v79ms9-bash-4.4-p23/bin/bash install
Making install in src
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59/src'
make[2]: Entering directory '/build/patchelf-0.12.19700101.6452a59/src'
 /nix/store/w9wc0d31p4z93cbgxijws03j5s2c4gyf-coreutils-8.31/bin/mkdir -p '/nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59/bin'
  /nix/store/w9wc0d31p4z93cbgxijws03j5s2c4gyf-coreutils-8.31/bin/install -c patchelf '/nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59/bin'
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/src'
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/src'
Making install in tests
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[2]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59'
make[2]: Entering directory '/build/patchelf-0.12.19700101.6452a59'
make[2]: Nothing to be done for 'install-exec-am'.
 /nix/store/w9wc0d31p4z93cbgxijws03j5s2c4gyf-coreutils-8.31/bin/mkdir -p '/nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59/share/doc/patchelf'
 /nix/store/w9wc0d31p4z93cbgxijws03j5s2c4gyf-coreutils-8.31/bin/install -c -m 644 README.md '/nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59/share/doc/patchelf'
 /nix/store/w9wc0d31p4z93cbgxijws03j5s2c4gyf-coreutils-8.31/bin/mkdir -p '/nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59/share/man/man1'
 /nix/store/w9wc0d31p4z93cbgxijws03j5s2c4gyf-coreutils-8.31/bin/install -c -m 644 patchelf.1 '/nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59/share/man/man1'
make[2]: Leaving directory '/build/patchelf-0.12.19700101.6452a59'
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59'
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59
shrinking /nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59/bin/patchelf
gzipping man pages under /nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59/share/man/
strip is /nix/store/p792j5f44l3f0xi7ai5jllwnxqwnka88-binutils-2.31.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59/bin 
patching script interpreter paths in /nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59
checking for references to /build/ in /nix/store/i6aq49zjqw4llwcmbaffp6pk51i6wdcs-patchelf-0.12.19700101.6452a59...
building '/nix/store/wfqf15ff9mg33d9nxs0dbqby8dcknqjc-patchelf-0.12.19700101.6452a59.drv'...
unpacking sources
unpacking source archive /nix/store/4zvrqs1503ii1vghillimkiwlbjxryk8-patchelf-tarball-0.12.19700101.6452a59/tarballs/patchelf-0.12.19700101.6452a59.tar.bz2
source root is patchelf-0.12.19700101.6452a59
setting SOURCE_DATE_EPOCH to timestamp 1628069394 of file patchelf-0.12.19700101.6452a59/patchelf.spec
warning: file patchelf-0.12.19700101.6452a59/patchelf.spec may be generated; SOURCE_DATE_EPOCH may be non-deterministic
patching sources
configuring
configure flags: --disable-dependency-tracking --prefix=/nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59
checking for a BSD-compatible install... /nix/store/n2skqdw4rdaxlhmvqnz3pqvqx8kg57p3-coreutils-8.31/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /nix/store/n2skqdw4rdaxlhmvqnz3pqvqx8kg57p3-coreutils-8.31/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... none
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... none
checking dependency style of gcc... none
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating patchelf.spec
config.status: executing depfiles commands
building
build flags: SHELL=/nix/store/fcxz1xriyhjbsbls7yi27868kdqa96vx-bash-4.4-p23/bin/bash
Making all in src
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59/src'
g++ -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.    -Wall -std=c++11 -D_FILE_OFFSET_BITS=64  -g -O2 -c -o patchelf.o patchelf.cc
In file included from /nix/store/fippg5rly0n9xqknyqqxs8di244ik118-gcc-9.3.0/include/c++/9.3.0/cassert:44,
                 from patchelf.cc:29:
patchelf.cc: In instantiation of 'void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym, Elf_Verneed, Elf_Versym>::rewriteSectionsLibrary() [with Elf_Ehdr = Elf64_Ehdr; Elf_Phdr = Elf64_Phdr; Elf_Shdr = Elf64_Shdr; Elf_Addr = long long unsigned int; Elf_Off = long long unsigned int; Elf_Dyn = Elf64_Dyn; Elf_Sym = Elf64_Sym; Elf_Verneed = Elf64_Verneed; Elf_Versym = short unsigned int]':
patchelf.cc:1049:9:   required from 'void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym, Elf_Verneed, Elf_Versym>::rewriteSections() [with Elf_Ehdr = Elf64_Ehdr; Elf_Phdr = Elf64_Phdr; Elf_Shdr = Elf64_Shdr; Elf_Addr = long long unsigned int; Elf_Off = long long unsigned int; Elf_Dyn = Elf64_Dyn; Elf_Sym = Elf64_Sym; Elf_Verneed = Elf64_Verneed; Elf_Versym = short unsigned int]'
patchelf.cc:1777:9:   required from 'void patchElf2(ElfFile&&, const FileContents&, std::string) [with ElfFile = ElfFile<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, long long unsigned int, long long unsigned int, Elf64_Dyn, Elf64_Sym, Elf64_Verneed, short unsigned int>; FileContents = std::shared_ptr<std::vector<unsigned char> >; std::string = std::__cxx11::basic_string<char>]'
patchelf.cc:1798:185:   required from here
patchelf.cc:851:19: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'off_t' {aka 'long long int'} [-Wsign-compare]
  851 |     assert(curOff == startOffset + neededSpace);
      |            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
g++ -Wall -std=c++11 -D_FILE_OFFSET_BITS=64  -g -O2   -o patchelf patchelf.o  
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/src'
Making all in tests
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59'
running tests
check flags: SHELL=/nix/store/fcxz1xriyhjbsbls7yi27868kdqa96vx-bash-4.4-p23/bin/bash VERBOSE=y check
Making check in src
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59/src'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/src'
Making check in tests
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
make  simple main main-scoped big-dynstr no-rpath contiguous_note_sections libfoo.so libfoo-scoped.so libbar.so libbar-scoped.so libsimple.so libbuildid.so
make[2]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.     -g -O2 -c -o simple-simple.o `test -f 'simple.c' || echo './'`simple.c
gcc  -g -O2   -o simple simple-simple.o  
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.    -fpic -g -O2 -c -o main.o main.c
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.    -fpic -g -O2 -c -o foo.o foo.c
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.    -fpic -g -O2 -c -o bar.o bar.c
gcc -fpic -g -O2 -Wl,--disable-new-dtags -shared -L.  -Wl,-rpath,`pwd`/no-such-path  -o libbar.so bar.o  
gcc -fpic -g -O2 -Wl,--disable-new-dtags -shared -L.   -o libfoo.so foo.o -lbar  
gcc -fpic -g -O2 -Wl,--disable-new-dtags -Wl,-rpath-link=. -L.   -o main main.o -lfoo  
gcc -fpic -g -O2 -Wl,--disable-new-dtags -shared -L.   -o libbar-scoped.so bar.o  
gcc -fpic -g -O2 -Wl,--disable-new-dtags -shared -L.   -o libfoo-scoped.so foo.o -lbar-scoped  
gcc -fpic -g -O2 -Wl,--disable-new-dtags -Wl,-rpath-link=. -L.   -o main-scoped main.o -lfoo-scoped  
cat main.c > big-dynstr.c
for i in $(seq 1 2000); do echo "void f$i(void) { };" >> big-dynstr.c; done
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.    -fpic -g -O2 -c -o big-dynstr.o big-dynstr.c
gcc -fpic -g -O2 -Wl,--disable-new-dtags -Wl,-rpath-link=. -L.   -o big-dynstr big-dynstr.o -lfoo  
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.     -g -O2 -c -o no_rpath-no-rpath.o `test -f 'no-rpath.c' || echo './'`no-rpath.c
gcc  -g -O2   -o no-rpath no_rpath-no-rpath.o  
gcc  -g -O2 -c -o contiguous_note_sections.o contiguous_note_sections.s
gcc -pie -g -O2 -nostdlib -T contiguous_note_sections.ld  -o contiguous_note_sections contiguous_note_sections.o  
make[2]: 'libfoo.so' is up to date.
make[2]: 'libfoo-scoped.so' is up to date.
make[2]: 'libbar.so' is up to date.
make[2]: 'libbar-scoped.so' is up to date.
gcc -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.12.19700101.6452a59\" -DPACKAGE_STRING=\"patchelf\ 0.12.19700101.6452a59\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.12.19700101.6452a59\" -I.    -fpic -g -O2 -c -o simple.o simple.c
gcc -fpic -g -O2 -Wl,--disable-new-dtags -shared -L.   -o libsimple.so simple.o  
gcc -fpic -g -O2 -Wl,--disable-new-dtags -shared -L.  -Wl,-build-id  -o libbuildid.so simple.o  
make[2]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make  check-TESTS
make[2]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[3]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
PASS: plain-fail.sh
PASS: plain-run.sh
PASS: shrink-rpath.sh
PASS: set-interpreter-short.sh
PASS: set-interpreter-long.sh
PASS: set-rpath.sh
PASS: no-rpath.sh
PASS: big-dynstr.sh
PASS: set-rpath-library.sh
PASS: soname.sh
PASS: shrink-rpath-with-allowed-prefixes.sh
PASS: force-rpath.sh
PASS: plain-needed.sh
PASS: output-flag.sh
PASS: no-rpath-pie-powerpc.sh
PASS: build-id.sh
PASS: invalid-elf.sh
PASS: contiguous_note_sections.sh
PASS: no-rpath-amd64.sh
PASS: no-rpath-armel.sh
PASS: no-rpath-armhf.sh
PASS: no-rpath-hurd-i386.sh
PASS: no-rpath-i386.sh
PASS: no-rpath-ia64.sh
PASS: no-rpath-kfreebsd-amd64.sh
PASS: no-rpath-kfreebsd-i386.sh
PASS: no-rpath-mips.sh
PASS: no-rpath-mipsel.sh
PASS: no-rpath-powerpc.sh
PASS: no-rpath-s390.sh
PASS: no-rpath-sh4.sh
PASS: no-rpath-sparc.sh
============================================================================
Testsuite summary for patchelf 0.12.19700101.6452a59
============================================================================
# TOTAL: 32
# PASS:  32
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[2]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59'
make[1]: Nothing to be done for 'check-am'.
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59'
installing
install flags: SHELL=/nix/store/fcxz1xriyhjbsbls7yi27868kdqa96vx-bash-4.4-p23/bin/bash install
Making install in src
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59/src'
make[2]: Entering directory '/build/patchelf-0.12.19700101.6452a59/src'
 /nix/store/n2skqdw4rdaxlhmvqnz3pqvqx8kg57p3-coreutils-8.31/bin/mkdir -p '/nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59/bin'
  /nix/store/n2skqdw4rdaxlhmvqnz3pqvqx8kg57p3-coreutils-8.31/bin/install -c patchelf '/nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59/bin'
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/src'
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/src'
Making install in tests
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[2]: Entering directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59/tests'
make[1]: Entering directory '/build/patchelf-0.12.19700101.6452a59'
make[2]: Entering directory '/build/patchelf-0.12.19700101.6452a59'
make[2]: Nothing to be done for 'install-exec-am'.
 /nix/store/n2skqdw4rdaxlhmvqnz3pqvqx8kg57p3-coreutils-8.31/bin/mkdir -p '/nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59/share/doc/patchelf'
 /nix/store/n2skqdw4rdaxlhmvqnz3pqvqx8kg57p3-coreutils-8.31/bin/install -c -m 644 README.md '/nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59/share/doc/patchelf'
 /nix/store/n2skqdw4rdaxlhmvqnz3pqvqx8kg57p3-coreutils-8.31/bin/mkdir -p '/nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59/share/man/man1'
 /nix/store/n2skqdw4rdaxlhmvqnz3pqvqx8kg57p3-coreutils-8.31/bin/install -c -m 644 patchelf.1 '/nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59/share/man/man1'
make[2]: Leaving directory '/build/patchelf-0.12.19700101.6452a59'
make[1]: Leaving directory '/build/patchelf-0.12.19700101.6452a59'
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59
shrinking /nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59/bin/patchelf
gzipping man pages under /nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59/share/man/
strip is /nix/store/gc290fhkvrszcv1klj1wksy30znlxfnw-binutils-2.31.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59/bin 
patching script interpreter paths in /nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59
checking for references to /build/ in /nix/store/vkyn207wfwnbxpbylfpyzwfp2yz9gxsi-patchelf-0.12.19700101.6452a59...
building '/nix/store/j01f1088c3gw19qjlcws8in9mfh0zhrl-patchelf-0.12.19700101.6452a59.drv'...
/nix/store/rcpy7f4949m6fl2gsvsanaiaryswixzn-patchelf-0.12.19700101.6452a59

@domenkozar domenkozar merged commit 1e1544a into NixOS:master Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants