mold icon indicating copy to clipboard operation
mold copied to clipboard

Is s390x supported?

Open marxin opened this issue 3 years ago • 5 comments

I noticed one can't build mold on s390x due to:

[   33s] make[3]: Entering directory '/home/abuild/rpmbuild/BUILD/mold-1.0.999+git.20220109.b18d4881/out/mimalloc'
[   33s] [100%] Built target mimalloc-static
[   33s] make[3]: Leaving directory '/home/abuild/rpmbuild/BUILD/mold-1.0.999+git.20220109.b18d4881/out/mimalloc'
[   33s] make[2]: Entering directory '/home/abuild/rpmbuild/BUILD/mold-1.0.999+git.20220109.b18d4881/out/mimalloc'
[   33s] /usr/bin/cmake -E cmake_progress_start /home/abuild/rpmbuild/BUILD/mold-1.0.999+git.20220109.b18d4881/out/mimalloc/CMakeFiles 0
[   33s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/mold-1.0.999+git.20220109.b18d4881/out/mimalloc'
[   33s] g++ -DMOLD_VERSION=\"1.0.1\" -DLIBDIR="\"/usr/lib64\"" -Ithird-party/mimalloc/include  -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -Wno-sign-compare -pthread -fPIE -fno-unwind-tables -fno-asynchronous-unwind-tables  -std=c++20 -fno-exceptions -c -o out/perf.o perf.cc
[   36s] g++ -DMOLD_VERSION=\"1.0.1\" -DLIBDIR="\"/usr/lib64\"" -Ithird-party/mimalloc/include  -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -Wno-sign-compare -pthread -fPIE -fno-unwind-tables -fno-asynchronous-unwind-tables  -std=c++20 -fno-exceptions -c -o out/elf/arch-i386.o elf/arch-i386.cc
[   37s] g++ -DMOLD_VERSION=\"1.0.1\" -DLIBDIR="\"/usr/lib64\"" -Ithird-party/mimalloc/include  -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -Wno-sign-compare -pthread -fPIE -fno-unwind-tables -fno-asynchronous-unwind-tables  -std=c++20 -fno-exceptions -c -o out/elf/arch-arm64.o elf/arch-arm64.cc
[   37s] g++ -DMOLD_VERSION=\"1.0.1\" -DLIBDIR="\"/usr/lib64\"" -Ithird-party/mimalloc/include  -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -Wno-sign-compare -pthread -fPIE -fno-unwind-tables -fno-asynchronous-unwind-tables  -std=c++20 -fno-exceptions -c -o out/elf/arch-x86-64.o elf/arch-x86-64.cc
[   38s] g++ -DMOLD_VERSION=\"1.0.1\" -DLIBDIR="\"/usr/lib64\"" -Ithird-party/mimalloc/include  -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -Wno-sign-compare -pthread -fPIE -fno-unwind-tables -fno-asynchronous-unwind-tables  -std=c++20 -fno-exceptions -c -o out/elf/gc-sections.o elf/gc-sections.cc
[   38s] elf/gc-sections.cc:30:19: error: 'tbb::feeder' has not been declared
[   38s]    30 |                   tbb::feeder<InputSection<E> *> &feeder, i64 depth) {
[   38s]       |                   ^~~
[   38s] elf/gc-sections.cc:30:30: error: expected ',' or '...' before '<' token
[   38s]    30 |                   tbb::feeder<InputSection<E> *> &feeder, i64 depth) {
[   38s]       |                              ^
[   38s] elf/gc-sections.cc: In function 'void mold::elf::visit(mold::elf::Context<E>&, mold::elf::InputSection<E>*, int)':
[   38s] elf/gc-sections.cc:47:11: error: 'feeder' was not declared in this scope
[   38s]    47 |           feeder.add(sym->input_section);
[   38s]       |           ^~~~~~
[   38s] elf/gc-sections.cc:64:9: error: 'depth' was not declared in this scope
[   38s]    64 |     if (depth < 3)
[   38s]       |         ^~~~~
[   38s] elf/gc-sections.cc:65:37: error: 'feeder' was not declared in this scope
[   38s]    65 |       visit(ctx, sym.input_section, feeder, depth + 1);
[   38s]       |                                     ^~~~~~
[   38s] elf/gc-sections.cc:67:7: error: 'feeder' was not declared in this scope
[   38s]    67 |       feeder.add(sym.input_section);
[   38s]       |       ^~~~~~
[   38s] elf/gc-sections.cc: In function 'void mold::elf::mark(mold::elf::Context<E>&, tbb::concurrent_vector<mold::elf::InputSection<E>*>&)':
[   38s] elf/gc-sections.cc:145:37: error: 'tbb::feeder' has not been declared
[   38s]   145 |                                     tbb::feeder<InputSection<E> *> &feeder) {
[   38s]       |                                     ^~~
[   38s] elf/gc-sections.cc:145:48: error: expected ',' or '...' before '<' token
[   38s]   145 |                                     tbb::feeder<InputSection<E> *> &feeder) {
[   38s]       |                                                ^
[   38s] elf/gc-sections.cc: In lambda function:
[   38s] elf/gc-sections.cc:146:22: error: 'feeder' was not declared in this scope
[   38s]   146 |     visit(ctx, isec, feeder, 0);
[   38s]       |                      ^~~~~~
[   38s] In file included from elf/gc-sections.cc:8:
[   38s] /usr/include/tbb/parallel_for_each.h: In instantiation of 'void tbb::internal::parallel_for_each_body_for<Function, Iterator>::operator()(tbb::blocked_range<Index>) const [with Function = mold::elf::mark<mold::elf::ARM64>(mold::elf::Context<mold::elf::ARM64>&, tbb::concurrent_vector<mold::elf::InputSection<mold::elf::ARM64>*, tbb::cache_aligned_allocator<mold::elf::InputSection<mold::elf::ARM64>*> >&)::<lambda(mold::elf::InputSection<mold::elf::ARM64>*, int)>; Iterator = tbb::internal::vector_iterator<tbb::concurrent_vector<mold::elf::InputSection<mold::elf::ARM64>*, tbb::cache_aligned_allocator<mold::elf::InputSection<mold::elf::ARM64>*> >, mold::elf::InputSection<mold::elf::ARM64>*>]':

marxin avatar Jan 10 '22 10:01 marxin

Currently I have only x86-64 and ARM64 machines, so I'd say s390 isn't on our supported host list. If you can fix this compilation error, I'm happy to apply a patch though.

rui314 avatar Jan 10 '22 11:01 rui314

I ran into this same issue. By the way I'm packaging mold for Fedora at https://copr.fedorainfracloud.org/coprs/ktdreyer/mold/ , are you a Fedora packager who can review this if I submit it to the distro?

ktdreyer avatar Jan 11 '22 22:01 ktdreyer

I'm not a Fedora packager nor a Fedora user, and I know nothing about its packaging system. So I don't think I'm a right person to review your change.

rui314 avatar Jan 12 '22 02:01 rui314

@ktdreyer, I'm in the process of packaging mold for Fedora. The current progress is being tracked here: https://bugzilla.redhat.com/show_bug.cgi?id=2036468

sicherha avatar Jan 14 '22 17:01 sicherha

As for s390x support, I'm not sure it makes a lot of sense to package mold for a platform for which it cannot produce native binaries. That should probably be debated over at the Red Hat Bugzilla rather than here.

sicherha avatar Jan 14 '22 17:01 sicherha

@rui314 Can you please describe if you plan to support this target? Note it's a target most commercial distros (RHEL, SLES) do support.

marxin avatar Sep 18 '22 08:09 marxin

I'm trying to get a support to support s390 and POWER (especially POWER10) from IBM. I'll update this bug once the situation changes.

rui314 avatar Sep 18 '22 13:09 rui314

Great. Do you speak about getting access to a machine you can use for testing?

marxin avatar Sep 18 '22 17:09 marxin

I just started working on it yesterday. Until then I knew nothing about s390x and zArchitecture, but somehow I managed to self-host mold on a real s390x machine today! So I think this item is done.

rui314 avatar Oct 05 '22 06:10 rui314

Nice work! I've just read the comment at elf/arch-s390.cc and yes, we as SUSE have quite some customers who run safety-critical systems on the platform. Mostly being used by banks and similar types of clients.

marxin avatar Oct 05 '22 07:10 marxin

Yup. I hope to make support contracts with such users to make this project viable.

rui314 avatar Oct 05 '22 08:10 rui314