ld is picking up libc.so in /lib/i386-linux-gnu, that’s how you end up with the
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xea200000)
entry in ldd’s output.
The /usr/lib/libc.so.1 entry is the dynamic linker; this is hinted at by the resolution given by ldd (pointing to the real 32-bit x86 dynamic linker), and more explicitly by file’s output:
$ file main main: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /usr/lib/libc.so.1, with debug_info, not stripped
This happens because the default dynamic linker used by ld is /usr/lib/libc.so.1, and you didn’t mention anything else on the ld command line.
The real underlying issue is that your ld command isn’t the right way to link a C program with GCC; instead of ld, you should use gcc itself:
Cl = i686-linux-gnu-gcc
This will ensure that the correct arguments are provided to ld, including the appropriate dynamic linker and the necessary C startup files. You can see this in detail by running gcc verbosely:
$ i686-linux-gnu-gcc -v -L/lib/i386-linux-gnu/ -lc -o main main.o […] /usr/lib/gcc-cross/i686-linux-gnu/10/collect2 -plugin /usr/lib/gcc-cross/i686-linux-gnu/10/liblto_plugin.so -plugin-opt=/usr/lib/gcc-cross/i686-linux-gnu/10/lto-wrapper -plugin-opt=-fresolution=/tmp/user/1000/cciJ4Cer.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu --as-needed -dynamic-linker /lib/ld-linux.so.2 -pie -o main /usr/lib/gcc-cross/i686-linux-gnu/10/../../../../i686-linux-gnu/lib/../lib/Scrt1.o /usr/lib/gcc-cross/i686-linux-gnu/10/../../../../i686-linux-gnu/lib/../lib/crti.o /usr/lib/gcc-cross/i686-linux-gnu/10/crtbeginS.o -L/lib/i386-linux-gnu/ -L/usr/lib/gcc-cross/i686-linux-gnu/10 -L/usr/lib/gcc-cross/i686-linux-gnu/10/../../../../i686-linux-gnu/lib/../lib -L/lib/i386-linux-gnu -L/lib/../lib -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc-cross/i686-linux-gnu/10/../../../../i686-linux-gnu/lib -lc main.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc-cross/i686-linux-gnu/10/crtendS.o /usr/lib/gcc-cross/i686-linux-gnu/10/../../../../i686-linux-gnu/lib/../lib/crtn.o COLLECT_GCC_OPTIONS='-v' '-L/lib/i386-linux-gnu/' '-o' 'main' '-mtune=generic' '-march=i686'
As you can see, there’s quite a bit more to linking main than your ld command accounts for. (Strictly speaking, using i686-linux-gnu-gcc here also means you don’t need to specify -L/lib/i386-linux-gnu/ -lc.)
Incidentally, if you’re building for 32-bit x86 on Debian, I’m not sure there’s any reason to use the PikeOS toolchain — you should use the GCC cross-compiler for everything.