[llvm-ar] Implement the O modifier: display member offsets inside the archive

Since GNU ar 2.31, the 't' operation prints member offsets beside file
names if the 'O' modifier is specified. 'O' is ignored for thin
archives.

Reviewed By: gbreynoo, ruiu

Differential Revision: https://reviews.llvm.org/D69087

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375106 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fangrui Song
2019-10-17 11:34:29 +00:00
parent 327f5f9ccd
commit dd84a1ead8
5 changed files with 48 additions and 16 deletions
+3
View File
@@ -9,6 +9,9 @@ RUN: llvm-ar qcT foo/libtest.a foo/test1.o
RUN: llvm-ar qcT foo/libtest.a foo/test2.o
RUN: llvm-ar t foo/libtest.a | FileCheck --match-full-lines %s
O (displaying member offsets) is ignored for thin archives.
RUN: llvm-ar tO foo/libtest.a | FileCheck --match-full-lines %s
CHECK: foo/test1.o
CHECK: foo/test1.o
CHECK: foo/test2.o
+14
View File
@@ -46,3 +46,17 @@ RUN: env TZ=GMT llvm-ar tv Inputs/thin-path.a | FileCheck %s --check-prefix=THIN
THINPATH: rw-r--r-- 0/0 1224 Jan 1 00:00 1970 Inputs/test.o
THINPATH-NEXT: rw-r--r-- 0/0 1224 Jan 1 00:00 1970 Inputs/t/test2.o
RUN: llvm-ar tO Inputs/GNU.a | FileCheck %s --check-prefix=GNU-O --strict-whitespace
GNU-O: {{^}}evenlen 0x10c
GNU-O-NEXT: {{^}}oddlen 0x150
GNU-O-NEXT: {{^}}very_long_bytecode_file_name.bc 0x194
GNU-O-NEXT: {{^}}IsNAN.o 0x78a
RUN: env TZ=GMT llvm-ar tvO Inputs/GNU.a | FileCheck %s --check-prefix=GNU-VO --strict-whitespace
GNU-VO: rw-r--r-- 500/500 8 Nov 19 02:57 2004 evenlen 0x10c
GNU-VO-NEXT: rw-r--r-- 500/500 7 Nov 19 02:57 2004 oddlen 0x150
GNU-VO-NEXT: rwxr-xr-x 500/500 1465 Nov 19 03:01 2004 very_long_bytecode_file_name.bc 0x194
GNU-VO-NEXT: rw-r--r-- 500/500 2280 Nov 19 03:04 2004 IsNAN.o 0x78a