Architecutres such as Debian i386 may enable PIE by default, resulting
in test binaries that include extra symbols such as
'__x86.get_pc_thunk.ax'.

These extra symbols are added to test archive symbol indices.  This
changes ar-extract-ar output which causes test failures.

Include '-fno-pic -fno-pie -fno-plt' when compiling test binaries to
ensure that no extra symbols are added and no symbols are reordered.

Signed-off-by: Aaron Merey <[email protected]>
---
 tests/run-ar.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/run-ar.sh b/tests/run-ar.sh
index 733d810d..3389035f 100755
--- a/tests/run-ar.sh
+++ b/tests/run-ar.sh
@@ -66,7 +66,7 @@ EOF
 # Compile the source files.
 for src in *.c; do
   obj=$(echo "$src" | sed 's/\.c$/.o/')
-  gcc -O0 -c "$src" -o "$obj"
+  gcc -O0 -fno-pic -fno-pie -fno-plt -c "$src" -o "$obj"
 done
 
 echo Create nested archives.
-- 
2.51.0

Reply via email to