This patch addresses two closely related bugs: https://bugs.llvm.org/show_bug.cgi?id=42930 and https://bugs.llvm.org/show_bug.cgi?id=42931. GNU readelf prints the file name for every input unless there is only one input and that input is not an archive. This patch adds the printing for multiple inputs. A previous change did it for archives, but introduced a regression with GNU compatibility for single-output formatting, resulting in a spurious initial blank line. This is fixed in this patch too.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
| test/tools/llvm-readobj/file-name.test | ||
|---|---|---|
| 28 ↗ | (On Diff #214154) | To test the first line is blank: # NAME1: {{^$}} This is what readelf does (since its initial import in 1999): /* Process the file. */
if (show_name)
printf (_("\nFile: %s\n"), filedata->file_name);I think the blank line is pretty arbitrary. It is there just because it was easy to implement... |
| test/tools/llvm-readobj/file-name.test | ||
|---|---|---|
| 28 ↗ | (On Diff #214154) | I agree that the line is arbitrary. Unfortunately, I've noticed a local parsing script that relies on it in some cases, so I'd be surprised if there aren't others out there doing the same thing.
I knew that somebody would comment on this :) I was just typing out this response, when I realised that we don't need the added complexity:
I realised however that FileCheck ensures that the first check matches the first line, and then the CHECK-NEXT matches the next, so it can't be an arbitrary location. I'll update the test before committing. |