hikalium / liumos

A toy operating system which supports NVDIMM natively.
MIT License
270 stars 24 forks source link

My RDBMS doesn't start on liumos #58

Closed KOBA789 closed 3 years ago

KOBA789 commented 3 years ago

(as you know, my RDBMS is "that")

It seems to fail to parse ELF program header.

LOAD program header idx: 0x1
LOAD program header idx: 0x2
LOAD program header idx: 0x3
assertion "!seg_map->GetMapSize()" failed: file "elf.cc", line 103, function: const Elf64_Ehdr *ParseProgramHeader(EFIFile &, ProcessMappingInfo &, PhdrMappingInfo &)
---- Begin Panic ----
getpid
halt...
----  End  Panic ----

readelf -l says:


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

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000200040 0x0000000000200040
                 0x0000000000000188 0x0000000000000188  R      0x8
  LOAD           0x0000000000000000 0x0000000000200000 0x0000000000200000
                 0x000000000001018e 0x000000000001018e  R E    0x1000
  LOAD           0x0000000000010190 0x0000000000211190 0x0000000000211190
                 0x0000000000001180 0x0000000000001180  RW     0x1000
  LOAD           0x0000000000011310 0x0000000000213310 0x0000000000213310
                 0x0000000000000000 0x0000000000100008  RW     0x1000
  GNU_RELRO      0x0000000000010190 0x0000000000211190 0x0000000000211190
                 0x0000000000001180 0x0000000000001e70  R      0x1
  GNU_EH_FRAME   0x0000000000002114 0x0000000000202114 0x0000000000202114
                 0x0000000000000034 0x0000000000000034  R      0x4
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x0

 Section to Segment mapping:
  Segment Sections...
   00
   01     .rodata .eh_frame_hdr .eh_frame .text
   02     .data.rel.ro .got
   03     .bss
   04     .data.rel.ro .got
   05     .eh_frame_hdr
   06

I found my executable has more than one RW segment. (I have no idea why it does)

The code is still not public but I can try compiling them with other linker options.

KOBA789 commented 3 years ago

This issue was solved by passing -z norelro to linker. I think it is an important tip to run programs written in Rust on liumOS.