[llvm-bugs] [Bug 35987] New: Error when using linker scripts with ADDR and section names with '-'

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 17 07:49:28 PST 2018


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

            Bug ID: 35987
           Summary: Error when using linker scripts with ADDR and section
                    names with '-'
           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

Hello,

I have the following sample linker script, it's basically an extract of a much
bigger linker file

---
SECTIONS
{
        .note.gnu.build-id : AT(ADDR(.note.gnu.build-id)) {
                *(.note.gnu.build-id)
        } :text
}
---

Which I try to use with lld, giving the following error:

$ ld --build-id=sha1 -T test.lds
ld: error: test.lds:3: ) expected, but got -
ld: error: test.lds:3:  .note.gnu.build-id : AT(ADDR(.note.gnu.build-id)) {
ld: error: test.lds:3:                                              ^
ld: error: target emulation unknown: -m or at least one .o file required

Ignoring the error about the lack of input files or emulation, it seems like
ADDR somehow checks that the parameter of ADDR is not an expression, but fails
to realise that sections can have '-' in their names.

The output with GNU ld is:

$ ld --build-id=sha1 -T test.lds
/usr/local/bin/ld: no input files

And I can confirm using ADDR(.note.gnu.build-id) with GNU ld works fine.

Thanks, Roger.

-- 
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/20180117/475badc9/attachment.html>


More information about the llvm-bugs mailing list