Skip to content
  • Mikulas Patocka's avatar
    objtool: Fix 64-bit build on 32-bit host · 14c47b54
    Mikulas Patocka authored
    The new ORC unwinder breaks the build of a 64-bit kernel on a 32-bit
    host.  Building the kernel on a i386 or x32 host fails with:
    
      orc_dump.c: In function 'orc_dump':
      orc_dump.c:105:26: error: passing argument 2 of 'elf_getshdrnum' from incompatible pointer type [-Werror=incompatible-pointer-types]
        if (elf_getshdrnum(elf, &nr_sections)) {
                                ^
      In file included from /usr/local/include/gelf.h:32:0,
                       from elf.h:22,
                       from warn.h:26,
                       from orc_dump.c:20:
      /usr/local/include/libelf.h:304:12: note: expected 'size_t * {aka unsigned int *}' but argument is of type 'long unsigned int *'
       extern int elf_getshdrnum (Elf *__elf, size_t *__dst);
                  ^~~~~~~~~~~~~~
      orc_dump.c:190:17: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'Elf64_Sxword {aka long long int}' [-Werror=format=]
          printf("%s+%lx:", name, rela.r_addend);
            ...
    14c47b54