From 9b4e3a5e23b37b3e9ff188043630d190e9c2e55f Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 26 Nov 2018 22:07:17 +1030 Subject: [PATCH] [GOLD] justsyms_exec test fail on powerpc64 This test fails on powerpc64le due to the justsyms_lib being built with exported_data at 0x2010000, apparently due to the powerpc target code generating an empty relro .branch_lt section. Since the test relies on the library having exported_data at 0x2000000, avoid the problem by linking with -z norelro. Also, the test doesn't need to avoid checking the function symbol on powerpc elfv2. * testsuite/Makefile.am (justsyms_lib): Link with -z norelro. * testsuite/Makefile.in: Regenerate. * testsuite/justsyms_exec.c (main): Do check exported_func on PowerPC64 ELFv2. --- gold/ChangeLog | 7 +++++++ gold/testsuite/Makefile.am | 2 +- gold/testsuite/Makefile.in | 2 +- gold/testsuite/justsyms_exec.c | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 3bcf6a7..9d10dc8 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,5 +1,12 @@ 2018-11-26 Alan Modra + * testsuite/Makefile.am (justsyms_lib): Link with -z norelro. + * testsuite/Makefile.in: Regenerate. + * testsuite/justsyms_exec.c (main): Do check exported_func + on PowerPC64 ELFv2. + +2018-11-26 Alan Modra + * testsuite/ver_test_14.sh: Accept objdump -T display of st_other bits on powerpc64le. diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index b70a7d5..135790b 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -2013,7 +2013,7 @@ MOSTLYCLEANFILES += justsyms_lib justsyms_lib.o: justsyms_lib.c $(COMPILE) -c -o $@ $< justsyms_lib: justsyms_lib.o gcctestdir/ld - gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o + gcctestdir/ld -o $@ -z norelro -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o check_PROGRAMS += binary_test MOSTLYCLEANFILES += binary.txt diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 61ea653..db92394 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -8766,7 +8766,7 @@ uninstall-am: @GCC_TRUE@@NATIVE_LINKER_TRUE@justsyms_lib.o: justsyms_lib.c @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -c -o $@ $< @GCC_TRUE@@NATIVE_LINKER_TRUE@justsyms_lib: justsyms_lib.o gcctestdir/ld -@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld -o $@ -z norelro -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o # Copy the file to the build directory to avoid worrying about the # full pathname in the generated symbols. @GCC_TRUE@@NATIVE_LINKER_TRUE@binary.txt: $(srcdir)/binary.in diff --git a/gold/testsuite/justsyms_exec.c b/gold/testsuite/justsyms_exec.c index 49c0b55..c0281e7 100644 --- a/gold/testsuite/justsyms_exec.c +++ b/gold/testsuite/justsyms_exec.c @@ -47,8 +47,8 @@ check(void *sym, long v, const char *name) int main(void) { -#ifndef __powerpc64__ - /* PowerPC64 uses function descriptors. */ +#if !defined (__powerpc64__) || (defined (_CALL_ELF) && _CALL_ELF == 2) + /* PowerPC64 ELFv1 uses function descriptors. */ check(exported_func, 0x1000200, "exported_func"); #endif check(&exported_data, 0x2000000, "exported_data"); -- 2.7.4