Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • test
2 results

handler_amd64.ld

  • Simon Ruderich's avatar
    166e6f59
    helper/handler_amd64: link with custom linker script · 166e6f59
    Simon Ruderich authored
    The old approach to extract only the .text segment was very hacky and
    did already break a few times, e.g. a7d0c60e ("helper: prevent string
    constants in .data with more force", 2018-06-05) and 19e417d2 ("helper:
    display unknown syscalls in ASM_HELPER", 2018-04-07).
    
    Instead we now use a custom linker script which includes only the .text
    and .rodata sections. This allows `objcopy -O binary` with all sections.
    
    This also fixes a regression with clang-4.0 which was broken on Sid
    since f9d69043 ("helper: enable most syscalls also in asm-helper mode",
    2018-06-19). The size increase of the switch statement in
    sandbox_syscall_dispatcher() caused clang to use a lookup table (in the
    .rodata section) which was not copied to the flat binary causing a
    crash.
    166e6f59
    History
    helper/handler_amd64: link with custom linker script
    Simon Ruderich authored
    The old approach to extract only the .text segment was very hacky and
    did already break a few times, e.g. a7d0c60e ("helper: prevent string
    constants in .data with more force", 2018-06-05) and 19e417d2 ("helper:
    display unknown syscalls in ASM_HELPER", 2018-04-07).
    
    Instead we now use a custom linker script which includes only the .text
    and .rodata sections. This allows `objcopy -O binary` with all sections.
    
    This also fixes a regression with clang-4.0 which was broken on Sid
    since f9d69043 ("helper: enable most syscalls also in asm-helper mode",
    2018-06-19). The size increase of the switch statement in
    sandbox_syscall_dispatcher() caused clang to use a lookup table (in the
    .rodata section) which was not copied to the flat binary causing a
    crash.