This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [commited, PATCH] PR ld/18718: Skip missing symbol version section check for executable
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Wed, 29 Jul 2015 11:24:37 -0700
- Subject: Re: [commited, PATCH] PR ld/18718: Skip missing symbol version section check for executable
- Authentication-results: sourceware.org; auth=none
- References: <20150725150719 dot GA28171 at gmail dot com>
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.
From 60b57502ec8b600dac3fe53aa6615965f0430a6d Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 29 Jul 2015 11:20:04 -0700
Subject: [PATCH] Use noclone attribute only for GCC 4.5 or newer
noclone attribute was added to GCC 4.5. We should check GCC version
before using it.
* ld-elf/pr18718.c (bar): Use noclone attribute only for GCC
4.5 or newer.
---
ld/testsuite/ChangeLog | 5 +++++
ld/testsuite/ld-elf/pr18718.c | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index a9e5a7b..267361f 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2015-07-29 H.J. Lu <hongjiu.lu@intel.com>
+ * ld-elf/pr18718.c (bar): Use noclone attribute only for GCC
+ 4.5 or newer.
+
+2015-07-29 H.J. Lu <hongjiu.lu@intel.com>
+
* ld-size/size.exp: Move run-time support check.
2015-07-28 Alan Modra <amodra@gmail.com>
diff --git a/ld/testsuite/ld-elf/pr18718.c b/ld/testsuite/ld-elf/pr18718.c
index 2f4c2a3..5ec1b9e 100644
--- a/ld/testsuite/ld-elf/pr18718.c
+++ b/ld/testsuite/ld-elf/pr18718.c
@@ -11,7 +11,11 @@ new_foo (void)
__asm__(".symver new_foo, foo@@VERS_2.0");
+#if defined(__GNUC__) && (__GNUC__ * 1000 + __GNUC_MINOR__) >= 4005
__attribute__ ((noinline, noclone))
+#else
+__attribute__ ((noinline))
+#endif
int
bar (void)
{
--
2.4.3