[commited, PATCH] PR ld/18718: Skip missing symbol version section check for executable

H.J. Lu hjl.tools@gmail.com
Wed Jul 29 18:24:00 GMT 2015


On Sat, Jul 25, 2015 at 8:07 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> Missing symbol version section is a run-time problem only if it will
> be referenced dynamically at run-time.  We should skip the check for
> locally defined symbol, which isn't referenced by shared library, when
> linking executable.
>
> bfd/
>
>         PR ld/18718
>         * elflink.c (elf_link_output_extsym): Check symbol version
>         section check only if not linking executable, the symbol is
>         referenced by shared library or not locally defined.
>
> ld/testsuite/
>
>         PR ld/18718
>         * ld-elf/pr18718.c: New file.
>         * ld-elf/shared.exp: Run tests for PR ld/18718.
>
> diff --git a/ld/testsuite/ld-elf/pr18718.c b/ld/testsuite/ld-elf/pr18718.c
> new file mode 100644
> index 0000000..de628ef
> --- /dev/null
> +++ b/ld/testsuite/ld-elf/pr18718.c
> @@ -0,0 +1,26 @@
> +#include <stdio.h>
> +#include <bfd_stdint.h>
> +
> +extern void foo (void);
> +
> +void
> +new_foo (void)
> +{
> +}
> +
> +__asm__(".symver new_foo, foo@@VERS_2.0");
> +
> +__attribute__ ((noinline, noclone))
> +int
> +bar (void)
> +{
> +  return (intptr_t) &foo == 0x12345678 ? 1 : 0;
> +}
> +
> +int
> +main(void)
> +{
> +  bar ();
> +  printf("PASS\n");
> +  return 0;
> +}

noclone attribute was added to GCC 4.5.  We should check GCC version
before using it.  Committed.

* ld-elf/pr18718.c (bar): Use noclone attribute only for GCC
4.5 or newer.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-noclone-attribute-only-for-GCC-4.5-or-newer.patch
Type: text/x-patch
Size: 1374 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150729/2918ec04/attachment.bin>


More information about the Binutils mailing list