This is an archive of the discontinued LLVM Phabricator instance.

[llvm-ranlib] Support more than one input file
ClosedPublic

Authored by MaskRay on Aug 7 2022, 10:03 PM.

Details

Summary

BSD and GNU ranlib support more than one input file. Implement this.

While here, update OVERVIEW (Ranlib => ranlib) since "ranlib" is more common.
Remove "speed access" since the index has nothing to do with performance: it is
mandatory for GNU ld and gold but ignored for ld.lld (D119074).

Close https://github.com/llvm/llvm-project/issues/54565

Diff Detail

Event Timeline

MaskRay created this revision.Aug 7 2022, 10:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 7 2022, 10:03 PM
MaskRay requested review of this revision.Aug 7 2022, 10:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 7 2022, 10:03 PM
MaskRay updated this revision to Diff 450699.Aug 7 2022, 10:14 PM
MaskRay edited the summary of this revision. (Show Details)

update overview
update doc

jhenderson accepted this revision.Aug 8 2022, 3:59 AM
jhenderson added inline comments.
llvm/docs/CommandGuide/llvm-ranlib.rst
15
llvm/test/tools/llvm-ranlib/error-opening-permission.test
18
llvm/tools/llvm-ar/llvm-ar.cpp
1436–1437

Nit: I'd probably add a blank line between the two for loops.

1437–1440

It seems to me like you should generate the list of input files during the first loop, and then iterate over that rather than iterating over the full set of argv options twice? This will remove the risk of issues where the startswith("-")/consume_front("-") logic changes for some reason, which could result in the two getting out-of-sync.

This revision is now accepted and ready to land.Aug 8 2022, 3:59 AM
MaskRay updated this revision to Diff 450858.Aug 8 2022, 10:13 AM
MaskRay marked 4 inline comments as done.

Thanks for the review.
Addressed comments.

This revision was landed with ongoing or failed builds.Aug 8 2022, 10:15 AM
This revision was automatically updated to reflect the committed changes.
MaskRay added inline comments.Aug 8 2022, 10:16 AM
llvm/docs/CommandGuide/llvm-ranlib.rst
15

I have checked https://english.stackexchange.com/questions/13284/which-is-correct-one-or-more-is-or-one-or-more-are and I think I'll use the "plural" form :)

This motivated me to check the subject. I have re-read https://ell.stackexchange.com/questions/109363/more-than-one-does-or-more-than-one-do and will stick with the current "more than one input file".