<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 - section flag 'o' (SHF_LINK_ORDER) is incorrectly handled"
   href="https://bugs.llvm.org/show_bug.cgi?id=44775">44775</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>section flag 'o' (SHF_LINK_ORDER) is incorrectly handled
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>hjl.tools@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>[hjl@gnu-cfl-1 lld-1]$ cat x.s
        .section .text,"ax",%progbits,unique,1
        .globl _start
_start:
        .dc.a   xxx

        .section .text,"ax",%progbits,unique,2
xxx:
        .byte 0

        .section .text,"ax",%progbits,unique,3
yyy:
        .byte 0

        .section .foo,"ao",%progbits,yyy
        .dc.a   0
        .section .foo,"ao",%progbits,xxx
        .dc.a   0
[hjl@gnu-cfl-1 lld-1]$ make llvm.o
llvm-mc -filetype=obj -triple=x86_64 -o llvm.o x.s
[hjl@gnu-cfl-1 lld-1]$ readelf -SW llvm.o
There are 9 section headers, starting at offset 0x120:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
  [ 1] .strtab           STRTAB          0000000000000000 0000f0 000030 00     
0   0  1
  [ 2] .text             PROGBITS        0000000000000000 000040 000000 00  AX 
0   0  4
  [ 3] .text             PROGBITS        0000000000000000 000040 000008 00  AX 
0   0  1
  [ 4] .rela.text        RELA            0000000000000000 0000d8 000018 18     
8   3  8
  [ 5] .text             PROGBITS        0000000000000000 000048 000001 00  AX 
0   0  1
  [ 6] .text             PROGBITS        0000000000000000 000049 000001 00  AX 
0   0  1
  [ 7] .foo              PROGBITS        0000000000000000 00004a 000010 00  AL 
6   0  1
  [ 8] .symtab           SYMTAB          0000000000000000 000060 000078 18     
1   4  8
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  l (large), p (processor specific)
[hjl@gnu-cfl-1 lld-1]$ 

Only one section foo was generated and I got

[hjl@gnu-cfl-1 lld-1]$ make y.lld
ld.lld --gc-sections -o y.lld llvm.o
[hjl@gnu-cfl-1 lld-1]$ readelf -SW y.lld
There are 6 section headers, starting at offset 0x2098:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
  [ 1] .text             PROGBITS        0000000000201000 001000 000009 00  AX 
0   0  1
  [ 2] .comment          PROGBITS        0000000000000000 002000 000012 01  MS 
0   0  1
  [ 3] .symtab           SYMTAB          0000000000000000 002018 000048 18     
5   2  8
  [ 4] .shstrtab         STRTAB          0000000000000000 002060 00002a 00     
0   0  1
  [ 5] .strtab           STRTAB          0000000000000000 00208a 00000c 00     
0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  l (large), p (processor specific)
[hjl@gnu-cfl-1 lld-1]$ 

Section foo is missing.  I am expecting:

[hjl@gnu-cfl-1 lld-1]$ make x.o
as  -o x.o x.s
[hjl@gnu-cfl-1 lld-1]$ readelf -SW x.o
There are 14 section headers, starting at offset 0x240:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
  [ 1] .text             PROGBITS        0000000000000000 000040 000000 00  AX 
0   0  1
  [ 2] .data             PROGBITS        0000000000000000 000040 000000 00  WA 
0   0  1
  [ 3] .bss              NOBITS          0000000000000000 000040 000000 00  WA 
0   0  1
  [ 4] .text             PROGBITS        0000000000000000 000040 000008 00  AX 
0   0  1
  [ 5] .rela.text        RELA            0000000000000000 0001d8 000018 18   I
11   4  8
  [ 6] .text             PROGBITS        0000000000000000 000048 000001 00  AX 
0   0  1
  [ 7] .text             PROGBITS        0000000000000000 000049 000001 00  AX 
0   0  1
  [ 8] .foo              PROGBITS        0000000000000000 00004a 000008 00  AL 
7   0  1
  [ 9] .foo              PROGBITS        0000000000000000 000052 000008 00  AL 
6   0  1
  [10] .note.gnu.property NOTE            0000000000000000 000060 000030 00   A
 0   0  8
  [11] .symtab           SYMTAB          0000000000000000 000090 000138 18    
12  12  8
  [12] .strtab           STRTAB          0000000000000000 0001c8 000010 00     
0   0  1
  [13] .shstrtab         STRTAB          0000000000000000 0001f0 000049 00     
0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  l (large), p (processor specific)
[hjl@gnu-cfl-1 lld-1]$ make x.lld
ld.lld --gc-sections -o x.lld x.o
[hjl@gnu-cfl-1 lld-1]$ readelf -SW x.lld
There are 7 section headers, starting at offset 0x20a0:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
  [ 1] .foo              PROGBITS        0000000000200120 000120 000008 00  AL 
2   0  1
  [ 2] .text             PROGBITS        0000000000201000 001000 000009 00  AX 
0   0  1
  [ 3] .comment          PROGBITS        0000000000000000 002000 000012 01  MS 
0   0  1
  [ 4] .symtab           SYMTAB          0000000000000000 002018 000048 18     
6   2  8
  [ 5] .shstrtab         STRTAB          0000000000000000 002060 00002f 00     
0   0  1
  [ 6] .strtab           STRTAB          0000000000000000 00208f 00000c 00     
0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  l (large), p (processor specific)
[hjl@gnu-cfl-1 lld-1]$</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>