[PATCH] gold: Use __asm__ in PR gold/31830 tests

H.J. Lu hjl.tools@gmail.com
Sat Aug 24 15:34:09 GMT 2024


On Sat, Aug 24, 2024 at 7:09 AM Sam James <sam@gentoo.org> wrote:
>
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
> > Since GCC 9 and older fail to compile PR gold/31830 tests:
> >
> > $ gcc -S testsuite/ver_test_pr31830_b.c -o /tmp/x.s
> > testsuite/ver_test_pr31830_b.c:3:1: warning: ‘__symver__’ attribute directive ignored [-Wattributes]
> >  void __collector_foo_2_2(void) {}
> >  ^~~~
> >
> > replace symver attribute with __asm__.
>
> Can you conditionalise it on GCC version instead? We've had a lot of
> problems with either variant not working with LTO before and it'd be
> nice to not lose that coverage.

Fixed in v2.

Thanks.

>
> >
> >       PR gold/31830
> >       * testsuite/ver_test_pr31830_b.c (__collector_foo_2_2): Replace
> >       symver attribute with __asm__.
> >       * testsuite/ver_test_pr31830_lto.c (__collector_foo_2_2): Likewise.
> >
> > Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> > ---
> >  gold/testsuite/ver_test_pr31830_b.c   | 2 +-
> >  gold/testsuite/ver_test_pr31830_lto.c | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/gold/testsuite/ver_test_pr31830_b.c b/gold/testsuite/ver_test_pr31830_b.c
> > index aba07cc6305..41a36ef052e 100644
> > --- a/gold/testsuite/ver_test_pr31830_b.c
> > +++ b/gold/testsuite/ver_test_pr31830_b.c
> > @@ -1,3 +1,3 @@
> >  extern void __collector_foo_2_2(void);
> > -__attribute__((__symver__("foo@GLIBC_2.2.5")))
> >  void __collector_foo_2_2(void) {}
> > +__asm__ (".symver __collector_foo_2_2, foo@GLIBC_2.2.5");
> > diff --git a/gold/testsuite/ver_test_pr31830_lto.c b/gold/testsuite/ver_test_pr31830_lto.c
> > index 999dd63f884..9f00bbf5409 100644
> > --- a/gold/testsuite/ver_test_pr31830_lto.c
> > +++ b/gold/testsuite/ver_test_pr31830_lto.c
> > @@ -1,5 +1,5 @@
> >  extern __inline __attribute__((__gnu_inline__)) void foo(void) {}
> >  extern void __collector_foo_2_2(void);
> > -__attribute__((__symver__("foo@GLIBC_2.2.5")))
> >  void __collector_foo_2_2(void) {}
> >  void foo(void) {}
> > +__asm__ (".symver __collector_foo_2_2, foo@GLIBC_2.2.5");



-- 
H.J.


More information about the Binutils mailing list