<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - LLD does not handle " " in InputSectionDescriptions correctly"
   href="https://bugs.llvm.org/show_bug.cgi?id=41356">41356</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLD does not handle " " in InputSectionDescriptions correctly
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>ELF
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>peter.smith@linaro.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.

<a href="https://sourceware.org/binutils/docs/ld/Script-Format.html#Script-Format">https://sourceware.org/binutils/docs/ld/Script-Format.html#Script-Format</a>
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 <a href="https://www.zephyrproject.org">https://www.zephyrproject.org</a> with LLD.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>