[llvm-bugs] [Bug 42931] New: Remove extra blank line regression in GNU output for single input

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 8 03:59:45 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42931

            Bug ID: 42931
           Summary: Remove extra blank line regression in GNU output for
                    single input
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: llvm-readobj
          Assignee: unassignedbugs at nondot.org
          Reporter: jh7370.2008 at my.bristol.ac.uk
                CC: jh7370.2008 at my.bristol.ac.uk, llvm-bugs at lists.llvm.org

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 bug 42930, 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);
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190808/4c4578e3/attachment.html>


More information about the llvm-bugs mailing list