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

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

mustartt
Copy link
Contributor

@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
Contributor 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 force-pushed the aix-dylib-detection branch from 45354fd to 7af8f2e Compare November 18, 2024 03:15
@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.

@mustartt mustartt requested a review from daltenty November 18, 2024 03:26
@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
Contributor 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
@mustartt mustartt force-pushed the aix-dylib-detection branch from 3058de9 to d999999 Compare November 21, 2024 01:03
@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
Contributor 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
Contributor 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
@mustartt mustartt force-pushed the aix-dylib-detection branch from 25da642 to 0db9059 Compare November 21, 2024 15:33
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
Contributor 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 5d3c6ee...

@bors
Copy link
Contributor

bors commented Nov 22, 2024

☀️ Test successful - checks-actions
Approved by: jieyouxu
Pushing 5d3c6ee to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 22, 2024
@bors bors merged commit 5d3c6ee into rust-lang:master Nov 22, 2024
7 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 22, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5d3c6ee): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.5% [1.5%, 1.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 1.6%, secondary -3.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.6% [1.6%, 1.6%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.1% [-3.4%, -2.7%] 2
All ❌✅ (primary) 1.6% [1.6%, 1.6%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 797.142s -> 796.222s (-0.12%)
Artifact size: 336.05 MiB -> 336.06 MiB (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

8 participants