Skip to content
New issue

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

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

Already on GitHub? # to your account

Link against libc++abi and libunwind as well when building LLVM wrappers on AIX #123359

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

bzEq
Copy link
Contributor

@bzEq bzEq commented Apr 2, 2024

Unlike libc++.so on Linux which is a linker script

INPUT(libc++.so.1 -lc++abi -lunwind)

AIX linker doesn't support such script, so c++abi and unwind have to be specified explicitly.

@rustbot
Copy link
Collaborator

rustbot commented Apr 2, 2024

r? @cuviper

rustbot has assigned @cuviper.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 2, 2024
@cuviper
Copy link
Member

cuviper commented Apr 2, 2024

Is unwind always needed in AIX? I'm curious because Fedora's libc++.so is just INPUT(libc++.so.1 -lc++abi). You might already get -lunwind from std too, but I can see you only added it here in your second "fix" commit.

@bzEq
Copy link
Contributor Author

bzEq commented Apr 3, 2024

Is unwind always needed in AIX?

Not really, it's not like libc. Normal C programs don't depend on libunwind.

int main() { return 0; }
ldd a.out
a.out needs:
         /usr/lib/libc.a(shr_64.o)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)

Here, libunwind is the dependency of libc++.

libc++.so.1 needs:
         /usr/lib/libpthread.a(shr_xpg5_64.o)
         /usr/lib/libc.a(shr_64.o)
         /usr/lib/libc++abi.a(libc++abi.so.1)
         /usr/lib/libunwind.a(libunwind.so.1)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)

Fedora's libc++.so is just INPUT(libc++.so.1 -lc++abi)

Fedora's build should have set -DLIBCXXABI_USE_LLVM_UNWINDER=FALSE when building these runtimes, so its libc++abi should be depending on libgcc_s.

You might already get -lunwind from std too, but I can see you only added it here in your second "fix" commit.

Exactly. I was hesitating to add libunwind here. Adding libc++ and libc++abi here already works. From a local view, libc++ depends on libc++abi and libunwind, so I add both here; from a global view, we are building something that definitely depends on std, so no need to duplicate libunwind here.

@cuviper
Copy link
Member

cuviper commented Apr 3, 2024

OK, sounds fine to just include it.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 3, 2024

📌 Commit 00f7f57 has been approved by cuviper

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 Apr 3, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 3, 2024
…kingjubilee

Rollup of 4 pull requests

Successful merges:

 - rust-lang#122411 ( Provide cabi_realloc on wasm32-wasip2 by default )
 - rust-lang#123349 (Fix capture analysis for by-move closure bodies)
 - rust-lang#123359 (Link against libc++abi and libunwind as well when building LLVM wrappers on AIX)
 - rust-lang#123388 (use a consistent style for links)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 04a7a55 into rust-lang:master Apr 3, 2024
11 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 3, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 3, 2024
Rollup merge of rust-lang#123359 - bzEq:aix-libc++abi, r=cuviper

Link against libc++abi and libunwind as well when building LLVM wrappers on AIX

Unlike `libc++.so` on Linux which is a linker script
```ld
INPUT(libc++.so.1 -lc++abi -lunwind)
```
AIX linker doesn't support such script, so `c++abi` and `unwind` have to be specified explicitly.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants