From c49790ef3421917417e9edfd34dce294c78e42bc Mon Sep 17 00:00:00 2001 From: Hariharan Devarajan Date: Tue, 28 Nov 2023 12:47:50 -0800 Subject: [PATCH] fixed symbol versioning test case --- .github/workflows/build-and-test.yaml | 2 +- test/symver/retX_new.c | 9 +++------ test/symver/retX_old.c | 7 ++----- test/symver/sym_macro.h | 20 ++++++++++++++++++++ 4 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 test/symver/sym_macro.h diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index a7ca264..e9a6667 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, ubuntu-22.04 ] + os: [ubuntu-20.04, ubuntu-22.04, ubuntu-23.04] name: ${{ matrix.os }} diff --git a/test/symver/retX_new.c b/test/symver/retX_new.c index 3a5c792..48be5ae 100644 --- a/test/symver/retX_new.c +++ b/test/symver/retX_new.c @@ -12,9 +12,6 @@ for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -int retX_new(int x) { return x; } -__asm__( - "\t.globl __retX_new\n" - "\t.equiv __retX_new,retX_new\n" - "\t.symver __retX_new,retX@@GOTCHA_2"); +#include "sym_macro.h" +SYMVER_ATTRIBUTE (retX_new, retX@@GOTCHA_2) +int retX_new(int x) { return x; } \ No newline at end of file diff --git a/test/symver/retX_old.c b/test/symver/retX_old.c index 07312b2..1034f56 100644 --- a/test/symver/retX_old.c +++ b/test/symver/retX_old.c @@ -12,9 +12,6 @@ for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - +#include "sym_macro.h" +SYMVER_ATTRIBUTE (retX_old, retX@GOTCHA_1) int retX_old(int x) { return -x; } -__asm__( - "\t.globl __retX_old\n" - "\t.equiv __retX_old,retX_old\n" - "\t.symver __retX_old,retX@GOTCHA_1"); diff --git a/test/symver/sym_macro.h b/test/symver/sym_macro.h new file mode 100644 index 0000000..8fa1fb8 --- /dev/null +++ b/test/symver/sym_macro.h @@ -0,0 +1,20 @@ +// +// Created by haridev on 11/28/23. +// + +#ifndef GOTCHA_SYM_MACRO_H +#define GOTCHA_SYM_MACRO_H +#ifdef __has_attribute +#if __has_attribute (__symver__) +#define SYMVER_ATTRIBUTE(sym, symver) \ + __attribute__ ((__symver__ (#symver))) +#endif +#endif +#ifndef SYMVER_ATTRIBUTE +#define SYMVER_ATTRIBUTE(sym, symver) \ + __asm__( \ + "\t.globl __" #sym "\n" \ + "\t.equiv __" #sym "," #sym "\n" \ + "\t.symver __" #sym "," #symver); +#endif +#endif // GOTCHA_SYM_MACRO_H