This is an archive of the discontinued LLVM Phabricator instance.

[llvm-ar] Fix when llvm-ar fails to replace existing members when updating a thin archive
ClosedPublic

Authored by gbreynoo on Nov 17 2022, 8:50 AM.

Details

Summary

As seen in https://github.com/llvm/llvm-project/issues/55023 when a thin archive is updated when not in the CWD replacement does not work as expected. This change fixes the relative file path comparison so the correct files are updated.

Diff Detail

Event Timeline

gbreynoo created this revision.Nov 17 2022, 8:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 17 2022, 8:50 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
gbreynoo requested review of this revision.Nov 17 2022, 8:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 17 2022, 8:50 AM
MaskRay added inline comments.Nov 17 2022, 5:45 PM
llvm/test/tools/llvm-ar/thin-archive-relative-path.test
10

If I do llvm-ar cr --thin foo/lib.a foo/elf.o foo/elf.o, what's the expected behavior?

MaskRay accepted this revision.Nov 18 2022, 12:01 AM

This as an incremental improvement looks good.

This revision is now accepted and ready to land.Nov 18 2022, 12:01 AM
gbreynoo marked an inline comment as done.Nov 18 2022, 6:45 AM
gbreynoo added inline comments.
llvm/test/tools/llvm-ar/thin-archive-relative-path.test
10

We follow GNU ar, two copies of foo/elf.o are added, replacing an existing member if it is already in the archive.