From 24aebc79b16a82faef4736f4abdc7e4d95d4cc67 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 28 Apr 2021 11:49:09 +0100 Subject: Stop the BFD library from treating annobin symbols as potential function symbols. bfd * elf.c (_bfd_elf_maybe_function_sym): Do not accept annobin symbols as potential function symbols. * elfnn-aarch64.c (elfNN_aarch64_maybe_function_sym): Likewise. * elf64-ppc.c (ppc64_elf_maybe_function_sym): Likewise. * elf32-arm.c (elf32_arm_maybe_function_sym): Likewise. ld * testsuite/ld-elf/anno-sym.s: New test source file. * testsuite/ld-elf/anno-sym.d: New test driver. * testsuite/ld-elf/anno-sym.l: New test error output. --- ld/ChangeLog | 6 ++++++ ld/testsuite/ld-elf/anno-sym.d | 5 +++++ ld/testsuite/ld-elf/anno-sym.l | 4 ++++ ld/testsuite/ld-elf/anno-sym.s | 13 +++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 ld/testsuite/ld-elf/anno-sym.d create mode 100644 ld/testsuite/ld-elf/anno-sym.l create mode 100644 ld/testsuite/ld-elf/anno-sym.s (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 9bb178e..3c4bec5 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2021-04-28 Nick Clifton + + * testsuite/ld-elf/anno-sym.s: New test source file. + * testsuite/ld-elf/anno-sym.d: New test driver. + * testsuite/ld-elf/anno-sym.l: New test error output. + 2021-04-26 Jan Beulich * testsuite/ld-i386/pcrel16-2.s, testsuite/ld-i386/pcrel16-2.d, diff --git a/ld/testsuite/ld-elf/anno-sym.d b/ld/testsuite/ld-elf/anno-sym.d new file mode 100644 index 0000000..9e53c4a --- /dev/null +++ b/ld/testsuite/ld-elf/anno-sym.d @@ -0,0 +1,5 @@ +# Check that linking anno-sym.o produces an undefined reference message referring to '_start' and not 'annobin_hello.c' +#ld: -e _start +#error_output: anno-sym.l +# The mips-irix6 target fails this test because it does not find any function symbols. Not sure why. +#skip: *-*-irix* diff --git a/ld/testsuite/ld-elf/anno-sym.l b/ld/testsuite/ld-elf/anno-sym.l new file mode 100644 index 0000000..ee9611a --- /dev/null +++ b/ld/testsuite/ld-elf/anno-sym.l @@ -0,0 +1,4 @@ +#... +.*: in function `(|_)start': +.*: undefined reference to `foo' +#pass diff --git a/ld/testsuite/ld-elf/anno-sym.s b/ld/testsuite/ld-elf/anno-sym.s new file mode 100644 index 0000000..0e4b5aa --- /dev/null +++ b/ld/testsuite/ld-elf/anno-sym.s @@ -0,0 +1,13 @@ + .text + + .hidden .annobin_hello.c + .type .annobin_hello.c, STT_NOTYPE + .equiv .annobin_hello.c, . + .size .annobin_hello.c, 0 + + .global _start +_start: + .nop + .align 4 + .dc.a foo + -- cgit v1.1