[llvm-bugs] [Bug 36017] New: lld ignoring LMA for some sections

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 19 09:04:11 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36017

            Bug ID: 36017
           Summary: lld ignoring LMA for some sections
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: royger at freebsd.org
                CC: llvm-bugs at lists.llvm.org

Created attachment 19713
  --> https://bugs.llvm.org/attachment.cgi?id=19713&action=edit
FreeBSD amd64 linker script

Hello,

When linking the FreeBSD amd64 kernel with lld it seems the LMA of some
sections is not correctly set, this is the output:

# readelf -l /boot/kernel/kernel

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

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flg    Align
  PHDR           0x0000000000000040 0xffffffff80200040 0xffffffff80200040
                 0x0000000000000230 0x0000000000000230  R      0x8
  INTERP         0x0000000000000270 0xffffffff80200270 0x0000000000200270
                 0x000000000000000d 0x000000000000000d  R      0x1
      [Requesting program interpreter: /red/herring]
  LOAD           0x0000000000000000 0xffffffff80200000 0xffffffff80200000
                 0x0000000000000270 0x0000000000000270  R E    0x1000
  LOAD           0x0000000000000270 0xffffffff80200270 0x0000000000200270
                 0x0000000001576478 0x0000000001576d90  R E    0x1000
  LOAD           0x0000000001577000 0xffffffff81777000 0x0000000001777000
                 0x0000000000155888 0x0000000000681a40  RW     0x1000
  DYNAMIC        0x0000000001577000 0xffffffff81777000 0x0000000001777000
                 0x00000000000000f0 0x00000000000000f0  RW     0x8
  GNU_RELRO      0x0000000001577000 0xffffffff81777000 0x0000000001777000
                 0x00000000000000f0 0x00000000000000f0  R      0x1
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0
  NOTE           0x00000000015766c4 0xffffffff817766c4 0x00000000017766c4
                 0x0000000000000024 0x0000000000000024  R      0x4
  NOTE           0x00000000086607e0 0x0000000000000000 0x0000000080000000
                 0x0000000000000000 0x0000000000000000  R      0x4

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02
   03     .interp .hash .gnu.hash .dynsym .dynstr .text .rodata .eh_frame
set_sysctl_set set_sysinit_set set_sysuninit_set set_modmetadata_set
set_cam_xpt_xport_set set_cam_xpt_proto_set set_kdb_dbbe_set set_ah_chips
set_ah_rfs set_kbddriver_set set_sdt_providers_set set_sdt_probes_set
set_sdt_argtypes_set set_cons_set set_gdb_dbgport_set usb_host_id
set_vt_drv_set set_ratectl_set set_crypto_set set_ieee80211_ioctl_getset
set_ieee80211_ioctl_setset set_scanner_set set_videodriver_set set_scterm_set
set_scrndr_set set_vga_set kern_conf .note.gnu.build-id .preinit_array
.init_array .fini_array .data.rel.ro
   04     .preinit_array .init_array .fini_array .data.rel.ro .dynamic
.data.read_frequently .data.read_mostly .data.exclusive_cache_line .data
set_pcpu set_vnet .bss .ldata
   05     .preinit_array .init_array .fini_array .data.rel.ro .dynamic
   06     .preinit_array .init_array .fini_array .data.rel.ro .dynamic
   07     __xen_guest
   08     .note.gnu.build-id
   09     __xen_guest

Note that the first and the third program headers have a wrong physical
address.

The linker script used is attached to this ticket.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180119/7e7f1289/attachment.html>


More information about the llvm-bugs mailing list