This is an archive of the discontinued LLVM Phabricator instance.

[llvm-ar] -s: don't convert a thin archive to a regular one
ClosedPublic

Authored by MaskRay on Jan 16 2022, 5:07 PM.

Details

Summary

In binutils, ar -s and randlib don't convert a thin archive to a regular one.
This behavior makes sense and this patch ports the behavior.

Diff Detail

Event Timeline

MaskRay created this revision.Jan 16 2022, 5:07 PM
MaskRay requested review of this revision.Jan 16 2022, 5:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 16 2022, 5:07 PM
MaskRay added a comment.EditedJan 16 2022, 7:08 PM

If D116979 is accepted, I'd like to use --thin for new tests.


Unrelated to this patch:

% rm -f x.a && fllvm-ar rcT x.a a.o b.o
% ar q x.a c.o   # q or r
ar: Cannot convert existing thin library x.a to normal format

Do we want such a diagnostic? llvm-ar current behavior is to convert the thin archive to a regular one (untested, though).

The opposite has a diagnostic, like GNU ar. The diagnostic makes sense to me because it is difficult to ensure the filesystem has the listed files.

% 'rm' -f x.a && fllvm-ar rc x.a a.o b.o
% fllvm-ar rT x.a c.o
/tmp/RelA/bin/llvm-ar: error: cannot convert a regular archive to a thin one
MaskRay added a comment.EditedJan 31 2022, 3:01 PM

So looks like this may miss the 14.0.0 branch point (https://llvm.discourse.group/t/llvm-14-0-0-release-schedule/5846). I'll hope that 14.0.0 includes this.

Hi @MaskRay, apologies for the wait in this review. The change LGTM. Regarding the implicit conversion from thin to full archives I think there is a problem there, I've created https://reviews.llvm.org/D118693 to discuss it further.

gbreynoo accepted this revision.Feb 1 2022, 3:58 AM
This revision is now accepted and ready to land.Feb 1 2022, 3:58 AM
This revision was landed with ongoing or failed builds.Feb 1 2022, 9:59 AM
This revision was automatically updated to reflect the committed changes.