Opened 7 years ago

Closed 7 months ago

#10241 closed bug (fixed)

ARM builds broken after PM, missing built-in atomics in libgcc for Haiku

Reported by: kallisti5 Owned by: ithamar
Priority: normal Milestone: Unscheduled
Component: Build System Version: R1/Development
Keywords: arm bootstrap Cc:
Blocked By: Blocking:
Platform: arm

Description (last modified by kallisti5)

Buildtools for arm work...

../configure -j8 --build-cross-tools arm ../../buildtools --bootstrap /home/kallisti5/Code/haikuporter /home/kallisti5/Code/haikuports.cross /home/kallisti5/Code/haikuports

EDIT: I was building the wrong target.

Now we are running into issues with the gcc_bootstrap build on arm. (jam -q -sHAIKU_BOOT_BOARD=verdex @bootstrap-raw)

/bin/bash ../libtool --tag CXX   --mode=link arm-unknown-haiku-c++  --sysroot=/home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/boot/cross-sysroot/arm/     -DPIC  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi  -fdiagnostics-show-location=once   -ffunction-sections -fdata-sections  -o -version-info 6:18:0  -lm -rpath /packages/gcc_bootstrap-4.8.2_2014_02_27-1/.self/develop/tools/lib compatibility.lo compatibility-debug_list.lo compatibility-debug_list-2.lo  compatibility-c++0x.lo compatibility-atomic-c++0x.lo compatibility-thread-c++0x.lo compatibility-chrono.lo  ../libsupc++/ ../src/c++98/ ../src/c++11/ 
libtool: link:  arm-unknown-haiku-c++  --sysroot=/home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/boot/cross-sysroot/arm/   -shared -nostdlib /home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/boot/cross-sysroot/arm/boot/system/develop/lib/crti.o /home/kallisti5/Code/haiku/generated.arm/cross-tools-arm/lib/gcc/arm-unknown-haiku/4.8.2/crtbegin.o /home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/boot/cross-sysroot/arm/boot/system/develop/lib/init_term_dyn.o  .libs/compatibility.o .libs/compatibility-debug_list.o .libs/compatibility-debug_list-2.o .libs/compatibility-c++0x.o .libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o .libs/compatibility-chrono.o  -Wl,--whole-archive ../libsupc++/.libs/libsupc++convenience.a ../src/c++98/.libs/libc++98convenience.a ../src/c++11/.libs/libc++11convenience.a -Wl,--no-whole-archive  -L/home/kallisti5/Code/haiku/generated.arm/cross-tools-arm/lib/gcc/arm-unknown-haiku/4.8.2 -L/home/kallisti5/Code/haiku/generated.arm/cross-tools-arm/lib/gcc/arm-unknown-haiku/4.8.2/../../../../arm-unknown-haiku/lib -L/home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/boot/cross-sysroot/arm/boot/system/develop/lib -lroot -lgcc /home/kallisti5/Code/haiku/generated.arm/cross-tools-arm/lib/gcc/arm-unknown-haiku/4.8.2/crtend.o /home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/boot/cross-sysroot/arm/boot/system/develop/lib/crtn.o    -Wl,-soname -Wl, -o .libs/
.libs/compatibility-atomic-c++0x.o: In function `std::atomic_flag::test_and_set(std::memory_order)':
/home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/sources/gcc_bootstrap-4.8.2_2014_02_27-obj/arm-unknown-haiku/libstdc++-v3/include/bits/atomic_base.h:287: undefined reference to `__sync_val_compare_and_swap_1'
collect2: error: ld returned 1 exit status
make[5]: *** [] Error 1
make[5]: Leaving directory `/home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/sources/gcc_bootstrap-4.8.2_2014_02_27-obj/arm-unknown-haiku/libstdc++-v3/src'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/sources/gcc_bootstrap-4.8.2_2014_02_27-obj/arm-unknown-haiku/libstdc++-v3/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/sources/gcc_bootstrap-4.8.2_2014_02_27-obj/arm-unknown-haiku/libstdc++-v3'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/sources/gcc_bootstrap-4.8.2_2014_02_27-obj/arm-unknown-haiku/libstdc++-v3'
make[1]: *** [all-target-libstdc++-v3] Error 2
make[1]: Leaving directory `/home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/sources/gcc_bootstrap-4.8.2_2014_02_27-obj'
make: *** [all] Error 2
Command '['/bin/bash', '-c', '. /home/kallisti5/Code/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/wrapper-script']' returned non-zero exit status 2

This seems to be due to a missing built-in atomic for Haiku. When gcc arm attempts to build gcc arm under Haiku this happens.

Attachments (2)

buildlog-haiku_loader.txt (8.8 KB ) - added by idefix 7 years ago.
0001-gcc-libgcc-Implement-atomic-intrinsics.patch (14.0 KB ) - added by zeusk 7 years ago.
Implement atomic intrinsics in libgcc

Download all attachments as: .zip

Change History (19)

comment:1 by bonefish, 7 years ago

From the shortened output it's hard to say much. The respective Jamfile (src/system/boot/platform/generic/Jamfile) correctly declares the zlib dependency of video_splash.cpp and it also adds the zlib headers. Since the zlib header directory doesn't even appear on the command line, there's likely an earlier problem.

comment:2 by idefix, 7 years ago

I get the same error on Ubuntu 12.04.3, see attached buildlog.

by idefix, 7 years ago

Attachment: buildlog-haiku_loader.txt added

comment:4 by kallisti5, 7 years ago

Summary: ARM builds broken after PMARM builds broken after PM, missing built-in atomics in libgcc for Haiku

comment:5 by zeusk, 7 years ago

patch: 01

comment:6 by zeusk, 7 years ago

This patch implements the libgcc part of the missing atomic intrinsics for ARMv5 and lower. It requires kernel patch to function on ARMv5 and lower (part of my gsoc project).

This patch also furthers the compilation point, we now have:

/home/shantanu/haiku/haiku/generated.arm/cross-tools-arm/lib/gcc/arm-unknown-haiku/4.8.2/../../../../arm-unknown-haiku/bin/ld: error: .libs/ uses VFP register arguments, /home/shantanu/haiku/haiku/generated.arm/objects/haiku/arm/packaging/repositories/HaikuPortsCross-build/sys-devel/gcc_bootstrap/work-4.8.2_2014_02_27/boot/cross-sysroot/arm/boot/system/develop/lib/init_term_dyn.o does not

comment:7 by zeusk, 7 years ago

Please ignore the above patch, I have a revision in the works which doesn't depend on linux like user helper function in the kernel. Refer irclogs for more info.

Last edited 7 years ago by zeusk (previous) (diff)

comment:8 by umccullough, 7 years ago

patch: 10

comment:9 by zeusk, 7 years ago

patch: 01

comment:10 by zeusk, 7 years ago

This patch implements the same atomic intrinsics as before but tries to use already implemented atomic syscalls for ARMv5 and lower in haiku.

The next compilation error is same as mentioned in my previous comments, libstdc++v3 uses fp register arguments while init_term_dyn.o does not.

by zeusk, 7 years ago

Implement atomic intrinsics in libgcc

comment:11 by pulkomandy, 7 years ago

Hi, I have used the stdatomic.c implementation from FreeBSD. It is integrated on libroot side, which avoids further patching of gcc.

However, we get to the VFP error anyway. I was trying to build for the beagle board, maybe trying to build for a non-VFP target would work?

comment:12 by zeusk, 7 years ago


I've tried building for the default verdex board (xScale) which doesn't use softabi/hardabi flags but yet compilation halts on the very same error regarding incompatible vfp flags while linking init_term_dyn.o with libstdc++v3.

Last edited 7 years ago by zeusk (previous) (diff)

comment:13 by pulkomandy, 7 years ago

Mentionning this here after discussing with zeusk over IRC: the stdatomic I imported from FreeBSD works well for ARMv6+, but on ARMv5, it uses a trap function to implement atomic operations, which we can avoid by using the patch he attached here.

However, the ARMv6+ implementation from FreeBSD is likely more efficient, so we want to keep that, and I think it would make sense to keep everything in libroot rather than putting them on gcc side.

Last edited 7 years ago by pulkomandy (previous) (diff)

comment:14 by zeusk, 7 years ago

It (bsd's stdatomic) doesn't use syscall, It uses trap functions like linux does and my previous patch. I was recommended against such implementation and was asked to use the haiku's atomic syscalls which works without any modifications to the kernel for any CPU regardless if it is ARMv5 or ARMv6. As for efficiency, you can improve those functions in my patch if you think there is a more efficient way to do things.

comment:15 by bonefish, 6 years ago

Owner: changed from bonefish to ithamar
Priority: highnormal
Status: newassigned

comment:16 by CodeforEvolution, 7 months ago

This ticket looks closable now, I'm pretty certain we're pumping out nightly ARM images at the moment. :)

comment:17 by diver, 7 months ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.