This is an archive of the discontinued LLVM Phabricator instance.

[llvm-strip] Add support for '--' for delimiting options from input files
ClosedPublic

Authored by sdmitriev on May 19 2021, 9:48 PM.

Details

Summary

This will allow to use llvm-strip with file names that begin with dashes.

Diff Detail

Event Timeline

sdmitriev created this revision.May 19 2021, 9:48 PM
sdmitriev requested review of this revision.May 19 2021, 9:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2021, 9:48 PM
jhenderson added inline comments.May 20 2021, 12:41 AM
llvm/test/tools/llvm-objcopy/dash-dash.test
36

You don't need to make this CHECK unique to objcopy, since llvm-strip and llvm-objcopy produce the same string. Just use --check-prefix=CHECK-NO-INPUT.

38

I'd probably reorder the test cases so that equivalent cases for llvm-strip and llvm-objcopy are side-by-side, i.e. something like:

## llvm-objcopy case 1
## llvm-strip case 1

## llvm-objcopy case 2
## llvm-strip case 2

## llvm-objcopy case 3
## llvm-strip case 3

(where case 1/2/3 are the three distinct cases you test here).

40

Use cp to copy test-obj rather than running yaml2obj again unnecessarily.

41–42

I'd avoid using -o anywhere in these tests, since that's an option itself, and just muddies the waters. Instead, use 2+ input files, which will be modified in-place (you may need to make copies of these files first so you have pristine versions for use later). Same applies in the below cases too.

sdmitriev updated this revision to Diff 346654.May 20 2021, 1:28 AM

Addressed review comments.

jhenderson added inline comments.May 20 2021, 1:49 AM
llvm/test/tools/llvm-objcopy/dash-dash.test
12

I think you should have two inputs here, much like llvm-objcopy has two positional arguments. Same goes below. In other words, test the same set of positional arguments as llvm-objcopy does (it's just that in llvm-strip's case, they are both inputs, not one input and one output).

sdmitriev updated this revision to Diff 346660.May 20 2021, 1:54 AM

Addressed review comments.

jhenderson added inline comments.May 20 2021, 2:00 AM
llvm/test/tools/llvm-objcopy/dash-dash.test
13–14

I think this needs to be as suggested in the edit. This will ensure that the files have actually been stripped too.

26–27

Similar to above, do a run without the dash dash, and compare the modified file against one of these two files too.

sdmitriev updated this revision to Diff 346663.May 20 2021, 2:18 AM
jhenderson accepted this revision.May 20 2021, 2:25 AM

LGTM, thanks!

This revision is now accepted and ready to land.May 20 2021, 2:25 AM