[llvm-bugs] [Bug 41356] New: LLD does not handle " " in InputSectionDescriptions correctly

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 3 00:25:46 PDT 2019


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

            Bug ID: 41356
           Summary: LLD does not handle " " in InputSectionDescriptions
                    correctly
           Product: lld
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: peter.smith at linaro.org
                CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org

According to the ld manual, strings containing separation characters can be
double quoted. The intention is that the double quotes are not part of the
string.

https://sourceware.org/binutils/docs/ld/Script-Format.html#Script-Format
Strings such as file or format names can normally be entered directly. If the
file name contains a character such as a comma which would otherwise serve to
separate file names, you may put the file name in double quotes. There is no
way to use a double quote character in a file name.

LLD isn't getting this right, it is treating the " as a required character in
the string.

cat match.s
         .section "my name with quotes", "aw", %progbits
 lab:    .word 10

cat match.lds
SECTIONS {
    .data : { *("my name with quotes") }
}

ld.bfd match.o -T match.lds --print-map

.data           0x0000000000000000        0x2
 *(my name with quotes)
 my name with quotes
                0x0000000000000000        0x2 match.o

ld.lld match.o -T match.lds --print-map
               0                0        0     1 .data
               0                0        0     1         match.o:(.data)
               0                0        2     1 my name with quotes
               0                0        2     1         match.o:(my name with
quotes)

Note that lld has not matched the section my name with quotes to *("my name
with quotes")

If I change .section "\"my name with quotes\"", "aw", %progbits then the
results change so that ld.bfd does not match *("my name with quotes") but LLD
does.

ld.bfd
my name with quotes"
                0x0000000000000000        0x2
 "my name with quotes"
                0x0000000000000000        0x2 match.o


ld.lld
               0                0        0     1         match.o:(.text)
               0                0        2     1 .data
               0                0        2     1         match.o:("my name with
quotes")
               0                0        0     1                 lab
               2                2        0     1         match.o:(.data)


Found by trying to link the Zephyr RTOS https://www.zephyrproject.org with LLD.

-- 
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/20190403/30c4683e/attachment.html>


More information about the llvm-bugs mailing list