On opBSD / HardenedBSD (which is based on FreeBSD 10-STABLE) when the base system builds with enabled PIE, the tar's test compilation gets wrong. The attached patch fixes the problem.
opBSD: fix tar's test builds with WITH_TESTS= in src.conf --8<-- (cd /usr/src/usr.bin/tar/tests && NO_SUBDIR=1 make -f /usr/src/usr.bin/tar/tests/Makefile _RECURSING_PROGS=t PROG=bsdtar_test DEPENDFILE=.depend.bsdtar_test .MAKE.DEPENDFILE=.depend.bsdtar_test ) cc -O2 -pipe -pipe -march=core-avx2 -DHARDENEDBSD -DPLATFORM_CONFIG_H=\"/usr/src/lib/libarchive/config_freebsd.h\" -static -I/usr/src/lib/libarchive -I/usr/obj/usr/src/usr.bin/tar/tests -I/usr/src/contrib/libarchive/tar -I/usr/src/contrib/libarchive/test_utils -fPIE -std=gnu99 -Qunused-arguments -fstack-protector -pie -Wl,-z,relro -Wl,-z,now -o bsdtar_test test_0.o test_basic.o test_copy.o test_empty_mtree.o test_extract_tar_bz2.o test_extract_tar_grz.o test_extract_tar_gz.o test_extract_tar_lrz.o test_extract_tar_lz.o test_extract_tar_lz4.o test_extract_tar_lzma.o test_extract_tar_lzo.o test_extract_tar_xz.o test_format_newc.o test_help.o test_leading_slash.o test_missing_file.o test_option_C_upper.o test_option_H_upper.o test_option_L_upper.o test_option_O_upper.o test_option_T_upper.o test_option_U_upper.o test_option_X_upper.o test_option_a.o test_option_b.o test_option_b64encode.o test_option_exclude.o test_option_gid_gname.o test_option_grzip.o test_option_j.o test_option_k.o test_option_keep_newer_files.o test_option_lrzip.o test_option_lz4.o test_option_lzma.o test_option_lzop.o test_option_n.o test_option_newer_than.o test_option_nodump.o test_option_older_than.o test_option_passphrase.o test_option_q.o test_option_r.o test_option_s.o test_option_uid_uname.o test_option_uuencode.o test_option_xz.o test_option_z.o test_patterns.o test_print_longpath.o test_stdio.o test_strip_components.o test_symlink_dir.o test_version.o main.o test_utils.o -larchive /usr/bin/ld: test_0.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC test_0.o: could not read symbols: Bad value cc: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1 Stop. make[1]: stopped in /usr/src/usr.bin/tar/tests *** Error code 1 Stop. --8<-- Obtained-from: opBSD 418a491eed20d2603ddd1f1bd92c2c0d95094002
Failed build: http://nyi-01.build.hardenedbsd.org:8180/jenkins/job/HardenedBSD-10-STABLE-amd64/515/
Fixed build with the patch: http://jenkins.hardenedbsd.org:8180/jenkins/job/HardenedBSD-10-STABLE-amd64/516/