OSDev.org
https://forum.osdev.org/

What is wrong with this shared object?
https://forum.osdev.org/viewtopic.php?f=13&t=33359
Page 1 of 1

Author:  Icee [ Fri Dec 07, 2018 7:07 am ]
Post subject:  Re: What is wrong with this shared object?

Code:
$ LD_LIBRARY_PATH=. ./1 
./1: error while loading shared libraries: libhello.so: failed to map segment from shared object


You seem to have a problem with your program headers:

Code:
Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  NULL           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000         0
  LOAD           0x0000000000000000 0x0000000000001000 0x0000000000001000
                 0x0000000000000000 0x0000000000000000  RW     1000
  LOAD           0x0000000000001000 0x0000000000001000 0x0000000000001000
                 0x0000000000000000 0x0000000000000000  RW     1000
  LOAD           0x0000000000001000 0x0000000000000000 0x0000000000000000
                 0x0000000000000016 0x0000000000000016  R E    1000
  LOAD           0x0000000000002000 0x0000000000001000 0x0000000000001000
                 0x00000000000001f1 0x00000000000001f1  RWE    1000
  DYNAMIC        0x00000000000020f8 0x00000000000010f8 0x00000000000010f8
                 0x00000000000000d0 0x00000000000000d0  RWE    1000


I see three issues here: (1) the first two LOAD segments are both zero size; (2) the other two LOAD segments overlap the first two; (3) the DYNAMIC segment is misaligned -- the alignment is set to 1000 but its address is not page-aligned.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/