Bug ID: 41169
           Summary: Symbol assignments within output sections are not
                    relative to enclosing section
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF

To reproduce:

$ cat > test.ld <<EOF
  .foo 0x10000 : {
    . = 4;
    foo = .;

$ clang -xc - -o empty.o < /dev/null
$ ld.lld empty.o -Ttest.ld
ld.lld: error: test.ld:3: unable to move location counter backward for: .foo
ld.lld: error: section .foo at 0x10000 of size 0xFFFFFFFFFFFF0004 exceeds
available address space

It works with ld.bfd:

$ ld.bfd empty.o -Ttest.ld
$ readelf -s a.out | grep foo
     4: 0000000000010004     0 NOTYPE  GLOBAL DEFAULT    1 foo


ld.bfd treats numbers in an output section as relative to the beginning of the
so the assignment `. = 4` actually moves dot to 0x10004.

In lld, `. = 4` tries to move dot backwards to absolute address 4, which is not
allowed within an output section.

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to