[PATCH] D71957: [llvm-size] print a blank line between archieve members when using sysv format

Jim Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 02:52:53 PST 2020


Jim added inline comments.


================
Comment at: llvm/test/tools/llvm-size/archive.test:50
 # SYSV-3-EMPTY:
+# SYSV-3-EMPTY:
+# SYSV-3-EMPTY:
----------------
TH3CHARLie wrote:
> MaskRay wrote:
> > TH3CHARLie wrote:
> > > MaskRay wrote:
> > > > GNU size prints 2 blank lines.
> > > I believe this is necessary, see `radix.test`'s case 4-6
> > `--format=sysv` prints exactly two blank lines between two blocks. Your patch currently prints 3.
> > 
> > After you fix this, you may need to provide `git commit --amend --author "what-is-your-name <what-is at your-email>"`
> As you can tell from the patch, there was a `SYSV-3-EMPTY` in the testcase before this patch. The original code prints no new lines between blocks and to match the newly added 2 newlines, 2 corresponding `SYSV-3-EMPTY` is needed here.
> 
> If we remove a `SYSV-3-EMPTY` here, error will be generated:
> ```bash
> /home/yxd/llvm-project/llvm/test/tools/llvm-size/archive.test:52:16: error: SYSV-3-NEXT: is not on the line after the previous match
> # SYSV-3-NEXT: archive.test.tmp1 (ex [[ARCHIVE2]]):
>                ^
> <stdin>:10:1: note: 'next' match was here
> archive.test.tmp1 (ex /home/yxd/llvm-project/build/test/tools/llvm-size/Output/archive.test.tmp2.a):
> ^
> <stdin>:8:1: note: previous match ended here
> 
> ^
> <stdin>:9:1: note: non-matching line after previous match is here
> 
> ```
> 
> Although I'm not sure about why there was a `SYSV-3-EMPTY` here before adding any newlines, it is required here to add the two `SYSV-3-EMPTY` to pass the test. BTW, I have also verified with custom testcases.
This is non-archives (single object file). 


================
Comment at: llvm/tools/llvm-size/llvm-size.cpp:829
     }
   } else if (ObjectFile *o = dyn_cast<ObjectFile>(&Bin)) {
     if (!checkMachOAndArchFlags(o, file))
----------------
Fix here. It prints 3 blank lines. 2 blank lines is from `printObjectSectionSizes` and 1 blank line from
```
// System V adds an extra newline at the end of each file.
  if (OutputFormat == sysv)
    outs() << "\n";
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71957/new/

https://reviews.llvm.org/D71957





More information about the llvm-commits mailing list