[PATCH v2] gold: Use asm for GCC 9 and older in PR gold/31830 tests
H.J. Lu
hjl.tools@gmail.com
Sat Aug 24 15:33:46 GMT 2024
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) {}
^~~~
use asm statement, instead of symver attribute, for GCC 9 and older.
PR gold/31830
* testsuite/ver_test_pr31830_b.c (__collector_foo_2_2): Use asm
statement, instead of symver attribute, for GCC 9 and older.
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 | 4 ++++
gold/testsuite/ver_test_pr31830_lto.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/gold/testsuite/ver_test_pr31830_b.c b/gold/testsuite/ver_test_pr31830_b.c
index aba07cc6305..4464d05e17a 100644
--- a/gold/testsuite/ver_test_pr31830_b.c
+++ b/gold/testsuite/ver_test_pr31830_b.c
@@ -1,3 +1,7 @@
extern void __collector_foo_2_2(void);
+#if defined(__GNUC__) && __GNUC__ >= 10
__attribute__((__symver__("foo@GLIBC_2.2.5")))
+#else
+__asm__ (".symver __collector_foo_2_2, foo@GLIBC_2.2.5");
+#endif
void __collector_foo_2_2(void) {}
diff --git a/gold/testsuite/ver_test_pr31830_lto.c b/gold/testsuite/ver_test_pr31830_lto.c
index 999dd63f884..862ac68bfd6 100644
--- a/gold/testsuite/ver_test_pr31830_lto.c
+++ b/gold/testsuite/ver_test_pr31830_lto.c
@@ -1,5 +1,9 @@
extern __inline __attribute__((__gnu_inline__)) void foo(void) {}
extern void __collector_foo_2_2(void);
+#if defined(__GNUC__) && __GNUC__ >= 10
__attribute__((__symver__("foo@GLIBC_2.2.5")))
+#else
+__asm__ (".symver __collector_foo_2_2, foo@GLIBC_2.2.5");
+#endif
void __collector_foo_2_2(void) {}
void foo(void) {}
--
2.46.0
More information about the Binutils
mailing list