diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index a7ca264..ab623f2 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] name: ${{ matrix.os }} diff --git a/src/gotcha_auxv.c b/src/gotcha_auxv.c index abffc58..9fe0984 100644 --- a/src/gotcha_auxv.c +++ b/src/gotcha_auxv.c @@ -90,7 +90,7 @@ struct link_map *get_vdso_from_auxv() { ElfW(Phdr) *vdso_phdrs = NULL; ElfW(Half) vdso_phdr_num, p; - ElfW(Addr) vdso_dynamic; + ElfW(Addr) vdso_dynamic = 0; parse_auxv_contents(); if (vdso_ehdr) { diff --git a/test/hammer/CMakeLists.txt b/test/hammer/CMakeLists.txt index 748bd6e..e64ba9f 100644 --- a/test/hammer/CMakeLists.txt +++ b/test/hammer/CMakeLists.txt @@ -14,7 +14,7 @@ set(XSIZE 1) set(YSIZE 1) set(CMAKE_BUILD_TYPE Debug) -SET(CMAKE_CXX_FLAGS_DEBUG " ${CMAKE_CXX_FLAGS_DEBUG} -O0 -Wall -Werror -Wextra") +SET(CMAKE_CXX_FLAGS_DEBUG " ${CMAKE_CXX_FLAGS_DEBUG} -Wall -Werror -Wextra") add_definitions(-DXSIZE=${XSIZE}) add_definitions(-DYSIZE=${YSIZE}) diff --git a/test/symver/retX_new.c b/test/symver/retX_new.c index a16a09f..b72bb2d 100644 --- a/test/symver/retX_new.c +++ b/test/symver/retX_new.c @@ -12,9 +12,8 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - +#include "sym_macro.h" +// clang-format off +SYMVER_ATTRIBUTE(retX_new, retX@@GOTCHA_2) 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"); +// clang-format on \ No newline at end of file diff --git a/test/symver/retX_old.c b/test/symver/retX_old.c index ebf9a3b..39612a3 100644 --- a/test/symver/retX_old.c +++ b/test/symver/retX_old.c @@ -12,9 +12,9 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "sym_macro.h" +// clang-format off +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"); +// clang-format on diff --git a/test/symver/sym_macro.h b/test/symver/sym_macro.h new file mode 100644 index 0000000..80b5d0e --- /dev/null +++ b/test/symver/sym_macro.h @@ -0,0 +1,16 @@ +#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