This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] Print empty line between note sections in GNU mode
ClosedPublic

Authored by arichardson on Feb 4 2021, 3:14 AM.

Diff Detail

Event Timeline

arichardson created this revision.Feb 4 2021, 3:14 AM
arichardson requested review of this revision.Feb 4 2021, 3:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 4 2021, 3:14 AM
rupprecht accepted this revision.Feb 4 2021, 8:25 AM
This revision is now accepted and ready to land.Feb 4 2021, 8:25 AM
MaskRay accepted this revision.Feb 4 2021, 9:22 AM
jhenderson accepted this revision.Feb 5 2021, 12:33 AM

Does GNU readelf print an empty line after the last entry too? If so, LGTM.

This comment was removed by arichardson.

Match GNU exactly: no newline after the last notes section.

jhenderson accepted this revision.Feb 5 2021, 2:04 AM

LGTM.

llvm/test/tools/llvm-readobj/ELF/note-generic.s
22

This is slightly surprising now, though probably harmless.

arichardson added inline comments.Feb 5 2021, 2:07 AM
llvm/test/tools/llvm-readobj/ELF/note-generic.s
22

I think FileCheck also matches EOF for -EMPTY? Or possibly it matches the \n after func.

jhenderson added inline comments.Feb 5 2021, 3:46 AM
llvm/test/tools/llvm-readobj/ELF/note-generic.s
22

Yes, it'll be something like the matching EOF line (after all, there is no output at that point). It's not really worth worrying about though. I'm not sure if there's a clear fix. Maybe a CHECK-NOT: {{.}} would make more sense?

arichardson added inline comments.Feb 5 2021, 3:59 AM
llvm/test/tools/llvm-readobj/ELF/note-generic.s
22

That seems to do the same (since the last match ends before the newline. I can't find a way to make it fail if there is an extra newline (other than e.g. piping to hexdump).

This also works fine if the output ends in \n\n:

// GNU-NEXT:   XYZ                  0x00000000	func{{$}}
// GNU-NOT: {{.}}
jhenderson added inline comments.Feb 5 2021, 5:25 AM
llvm/test/tools/llvm-readobj/ELF/note-generic.s
22

Fair enough. Something to look at another time, I guess. I'd just delete this line and call it good then, but happy for you to do something else too.

This revision was landed with ongoing or failed builds.Feb 9 2021, 8:59 AM
This revision was automatically updated to reflect the committed changes.