Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined reference to __glibc_unlikely #41

Open
milahu opened this issue May 1, 2024 · 0 comments
Open

undefined reference to __glibc_unlikely #41

milahu opened this issue May 1, 2024 · 0 comments

Comments

@milahu
Copy link

milahu commented May 1, 2024

libelfmaster fails to compile with musl

gcc -I ./ -static shiva.o shiva_util.o shiva_signal.o shiva_ulexec.o shiva_auxv.o shiva_module.o shiva_trace.o shiva_trace_thread.o shiva_error.o shiva_maps.o shiva_analyze.o shiva_callsite.o shiva_target.o shiva_xref.o shiva_transform.o shiva_so.o shiva_post_linker.o /nix/store/rl8bajlymj1md1000f91gjhnvz0nrpwq-libelfmaster-0.4-alpha-unstable-2023-02-23/lib/libelfmaster.a /nix/store/jagvcafr5xbnriwg6xajw2brvcjxcwi1-capstone-4.0.2/lib/libcapstone.a -o './build'/shiva
/nix/store/a1kgwwyad44q620sym78yx5cwprgwqgs-binutils-2.40/bin/ld: /nix/store/rl8bajlymj1md1000f91gjhnvz0nrpwq-libelfmaster-0.4-alpha-unstable-2023-02-23/lib/libelfmaster.a(libelfmaster.o): in function `elf_scop_text_filesz':
(.text+0x3314): undefined reference to `__glibc_unlikely'

fix

    # fix: undefined reference to `__glibc_unlikely'
    #define __glibc_unlikely(cond) __builtin_expect ((cond), 0)
    substituteInPlace include/libelfmaster.h \
      --replace-fail \
        '#define peu_probable __glibc_unlikely' \
        '#define peu_probable(cond) __builtin_expect ((cond), 0)' \
$ grep -r -w __glibc_unlikely libelfmaster/
libelfmaster/include/libelfmaster.h:#define peu_probable __glibc_unlikely

based on gear-lib/gear-lib/libdebug/gcc.macro

#define __glibc_unlikely(cond) __builtin_expect ((cond), 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant