[llvm-bugs] [Bug 44903] New: /DISCARD/ section followed with a section with fill expression will cause link failure for newer version

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 13 17:30:58 PST 2020


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

            Bug ID: 44903
           Summary: /DISCARD/ section followed with a section with fill
                    expression will cause link failure for newer version
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: yadong.qi at intel.com
                CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org

When use newer version(>=9) of ld.lld, there will be link issue as below:
    ld.lld: error: linker.lds:14: malformed number: :
    >>>   /DISCARD/ :
    >>>

link script:
OUTPUT_FORMAT("elf64-x86-64","elf64-x86-64","elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)

ENTRY(main);

SECTIONS
{
  . = 0x10000;
  .text : { *(.text) }
  . = 0x8000000;
  .data : { *(.data) }
  .bss : { *(.bss) } =0x90909090

  /DISCARD/ :
  {
    *(.eh_frame)
  }
}

I have 2 ways to bypass the link issue:
  1. remove the fill expression " =0x90909090";
  2. add a section command before /DISCARD/, e.g.: ". = .;"

This issue only happens on newer version(>=9) of ld.lld, did not meet such
issue for old version.

-- 
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/20200214/ecd8bd72/attachment.html>


More information about the llvm-bugs mailing list