[AIX][llvm-ranlib] llvm-ar doesn't accept -X options when acting as llvm-ranlib
llvm-ar will act as ranlib when invoked by that name, and llvm-ar since https://github.com/llvm/llvm-project/commit/4f2cfbe5314b064625b2c87bde6ce5c8d04004c5 supports the -X options, but doesn't seem to accept them when running as llvm-ranlib.
See for example:
../../bin/llvm-ranlib -X32_64 libclang_rt.builtins-powerpc.a
../../bin/llvm-ranlib: error: Invalid option: '-X32_64'
Looks like this was fixed in https://github.com/llvm/llvm-project/commit/f740bcb3707a17ed4ccd52157089011a586cc2a6 so we likely just need to backport that fix.
/cherry-pick f740bcb
Failed to cherry-pick: f740bcb
https://github.com/llvm/llvm-project/actions/runs/6511407360
Please manually backport the fix and push it to your github fork. Once this is done, please add a comment like this:
/branch <user>/<repo>/<branch>
Looks like there are some further issues related to 4cc7c749c31e59459b585f8c69f7fa6a9ccb3440 that we'll need to figure out separately
we need to cherry-pick following patche
commit f740bcb3707a17ed4ccd52157089011a586cc2a6 Author: zhijian [email protected] Date: Tue Aug 22 09:41:33 2023 -0400
[AIX] supporting -X options for llvm-ranlib in AIX OS
Summary:
llvm-ar is symlinked as llvm-ranlib and will act as ranlib when invoked in that mode. llvm-ar since [[ https://github.ibm.com/compiler/llvm-project/commit/4f2cfbe5314b064625b2c87bde6ce5c8d04004c5 | compiler/llvm-project@4f2cfbe ]] supports the -X options, but doesn't seem to accept them when running as llvm-ranlib.
In AIX OS , according to https://www.ibm.com/docs/en/aix/7.2?topic=r-ranlib-command
-X mode Specifies the type of object file ranlib should examine. The mode must be one of the following:
32
Processes only 32-bit object files
64
Processes only 64-bit object files
32_64, any
Processes both 32-bit and 64-bit object files
The default is to process 32-bit object files (ignore 64-bit objects). The mode can also be set with the OBJECT_MODE environment variable. For example, OBJECT_MODE=64 causes ranlib to process any 64-bit objects and ignore 32-bit objects. The -X flag overrides the OBJECT_MODE variable.
Reviewers: James Henderson, MaskRay, Stephen Peckham
Differential Revision: https://reviews.llvm.org/D142660
and fixed the conflict as
<<<<<<< HEAD
return writeArchive(Path, Members, /*WriteSymtab*/ true,
object::Archive::K_GNU,
=======
return writeArchive(Path, Members, SymtabWritingMode::NormalSymtab,
MinGW ? object::Archive::K_GNU : object::Archive::K_COFF,
>>>>>>> f740bcb3707a ([AIX] supporting -X options for llvm-ranlib in AIX OS)
to
return writeArchive(Path, Members, SymtabWritingMode::NormalSymtab,
object::Archive::K_GNU,
/branch daltenty/llvm-project/ranlib
/pull-request llvm/llvm-project-release-prs#732
We'll leave the backport to LLVM 17 be, as this isn't a true regression, this is fixed in the latest main.
(Note: the workaround for this issue is to disable picking up llvm-ranlib in your CMake configuration using something like -DCMAKE_RANLIB=/usr/bin/ranlib)