<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 - Remove extra blank line regression in GNU output for single input"
   href="https://bugs.llvm.org/show_bug.cgi?id=42931">42931</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Remove extra blank line regression in GNU output for single input
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>llvm-readobj
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jh7370.2008@my.bristol.ac.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jh7370.2008@my.bristol.ac.uk, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>r366147 added "File: <filename>" to precede the output whenever an archive was
specified to llvm-readelf. This matches GNU readelf. Additionally, it added a
blank line before this filename line, again matching GNU.

However, this change prints the blank line unconditionally. Whilst it should be
present for multiple inputs (as well as archives), it should not be present for
single inputs:

Archive (good matches GNU):

C:\Work> llvm-readelf.exe --sections test.a

File: C:\Work\TempWork\test.a(bar.o)
There are 26 section headers, starting at offset 0x4d8:
...

Multiple inputs (bad - missing "File:" lines - see <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Missing "File:" name line for GNU output when multiple inputs specified."
   href="show_bug.cgi?id=42930">bug 42930</a>, but blank line
included):

C:\Work> llvm-readelf.exe --sections test.elf test2.elf

There are 32 section headers, starting at offset 0x11b70:
...
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

There are 7 section headers, starting at offset 0x4050:
...

Single input (bad - extra blank line):

C:\Work> llvm-readelf.exe --sections test.elf
                                        <--- not present in GNU readelf output
There are 32 section headers, starting at offset 0x11b70:

My observation with GNU is that the blank line is only printed for multiple
inputs and archives. Essentially, I believe the printing goes something like:

if (Archive || Inputs.size() > 1) {
  printf("\nFile: %s\n", Name);
}</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>