[haiku-bugs] [Haiku] #15820: kernel ELF loader don't support separate BSS segment

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Sun, 22 Mar 2020 21:44:24 -0000

#15820: kernel ELF loader don't support separate BSS segment
---------------------------+------------------------------
 Reporter:  X512           |        Owner:  nobody
     Type:  bug            |       Status:  new
 Priority:  normal         |    Milestone:  Unscheduled
Component:  System/Kernel  |      Version:  R1/Development
 Keywords:  clang lld      |   Blocked By:
 Blocking:                 |  Has a Patch:  0
 Platform:  All            |
---------------------------+------------------------------
 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
 }}}
-- 
Ticket URL: <https://dev.haiku-os.org/ticket/15820>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: