Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIX] change system dynamic library format #132362

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mustartt
Copy link

@mustartt mustartt commented Oct 30, 2024

Historically on AIX, almost all dynamic libraries are distributed in .a Big Archive Format which can consists of both static and shared objects in the same archive (e.g. libc++abi.a(libc++abi.so.1)). During the initial porting process, the dynamic libraries are kept as .a to simplify the migration, but semantically having an XCOFF object under the archive extension is wrong. For crate type cdylib we want to be able to distribute the libraries as archives as well.

We are migrating to archives with the following format:

$ ar -t lib<name>.a
lib<name>.so

where each archive contains a single member that is a shared XCOFF object that can be loaded.

@rustbot
Copy link
Collaborator

rustbot commented Oct 30, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jieyouxu (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Oct 30, 2024
@rust-log-analyzer

This comment has been minimized.

@jieyouxu
Copy link
Member

Hi @mustartt, is this PR blocked on something?

src/bootstrap/src/utils/helpers.rs Outdated Show resolved Hide resolved
@daltenty
Copy link
Contributor

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 31, 2024
@jieyouxu jieyouxu added the O-aix OS: Big Blue's Advanced Interactive eXecutive.. label Oct 31, 2024
@mustartt
Copy link
Author

mustartt commented Nov 5, 2024

Keeping this as draft for now. Need to investigate if dylibs should be archived into .a and how to properly detect between static archives and archives that contains shared objects.

@mustartt mustartt changed the title AIX: extend bootstrap is_dylib to support XCOFF format [AIX] change system dynamic library format Nov 18, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@mustartt mustartt marked this pull request as ready for review November 18, 2024 20:03
@mustartt
Copy link
Author

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 19, 2024
Copy link

@gilamn5tr gilamn5tr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in terms of the AIX implementation.

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this LGTM overall, left a few nits/questions.

compiler/rustc_codegen_ssa/src/back/link.rs Show resolved Hide resolved
compiler/rustc_metadata/src/creader.rs Outdated Show resolved Hide resolved
Comment on lines 64 to 65
// todo: reading the entire file as &[u8] into memory seems excessive
// look into either mmap it or use the &CacheReader
Copy link
Member

@jieyouxu jieyouxu Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: can you convert this to a FIXME and open a C-cleanup issue then link to it FIXME(#nnnnnn): ...?

@jieyouxu
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 20, 2024
@rustbot
Copy link
Collaborator

rustbot commented Nov 21, 2024

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@@ -1965,9 +1965,9 @@ checksum = "baff4b617f7df3d896f97fe922b64817f6cd9a756bb81d40f8883f2f66dcb401"

[[package]]
name = "libc"
version = "0.2.161"
version = "0.2.164"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libc 0.2.163 contains the new RTLD_MEMBER

@rust-log-analyzer

This comment has been minimized.

@mustartt
Copy link
Author

mustartt commented Nov 21, 2024

Thanks for the comments. Rebase on newer master to avoid llvm assertion for f128. Bumped up libc to 0.2.164 that contains the new aix RTLD_MEMBER.

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 21, 2024
fmt

fix cfg for windows

remove unused imports

address comments

update libc to 0.2.164

fmt

remove unused imports
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. My only reservation is having to load the whole shared archive in bootstrap for dylib detection, but since that only happens for .a I suppose it's not too bad, and has an associated cleanup issue #133268, so I think that's acceptable.

@jieyouxu
Copy link
Member

@bors r+ rollup=never (this PR contains a libc bump)

@bors
Copy link
Contributor

bors commented Nov 21, 2024

📌 Commit 0db9059 has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 21, 2024
@mustartt
Copy link
Author

mustartt commented Nov 21, 2024

Thanks. My only reservation is having to load the whole shared archive in bootstrap for dylib detection, but since that only happens for .a I suppose it's not too bad, and has an associated cleanup issue #133268, so I think that's acceptable.

It have a pretty small impact on the bootstrap time maybe an additional minute at most. But I'm wondering is the bootstrap process okay with including other dependencies such as memmap2? I was a bit hesitant to include it in the initial patch?

@jieyouxu
Copy link
Member

But I'm wondering is the bootstrap process okay with including other dependencies such as memmap2? I was a bit hesitant to include it in the initial patch?

Ideally bootstrap needs to build fast with minimal deps, so I'm inclined to say no, not for just this one purpose.

@bors
Copy link
Contributor

bors commented Nov 21, 2024

⌛ Testing commit 0db9059 with merge f39baca...

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 21, 2024
…ouxu

[AIX] change system dynamic library format

Historically on AIX, almost all dynamic libraries are distributed in `.a` Big Archive Format which can consists of both static and shared objects in the same archive (e.g. `libc++abi.a(libc++abi.so.1)`). During the initial porting process, the dynamic libraries are kept as `.a` to simplify the migration, but semantically having an XCOFF object under the archive extension is wrong. For crate type `cdylib` we want to be able to distribute the libraries as archives as well.

We are migrating to archives with the following format:
```
$ ar -t lib<name>.a
lib<name>.so
```
where each archive contains a single member that is a shared XCOFF object that can be loaded.
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Contributor

bors commented Nov 21, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 21, 2024
@jieyouxu
Copy link
Member

@bors retry (not even trying)

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 21, 2024
@bors
Copy link
Contributor

bors commented Nov 21, 2024

⌛ Testing commit 0db9059 with merge 5d3c6ee9b34989595d2a72b79e61ca37e949d757...

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 21, 2024
…ouxu

[AIX] change system dynamic library format

Historically on AIX, almost all dynamic libraries are distributed in `.a` Big Archive Format which can consists of both static and shared objects in the same archive (e.g. `libc++abi.a(libc++abi.so.1)`). During the initial porting process, the dynamic libraries are kept as `.a` to simplify the migration, but semantically having an XCOFF object under the archive extension is wrong. For crate type `cdylib` we want to be able to distribute the libraries as archives as well.

We are migrating to archives with the following format:
```
$ ar -t lib<name>.a
lib<name>.so
```
where each archive contains a single member that is a shared XCOFF object that can be loaded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-aix OS: Big Blue's Advanced Interactive eXecutive.. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants