summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2021-08-21 09:38:46 +0200
committerJörg Thalheim <joerg@thalheim.io>2021-08-23 20:57:47 +0200
commita71334dc2e2d10e57fed4b6dfc902420ce917e8a (patch)
tree44e0c9aca2b228df682f84cf2e896861970c30a4
parentbf62fda4ecab0dc44a0b823517d1cf22633adc25 (diff)
downloadpatchelf-a71334dc2e2d10e57fed4b6dfc902420ce917e8a.tar.gz
add failing test for .dynamic == NOBITS
-rw-r--r--.gitignore1
-rw-r--r--tests/Makefile.am17
-rwxr-xr-xtests/no-dynamic-section.sh4
3 files changed, 20 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index ef4abeb..8fcfb2a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,4 @@ Makefile
/tests/too-many-strtab
/tests/big-dynstr*
/tests/main-scoped
+/tests/libbig-dynstr.debug
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2196401..90fe906 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,7 @@
LIBS =
+STRIP ?= strip
+
check_PROGRAMS = simple main too-many-strtab main-scoped big-dynstr no-rpath contiguous-note-sections
no_rpath_arch_TESTS = \
@@ -32,7 +34,8 @@ src_TESTS = \
invalid-elf.sh \
endianness.sh \
contiguous-note-sections.sh \
- no-gnu-hash.sh
+ no-gnu-hash.sh \
+ no-dynamic-section.sh
build_TESTS = \
$(no_rpath_arch_TESTS)
@@ -73,13 +76,23 @@ main_scoped_LDFLAGS = $(LDFLAGS_local)
big-dynstr.c: main.c
cat $< > big-dynstr.c
- for i in $$(seq 1 2000); do echo "void f$$i(void) { };" >> big-dynstr.c; done
+ for i in $$(seq 1 2000); do echo "void f$$i(void) { };"; done >> big-dynstr.c
nodist_big_dynstr_SOURCES = big-dynstr.c
big_dynstr_LDADD = -lfoo $(AM_LDADD)
big_dynstr_DEPENDENCIES = libfoo.so
big_dynstr_LDFLAGS = $(LDFLAGS_local)
+# somehow bug does not trigger if we use
+# normal autotools rules to build the program:
+# https://github.com/NixOS/patchelf/pull/303
+libbig-dynstr.so: big-dynstr.c
+ $(CC) -fPIC -shared -o $@ $<
+libbig-dynstr.debug: libbig-dynstr.so
+ $(STRIP) --only-keep-debug libbig-dynstr.so -o libbig-dynstr.debug
+check_DATA = libbig-dynstr.debug
+
+
# declare local shared libraries as programs as:
# - without libtool, only archives (static libraries) can be built by automake
# - with libtool, it is difficult to control options
diff --git a/tests/no-dynamic-section.sh b/tests/no-dynamic-section.sh
new file mode 100755
index 0000000..3e74b38
--- /dev/null
+++ b/tests/no-dynamic-section.sh
@@ -0,0 +1,4 @@
+#! /bin/sh -e
+
+# print rpath on library with stripped dynamic section
+../src/patchelf --print-rpath libbig-dynstr.debug