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: unassignedb...@nondot.org
          Reporter: peter.sm...@linaro.org
                CC: llvm-bugs@lists.llvm.org, peter.sm...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to