[llvm-bugs] [Bug 38625] New: linker script parser rejects INFO output section type when used with a start address

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 17 23:22:11 PDT 2018


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

            Bug ID: 38625
           Summary: linker script parser rejects INFO output section type
                    when used with a start address
           Product: lld
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: djc at djc.id.au
                CC: llvm-bugs at lists.llvm.org

Lld supports INFO as an output section type, similar to NOLOAD. See:
https://bugs.llvm.org/show_bug.cgi?id=36298
https://sourceware.org/binutils/docs/ld/Output-Section-Type.html#Output-Section-Type

However it only accepts the (INFO) type when no start address is present. That
is, it rejects this:

  .stack _edata (INFO) :
  {

with this error:

lld: error: link.x:32: NOLOAD expected, but got INFO
>>>   .stack _edata (INFO) :
>>>                  ^

whereas it accepts the same without a specific start address:

  .stack (INFO) :
  {

Here is a more complete and somewhat realistic reproducer:

$ cat test.c 
void _start(void) {
}
$ gcc -nostdlib -nostartfiles -c test.c
$ cat link.x
MEMORY
{
  FLASH : ORIGIN = 0x20400000, LENGTH = 512M
  RAM : ORIGIN = 0x80000000, LENGTH = 16K
}
SECTIONS
{
  .text :
  {
    *(.text);
  } > FLASH

  .rodata :
  {
    *(.rodata);
  } > FLASH

  .bss :
  {
    *(.bss);
  } > RAM

  .data : AT(LOADADDR(.rodata) + SIZEOF(.rodata))
  {
    _sdata = .;
    *(.data);
    . = ALIGN(4);
    _edata = .;
  } > RAM

  PROVIDE(_stack_start = ORIGIN(RAM) + LENGTH(RAM));
  .stack _edata (INFO) :
  {
    _estack = .;
    . = _stack_start;
    _sstack = .;
  } > RAM

  /DISCARD/ :
  {
    *(.eh_frame);
  }
}
$ lld -flavor gnu -Tlink.x -o test test.o
lld: error: link.x:32: NOLOAD expected, but got INFO
>>>   .stack _edata (INFO) :
>>>                  ^

-- 
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/20180818/d9e827c5/attachment.html>


More information about the llvm-bugs mailing list