Don't modify archive members unless really needed.
For whatever reason ld64 requires that member headers (not the member
themselves) should be aligned. The only way to do that is to edit the
previous member so that it ends at an aligned boundary.
Since modifying data put in an archive is an undesirable property,
llvm-ar should only do it when it is absolutely necessary.
llvm-svn: 295765
diff --git a/llvm/test/Object/archive-format.test b/llvm/test/Object/archive-format.test
index 7505b1f..f895a36 100644
--- a/llvm/test/Object/archive-format.test
+++ b/llvm/test/Object/archive-format.test
@@ -32,12 +32,23 @@
RUN: cat %t.a | FileCheck -strict-whitespace --check-prefix=BSD %s
BSD: !<arch>
-BSD-NEXT: #1/20 0 0 0 644 28 `
+BSD-NEXT: #1/20 0 0 0 644 24 `
+BSD-NEXT: 0123456789abcde{{.....}}bar.
+BSD-SAME: #1/16 0 0 0 644 20 `
+BSD-NEXT: 0123456789abcdefzed.
+
+RUN: rm -f %t.a
+RUN: llvm-ar --format=darwin rc %t.a 0123456789abcde 0123456789abcdef
+RUN: cat %t.a | FileCheck -strict-whitespace --check-prefix=DARWIN %s
+
+DARWIN: !<arch>
+DARWIN-NEXT: #1/20 0 0 0 644 28 `
Each [[:space:]] matches a newline. We explicitly match 3 newlines, as the
fourth newline is implicitly consumed by FileCheck and cannot be matched.
-BSD-NEXT: 0123456789abcde{{.....}}bar.{{[[:space:]][[:space:]][[:space:]]}}
-BSD-NEXT: #1/20 0 0 0 644 28 `
-BSD-NEXT: 0123456789abcdef{{....}}zed.
+DARWIN-NEXT: 0123456789abcde{{.....}}bar.{{[[:space:]][[:space:]][[:space:]]}}
+DARWIN-NEXT: #1/20 0 0 0 644 28 `
+DARWIN-NEXT: 0123456789abcdef{{....}}zed.
+
RUN: rm -f test.a
RUN: llvm-ar --format=gnu rcT test.a 0123456789abcde 0123456789abcdef