[llvm-bugs] [Bug 50004] New: -z separate-loadable-segments doesn't work with LTO enabled

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 16 12:44:26 PDT 2021


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

            Bug ID: 50004
           Summary: -z separate-loadable-segments doesn't work with LTO
                    enabled
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: rianquinn at gmail.com
                CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com

If I enabled LTO "using "-flto" in clang, and I include -z
separate-loadable-segments (or remove it, as it doesn't seem to make a
difference), I get the following:

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz
  Flg Align
  LOAD           0x001000 0x0000028000000000 0x0000028000000000 0x001f48
0x001f48 R   0x1000
  LOAD           0x003000 0x0000028000002000 0x0000028000002000 0x020325
0x020325 R E 0x1000
  LOAD           0x024328 0x0000028000022328 0x0000028000022328 0x006e80
0x01f2d1 RW  0x1000
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW  0

The RW section is not properly aligned. I am using version 11. Below is my
linker script. I am not sure if this is a bug or not, and it works fine when
LTO is disabled, but I would like to enable LTO and I am not sure what I am
doing wrong at this point. 

ENTRY(mk_main_entry)
OUTPUT_FORMAT(elf64-x86-64)

SECTIONS {
    . = 0x0000028000000000;
    .text : ALIGN(0x1000) {
        *(.text)
    }
    .init : ALIGN(0x1000) {
        *(.init)
    }
    .init_array : ALIGN(0x1000) {
        *(.init_array)
    }
    .fini : ALIGN(0x1000) {
        *(.fini)
    }
    .fini_array : ALIGN(0x1000) {
        *(.fini_array)
    }
    .rodata : ALIGN(0x1000) {
        *(.rodata)
    }
    .data : ALIGN(0x1000) {
        *(.data)
    }
    .bss : ALIGN(0x1000) {
        *(.bss)
    }
}

-- 
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/20210416/7421e68c/attachment.html>


More information about the llvm-bugs mailing list