<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 - Output sections marked NOLOAD with no input sections are given type SHT_PROGBITS"
   href="https://bugs.llvm.org/show_bug.cgi?id=45336">45336</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Output sections marked NOLOAD with no input sections are given type SHT_PROGBITS
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>schultetwin1@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, smithp352@googlemail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>lld will ignore the NOLOAD annotation of output sections which have no
associated inputs sections.

Repro steps

1. Create a linker script with two output sections. One that contains an input
section and one that contains no input sections. The later should be marked as
NOLOAD.

```bash
echo "SECTIONS {
  .text : { *(.text) }
  .data_noload (NOLOAD) : { . += 1; }
};" > tmp.script
```

2. Create an output object which has some data in it

```bash
echo ".section .text,\"ax\",@progbits
  nop" > tmp.asm

llvm-mc -filetype=obj -triple=x86_64-unknown-linux tmp.asm -o tmp.o
```

3) Link the object file using the script

```bash
ld.lld -o tmp --script tmp.script tmp.o
```

4) Use readelf to dump the sections

```bash
llvm-readelf tmp -S -l
```

I expect to see .data_noload marked as NOBITS but instead I see it marked as
PROGBITS.</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>