Opened 21 months ago

Last modified 21 months ago

#15820 new bug

kernel ELF loader don't support separate BSS segment

Reported by: X512 Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/Kernel 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 kernel.

Place to be fixed: https://git.haiku-os.org/haiku/tree/src/system/kernel/elf.cpp#n1966.

Following error is written to serial output:

error mapping file data: Invalid Argument!
error starting "/boot/system/servers/launch_daemon" error = -1

Program header of runtime_loader produced by lld:

> readelf -l runtime_loader 

Elf file type is DYN (Shared object file)
Entry point 0x16e10
There are 7 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000000040 0x0000000000000040
                 0x0000000000000188 0x0000000000000188  R      0x8
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x00000000000330c4 0x00000000000330c4  R E    0x1000
  LOAD           0x00000000000330d0 0x00000000000340d0 0x00000000000340d0
                 0x0000000000001fb0 0x0000000000001fb0  RW     0x1000
  LOAD           0x0000000000035080 0x0000000000036080 0x0000000000036080
                 0x0000000000000000 0x0000000000000161  RW     0x1000
  DYNAMIC        0x0000000000034ea0 0x0000000000035ea0 0x0000000000035ea0
                 0x0000000000000100 0x0000000000000100  RW     0x8
  GNU_RELRO      0x0000000000033a08 0x0000000000034a08 0x0000000000034a08
                 0x0000000000001678 0x0000000000002000  R      0x1
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x0

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .hash .dynsym .dynstr .rela.plt .gnu.hash .rela.dyn .plt .text .rodata .gcc_except_table .eh_frame 
   02     .data .got.plt .ctors .data.rel.ro .dynamic .got 
   03     .bss 
   04     .dynamic 
   05     .ctors .data.rel.ro .dynamic .got .bss 
   06     

Change History (1)

comment:1 by X512, 21 months ago

Maybe similar problem is present in kernel add-on loader of kernel, I can't test it for now.

Note: See TracTickets for help on using tickets.