advanced-microcode-patching / shiva

A custom ELF linker/loader for installing ET_REL binary patches at runtime
Other
146 stars 13 forks source link

shiva-ld.c: error: ‘ELF_LOAD_F_PRIV_MAP’ undeclared #25

Closed milahu closed 5 months ago

milahu commented 5 months ago
gcc  -ggdb shiva-ld.c -o shiva-ld /nix/store/cbblpyx7izddkl27v20xf5gjfcvz15i4-libelfmaster-0.4-alpha-unstable-2023-02-23/lib/libelfmaster.a /nix/store/jagvcafr5xbnriwg6xajw2brvcjxcwi1-capstone-4.0.2/lib/libcapstone.a
shiva-ld.c: In function ‘main’:
shiva-ld.c:1484:53: error: ‘ELF_LOAD_F_PRIV_MAP’ undeclared (first use in this function); did you mean ‘ELF_LOAD_F_STRICT’?
 1484 |                 ELF_LOAD_F_STRICT|ELF_LOAD_F_MODIFY|ELF_LOAD_F_PRIV_MAP, &error) == false) {
      |                                                     ^~~~~~~~~~~~~~~~~~~
      |                                                     ELF_LOAD_F_STRICT

shiva/tools/shiva-ld/shiva-ld.c

int main(int argc, char **argv)
{
// ...
  TAILQ_INIT(&ctx.tailq.xref_tqlist);
  TAILQ_INIT(&ctx.tailq.branch_tqlist);
  /*
   * Open the target executable, with modification privileges.
   */
  if (elf_open_object(ctx.input_exec, &ctx.bin.elfobj,
// FIXME error: ‘ELF_LOAD_F_PRIV_MAP’ undeclared
    ELF_LOAD_F_STRICT|ELF_LOAD_F_MODIFY|ELF_LOAD_F_PRIV_MAP, &error) == false) {
    fprintf(stderr, "elf_open_object(%s, ...) failed: %s\n",
        ctx.input_exec, elf_error_msg(&error));
    exit(EXIT_FAILURE);
  }

build scripts: shiva.nix and libelfmaster.nix

elfmaster commented 5 months ago

Hi Milahu, you must use the aarch64_support branch in libelfmaster, it has not yet been merged into the main libelfmaster branch. I apologize for the inconvenience.

milahu commented 5 months ago

you must use the aarch64_support branch in libelfmaster

aah! yes, that builds : )

i was looking for a x86_64 branch, to build the x86_64_port branch of shiva (#13)

elfmaster commented 5 months ago

Nice :) Yes if you run into more issues let me know. I haven't built a proper build system yet that easily handles both architectures.