I believe the issues are due to libgcc not being linked properly?
Firstly, I am running a 32-bit kernel hence I do not have native support for 64-bit numbers (which LAI sometimes makes use of) and so g++ tries to make calls to __divmod which should solve my problem, except I am getting import errors:
undefined reference to `__udivmoddi4'
I have followed the cross compiler build guide here which should also include libgcc.undefined reference to `__umoddi3'
How I compile my files (with make):
How I link my object files (with make):i686-elf-g++ -lgcc -O2 -ffreestanding -Wall -Wextra -fno-exceptions -fno-rtti -fno-use-cxa-atexit -g -Wno-unused-variable -Wno-write-strings -Wno-unused-parameter -o $@ -c $<
i686-elf-g++ -v:i686-elf-g++ -T $< -o ./dist/$@ -ffreestanding -O2 -nostdlib -lgcc -g $(objects)
I should also note I "ported" the LAI library to C++ (by changing extension to cpp & making void*-int casts explicit) which may be part of the problem? (I reckon it'd be easier to port it to C++ and compile it together with everything else than make exceptions for C).Using built-in specs.
COLLECT_GCC=i686-elf-g++
COLLECT_LTO_WRAPPER=/home/speedy/opt/cross/libexec/gcc/i686-elf/11.2.0/lto-wrapper
Target: i686-elf
Configured with: ../gcc/configure --target=i686-elf --prefix=/home/speedy/opt/cross --disable-nls --enable-languages=c,c++ --without-headers : (reconfigured) ../gcc/configure --target=i686-elf --prefix=/home/speedy/opt/cross --disable-nls --enable-languages=c,c++ --without-headers
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 11.2.0 (GCC)