Opened 5 years ago

Last modified 5 years ago

#15819 new bug

haiku_loader ELF loader don't support separate BSS segment

Reported by: X512 Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/runtime_loader Version: R1/Development
Keywords: clang lld Cc:
Blocked By: Blocking:
Platform: All

Description

This is hrev53967.

LLVM linker lld produce separate LOAD entry with 0 file size for .bss section that is not handled by haiku_loader.

Place to be fixed: https://git.haiku-os.org/haiku/tree/src/system/boot/loader/elf.cpp#n204.

Following error is written to serial output:

load kernel kernel_x86_64...
elf: rw already handled!
unhandled pheader type 0x6474e552
unhandled pheader type 0x6474e551
relocating kernel failed: ffffffff!

Program header of kernel produced by lld:

> readelf -l kernel_x86_64 

Elf file type is EXEC (Executable file)
Entry point 0xffffffff8006c710
There are 8 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0xffffffff80000040 0xffffffff80000040
                 0x00000000000001c0 0x00000000000001c0  R      0x8
  INTERP         0x0000000000000200 0xffffffff80000200 0xffffffff80000200
                 0x000000000000000a 0x000000000000000a  R      0x1
      [Requesting program interpreter: /dev/null]
  LOAD           0x0000000000000000 0xffffffff80000000 0xffffffff80000000
                 0x00000000001a8498 0x00000000001a8498  R E    0x1000
  LOAD           0x00000000001a9000 0xffffffff801a9000 0xffffffff801a9000
                 0x0000000000001bf8 0x0000000000001bf8  RW     0x1000
  LOAD           0x00000000001aac00 0xffffffff801aac00 0xffffffff801aac00
                 0x0000000000000000 0x000000000003c5e0  RW     0x1000
  DYNAMIC        0x00000000001aab38 0xffffffff801aab38 0xffffffff801aab38
                 0x00000000000000c0 0x00000000000000c0  RW     0x8
  GNU_RELRO      0x00000000001aa9c0 0xffffffff801aa9c0 0xffffffff801aa9c0
                 0x0000000000000238 0x0000000000001000  R      0x1
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x0

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .hash .dynsym .dynstr .gnu.version .gnu.version_d .gnu.hash .text .rodata .altcodepatch 
   03     .data _haiku_revision .ctors .got .dynamic 
   04     .bss 
   05     .dynamic 
   06     .ctors .got .dynamic 
   07     

Change History (1)

comment:1 by nielx, 5 years ago

Component: - GeneralSystem/runtime_loader
Note: See TracTickets for help on using tickets.