llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[AIX][llvm-ar] llvm-ar doesn't align shared object members correctly for the loader

Open daltenty opened this issue 3 years ago • 4 comments

Shared objects in archives generated by llvm-ar fail to load:

Could not load program c-arcmt-test:
	Dependent module /scratch/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/lib/libclang.a(libclang.so.17git) could not be loaded.
	The alignment of the .text section does not
	  satisfy its required alignment.

Shared libraries on AIX are generally archives, so the members have some additional alignment requirements for the loader.

daltenty avatar Oct 13 '23 18:10 daltenty

This is fixed in latest main with 4cc7c749c31e59459b585f8c69f7fa6a9ccb3440.

daltenty avatar Oct 13 '23 18:10 daltenty

after the issue https://github.com/llvm/llvm-project/issues/69014 fixed, we need to cherry-pick following two patches ,

commit f903119cce63377383046840a15ba277a9041df9 Author: zhijian [email protected] Date: Wed Sep 6 12:04:52 2023 -0400

Fixed a compile  error on  use of deleted function ‘{anonymous}::MemberData::MemberData(const {anonymous}::MemberData&)

Summary:

There is compile error on https://lab.llvm.org/buildbot/#/builders/264/builds/1147/steps/5/logs/stdio
when commit in https://reviews.llvm.org/D144872

commit 4cc7c749c31e59459b585f8c69f7fa6a9ccb3440 Author: zhijian [email protected] Date: Wed Sep 6 11:35:18 2023 -0400

[AIX] Align the content of an xcoff object file which has auxiliary header in big archive.

Summary:

if the member file is XCOFF object file and has auxiliary header, the content of the member file need to be aligned at the
MAX(maximum alignment of .text , maximum alignment of .data). The "maximum alignment of .text" and "maximum alignment of .data" are two
field of auxiliary header of XCOFF object file.

Reviewers: James Henderson, Stephen Peckham
Differential Revision: https://reviews.llvm.org/D144872

diggerlin avatar Oct 13 '23 18:10 diggerlin

Failed to cherry-pick: 4cc7c74

https://github.com/llvm/llvm-project/actions/runs/6511782160

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>

llvmbot avatar Oct 13 '23 18:10 llvmbot

We'll leave the backport to LLVM 17 be, as this isn't a true regression, this is fixed in the latest main by https://github.com/llvm/llvm-project/commit/4cc7c749c31e59459b585f8c69f7fa6a9ccb3440.

daltenty avatar Oct 18 '23 20:10 daltenty