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

linux/ppc64el: fails to build LLVM with ./elf/thunks.cc:257: void mold::elf::OutputSection<E>::create_range_extension_thunks(mold::elf::Context<E>&) [with E = mold::elf::PPC64V2]: Assertion thunk->size() < max_thunk_size' failed.` #1224

Closed
sylvestre opened this issue Mar 21, 2024 · 10 comments

Comments

@sylvestre
Copy link
Contributor

using mold:
2.4.1+dfsg-1 (i will try with 2.30 but i don't see any potential fix in the release notes))

Full log:
https://buildd.debian.org/status/fetch.php?pkg=llvm-toolchain-18&arch=ppc64el&ver=1%3A18.1.2-1&stamp=1710939656&raw=0

@sylvestre sylvestre changed the title linux/ppc64el: fails to build LLVM with ld.mold: ./elf/thunks.cc:257: void mold::elf::OutputSection<E>::create_range_extension_thunks(mold::elf::Context<E>&) [with E = mold::elf::PPC64V2]: Assertion `thunk->size() < max_thunk_size' failed. linux/ppc64el: fails to build LLVM with ./elf/thunks.cc:257: void mold::elf::OutputSection<E>::create_range_extension_thunks(mold::elf::Context<E>&) [with E = mold::elf::PPC64V2]: Assertion thunk->size() < max_thunk_size' failed.` Mar 21, 2024
@rui314
Copy link
Owner

rui314 commented Mar 21, 2024

Just to confirm: I can reproduce the issue if I build Clang with mold on ppc64le, right?

@sylvestre
Copy link
Contributor Author

Yes, except if it is caused by some extra LDFLAGS that we use (but you can see them in the log)

@sylvestre
Copy link
Contributor Author

@rui314
Copy link
Owner

rui314 commented Mar 27, 2024

It is not easy to reproduce the issue for me because it involves lots of Debian-specific toolings. Could you reproduce the issue just by building LLVM from source without using Debian-specific tools?

@sylvestre
Copy link
Contributor Author

Just running the cmake will all the arg should be good but I will try to make a test case. Any recommendation on what to do next?
Thanks

@rui314
Copy link
Owner

rui314 commented Mar 27, 2024

I fired up debian:unstable docker image, installed build-deps for clang-18, installed mold, checked out the llvm repo from github, and then copy-and-pasted the cmake command line, but it built just fine. So I think there's a hidden condition to reproduce the issue. Ideally, I want to know a procedure to reproduce the issue with the docker image.

@jcelerier
Copy link

jcelerier commented May 27, 2024

I'm seeing the same thing on fedora 40 aarch64 (asahi linux) on a different codebase.
Trace:

Thread 1 "ld.mold" hit Breakpoint 1.1, mold::elf::OutputSection<mold::elf::ARM64>::create_range_extension_thunks (this=0x40cbe27ca80, ctx=...) at /usr/src/debug/mold-2.31.0-1.fc40.aarch64/elf/thunks.cc:257
257         assert(thunk->size() < max_thunk_size);
(gdb) bt
#0  mold::elf::OutputSection<mold::elf::ARM64>::create_range_extension_thunks (this=0x40cbe27ca80, ctx=...) at /usr/src/debug/mold-2.31.0-1.fc40.aarch64/elf/thunks.cc:257
#1  mold::elf::compute_section_sizes<mold::elf::ARM64> (ctx=...) at /usr/src/debug/mold-2.31.0-1.fc40.aarch64/elf/passes.cc:1429
#2  0x0000aaaaaafc6158 in mold::elf::elf_main<mold::elf::ARM64> (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/mold-2.31.0-1.fc40.aarch64/elf/main.cc:578
#3  0x0000aaaaaafb30a0 in mold::elf::redo_main<mold::elf::X86_64> (ctx=..., argc=82, argv=0xffffffffdae8) at /usr/src/debug/mold-2.31.0-1.fc40.aarch64/elf/passes.cc:26
#4  mold::elf::elf_main<mold::elf::X86_64> (argc=82, argv=0xffffffffdae8) at /usr/src/debug/mold-2.31.0-1.fc40.aarch64/elf/main.cc:366
#5  0x0000fffff7900a1c in __libc_start_call_main (main=main@entry=0xaaaaaaba0fc0 <main(int, char**)>, argc=argc@entry=82, argv=argv@entry=0xffffffffdae8) at ../sysdeps/nptl/libc_start_call_main.h:58
#6  0x0000fffff7900afc in __libc_start_main_impl (main=0xaaaaaaba0fc0 <main(int, char**)>, argc=82, argv=0xffffffffdae8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=<optimized out>)
    at ../csu/libc-start.c:360
#7  0x0000aaaaaaba2a70 in _start ()
(gdb) 

Dump: https://fromsmash.com/2qzqnkmPiN-it

@rui314
Copy link
Owner

rui314 commented May 27, 2024

I need a reproducer to debug it. Is your program open-source?

@jcelerier
Copy link

jcelerier commented May 27, 2024

Here's a small reproducer:

data.zip

$ ld.mold --version
mold 2.31.0 (compatible with GNU ld)

$ ld.mold -EL --hash-style=gnu --build-id --eh-frame-hdr -m aarch64linux -shared obj.o lib.a
ld.mold: /builddir/build/BUILD/mold-2.31.0/elf/thunks.cc:257: void mold::elf::OutputSection<E>::create_range_extension_thunks(mold::elf::Context<E>&) [with E = mold::elf::ARM64]: Assertion `thunk->size() < max_thunk_size' failed.

@rui314 rui314 closed this as completed in c7c8583 May 27, 2024
@rui314
Copy link
Owner

rui314 commented May 27, 2024

Please try again with git head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants