[Bug 225775] btxld does not handle input with other than 2 PT_LOAD segments

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Feb 9 00:05:52 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225775

--- Comment #2 from Ed Maste <emaste at freebsd.org> ---
It is because lld collects read-only contents into a separate segment, for
example:

% readelf -l zfsloader.sym

Elf file type is EXEC (Executable file)
Entry point 0x0
There are 5 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x00000000 0x00000000 0x58694 0x58694 R E 0x1000
  LOAD           0x05a000 0x00059000 0x00059000 0x0afcc 0x0afcc R   0x1000
  LOAD           0x065000 0x00064000 0x00064000 0x07854 0x14c9c RW  0x1000
  GNU_RELRO      0x06c000 0x0006b000 0x0006b000 0x00854 0x01000 R   0x1
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0

 Section to Segment mapping:
  Segment Sections...
   00     .text .gnu_debuglink .comment .debug_str .debug_loc .debug_abbrev
.debug_info .debug_ranges .debug_macinfo .debug_pubnames .debug_pubtypes
.debug_frame .debug_line .debug_aranges .symtab .shstrtab .strtab 
   01     .rodata set_Xcommand_set 
   02     .data set_Xficl_compile_set .data.rel.ro .got .bss 
   03     .data.rel.ro .got 
   04     

Linking with -z norelro leaves the three PT_LOADs, just the PT_GNU_RELRO is not
emitted. From the output above btxld should coalesce two PT_LOADs, and
discarding a PT_LOAD should be an error not a warning.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list