I don't know if I can ask these kind of question here but I do it anyway.
I'm trying to run 32-bit linux binaries in the browser in doing so I compiled box86 to wasm (box86js) and run couples of simple binaries directly in the browser.
now I want a dynamic linker that itself depened on libc SDL2 GL and maybe afew others and when loading a binary that has a dependency on those libraries it resolve the symbols of those libraries with it's own symbols.
in this way I hope I can run more complicated binaries in the browser with performance much better than jslinux and full access to browser API and also I think having a single file that can be run both natively and in the browser is pretty cool.
glibc has too many moving parts and I hope you can help me with it.
I compiled glibc with these command on my x86_64 debian sid system
../glibc-2.31/configure CC="gcc -m32" CXX="g++ -m32" CFLAGS="-O3" CXXFLAGS="-O3" --build=i686-linux-gnu --host=i686-linux-gnu --prefix /opt/glibc
you can see the relevant part for compiling only ld.so here (the main file is rtld.c)
I modfied a few places in rtld.c and tried to compile this but gives me lots of undefined symbols
/*
ofilepath=myld
gcc -m32 -pie -std=gnu11 -fgnu89-inline -O3 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -Wstrict-prototypes -Wold-style-definition -fmath-errno -fPIC -fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0 -Wa,-mtune=i686 -mno-sse -mno-mmx -mfpmath=387 -fno-tree-loop-distribute-patterns -Wno-uninitialized -Wno-unused -D'SYSCONFDIR="/etc"' -ftls-model=initial-exec -I$sdir/include -I$builddir/elf -I$builddir -I$sdir/sysdeps/unix/sysv/linux/i386/i686 -I$sdir/sysdeps/i386/i686/nptl -I$sdir/sysdeps/unix/sysv/linux/i386 -I$sdir/sysdeps/unix/sysv/linux/x86/include -I$sdir/sysdeps/unix/sysv/linux/x86 -I$sdir/sysdeps/x86/nptl -I$sdir/sysdeps/i386/nptl -I$sdir/sysdeps/unix/sysv/linux/include -I$sdir/sysdeps/unix/sysv/linux -I$sdir/sysdeps/nptl -I$sdir/sysdeps/pthread -I$sdir/sysdeps/gnu -I$sdir/sysdeps/unix/inet -I$sdir/sysdeps/unix/sysv -I$sdir/sysdeps/unix/i386 -I$sdir/sysdeps/unix -I$sdir/sysdeps/posix -I$sdir/sysdeps/i386/i686/fpu/multiarch -I$sdir/sysdeps/i386/i686/fpu -I$sdir/sysdeps/i386/i686/multiarch -I$sdir/sysdeps/i386/i686 -I$sdir/sysdeps/i386/fpu -I$sdir/sysdeps/x86/fpu/include -I$sdir/sysdeps/x86/fpu -I$sdir/sysdeps/i386 -I$sdir/sysdeps/x86 -I$sdir/sysdeps/wordsize-32 -I$sdir/sysdeps/ieee754/float128 -I$sdir/sysdeps/ieee754/ldbl-96/include -I$sdir/sysdeps/ieee754/ldbl-96 -I$sdir/sysdeps/ieee754/dbl-64 -I$sdir/sysdeps/ieee754/flt-32 -I$sdir/sysdeps/ieee754 -I$sdir/sysdeps/generic -I$sdir -I$sdir/libio -I$sdir/elf -D_LIBC_REENTRANT -include $builddir/libc-modules.h -DMODULE_NAME=rtld -include $sdir/include/libc-symbols.h -DPIC -DSHARED -DTOP_NAMESPACE=glibc -o $ofilepath $0 $builddir/elf/rtld.os $builddir/elf/dl-load.os $builddir/elf/dl-lookup.os $builddir/elf/dl-object.os $builddir/elf/dl-reloc.os $builddir/elf/dl-deps.os $builddir/elf/dl-hwcaps.os $builddir/elf/dl-runtime.os $builddir/elf/dl-init.os $builddir/elf/dl-fini.os $builddir/elf/dl-debug.os $builddir/elf/dl-misc.os $builddir/elf/dl-version.os $builddir/elf/dl-profile.os $builddir/elf/dl-tls.os $builddir/elf/dl-origin.os $builddir/elf/dl-scope.os $builddir/elf/dl-execstack.os $builddir/elf/dl-open.os $builddir/elf/dl-close.os $builddir/elf/dl-trampoline.os $builddir/elf/dl-exception.os $builddir/elf/dl-sort-maps.os $builddir/elf/dl-cache.os $builddir/elf/dl-tunables.os $builddir/elf/libc-do-syscall.os $builddir/elf/tlsdesc.os $builddir/elf/dl-tlsdesc.os $builddir/elf/dl-get-cpu-features.os $builddir/elf/dl-sysdep.os $builddir/elf/dl-environ.os $builddir/elf/dl-minimal.os $builddir/elf/dl-error-minimal.os $builddir/elf/dl-conflict.os
exit 1
*/
#include <ldsodefs.h>
static ElfW(Addr) __attribute_used__ _dl_start (void *arg);
ElfW(Addr) _dl_sysdep_start (void **start_argptr, void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phnum, ElfW(Addr) *user_entry, ElfW(auxv_t) *auxv));
void dl_main(const ElfW(Phdr) *phdr, ElfW(Word) phnum, ElfW(Addr) *user_entry, ElfW(auxv_t) *auxv);
int main(int argc, char** argv)
{
//dl_start();
_dl_sysdep_start((void*) (argv - 1), &dl_main);
}
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-profile.os: warning: relocation against `__GI___fxstat64' in read-only section `.text'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `is_dst':
dl-load.c:(.text+0x18): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `lose.constprop.0':
dl-load.c:(.text+0x254): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `open_verify.constprop.1':
dl-load.c:(.text+0x2e3): undefined reference to `__GI___open64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x2f8): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x323): undefined reference to `__GI___read_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x407): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x417): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x57d): undefined reference to `__GI___pread64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x652): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x66e): undefined reference to `strlen'
/usr/bin/ld: dl-load.c:(.text+0x721): undefined reference to `__GI___pread64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x82c): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `open_verify.constprop.0':
dl-load.c:(.text+0x88b): undefined reference to `__GI___open64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x8a8): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x8ce): undefined reference to `__GI___read_nocancel'
/usr/bin/ld: dl-load.c:(.text+0xaed): undefined reference to `__GI___pread64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0xc3a): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0xcaf): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0xcbf): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0xd11): undefined reference to `__GI___pread64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0xe74): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `open_path':
dl-load.c:(.text+0x10b0): undefined reference to `__GI___fxstat64'
/usr/bin/ld: dl-load.c:(.text+0x10cd): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x10dc): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x113c): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x120a): undefined reference to `__GI___xstat64'
/usr/bin/ld: dl-load.c:(.text+0x149a): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `add_name_to_object.isra.0':
dl-load.c:(.text+0x15b0): undefined reference to `strcmp'
/usr/bin/ld: dl-load.c:(.text+0x15cd): undefined reference to `strlen'
/usr/bin/ld: dl-load.c:(.text+0x1622): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `_dl_map_object_from_fd':
dl-load.c:(.text+0x1942): undefined reference to `__mmap'
/usr/bin/ld: dl-load.c:(.text+0x1a7f): undefined reference to `__mmap'
/usr/bin/ld: dl-load.c:(.text+0x1cd0): undefined reference to `__GI___fxstat64'
/usr/bin/ld: dl-load.c:(.text+0x1d72): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x1dca): undefined reference to `__GI___pread64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x1e7e): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x1ec1): undefined reference to `__mprotect'
/usr/bin/ld: dl-load.c:(.text+0x21f1): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x2282): undefined reference to `memmove'
/usr/bin/ld: dl-load.c:(.text+0x240b): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x244b): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x249a): undefined reference to `__mmap'
/usr/bin/ld: dl-load.c:(.text+0x25bc): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x27db): undefined reference to `__mprotect'
/usr/bin/ld: dl-load.c:(.text+0x2834): undefined reference to `__mprotect'
/usr/bin/ld: dl-load.c:(.text+0x28df): undefined reference to `__mprotect'
/usr/bin/ld: dl-load.c:(.text+0x2902): undefined reference to `__mprotect'
/usr/bin/ld: dl-load.c:(.text+0x298b): undefined reference to `__munmap'
/usr/bin/ld: dl-load.c:(.text+0x2aab): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `_dl_dst_count':
dl-load.c:(.text+0x2b8b): undefined reference to `strchr'
/usr/bin/ld: dl-load.c:(.text+0x2bec): undefined reference to `strchr'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `expand_dynamic_string_token':
dl-load.c:(.text+0x2d9c): undefined reference to `strchr'
/usr/bin/ld: dl-load.c:(.text+0x2dac): undefined reference to `__strdup'
/usr/bin/ld: dl-load.c:(.text+0x2e1c): undefined reference to `strchr'
/usr/bin/ld: dl-load.c:(.text+0x2e38): undefined reference to `strlen'
/usr/bin/ld: dl-load.c:(.text+0x2e5d): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `fillin_rpath.isra.0':
dl-load.c:(.text+0x2f7c): undefined reference to `strlen'
/usr/bin/ld: dl-load.c:(.text+0x3074): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `decompose_rpath':
dl-load.c:(.text+0x3235): undefined reference to `__strdup'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `_dl_init_paths':
dl-load.c:(.text+0x3601): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `_dl_map_object':
dl-load.c:(.text+0x37e3): undefined reference to `strcmp'
/usr/bin/ld: dl-load.c:(.text+0x3854): undefined reference to `strchr'
/usr/bin/ld: dl-load.c:(.text+0x3932): undefined reference to `strchr'
/usr/bin/ld: dl-load.c:(.text+0x3952): undefined reference to `__strdup'
/usr/bin/ld: dl-load.c:(.text+0x39c3): undefined reference to `__strdup'
/usr/bin/ld: dl-load.c:(.text+0x3a3e): undefined reference to `strlen'
/usr/bin/ld: dl-load.c:(.text+0x3d7c): undefined reference to `strchr'
/usr/bin/ld: dl-load.c:(.text+0x3ef1): undefined reference to `strcmp'
/usr/bin/ld: dl-load.c:(.text+0x407e): undefined reference to `strlen'
/usr/bin/ld: dl-load.c:(.text+0x40f9): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x41d7): undefined reference to `strcmp'
/usr/bin/ld: dl-load.c:(.text+0x4294): undefined reference to `strlen'
/usr/bin/ld: /tmp/cc7UpnIn.o: in function `main':
myld.c:(.text.startup+0x21): undefined reference to `dl_main'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/rtld.os: in function `handle_preload_list':
rtld.c:(.text+0x199): undefined reference to `strlen'
/usr/bin/ld: rtld.c:(.text+0x1b3): undefined reference to `memchr'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-lookup.os: in function `check_match':
dl-lookup.c:(.text+0x64): undefined reference to `strcmp'
/usr/bin/ld: dl-lookup.c:(.text+0x128): undefined reference to `strcmp'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-lookup.os: in function `do_lookup_x':
dl-lookup.c:(.text+0x55f): undefined reference to `strcmp'
/usr/bin/ld: dl-lookup.c:(.text+0x5eb): undefined reference to `strcmp'
/usr/bin/ld: dl-lookup.c:(.text+0x72c): undefined reference to `strcmp'
/usr/bin/ld: dl-lookup.c:(.text+0xbc5): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-object.os: in function `_dl_new_object':
dl-object.c:(.text+0xee): undefined reference to `strlen'
/usr/bin/ld: dl-object.c:(.text+0x268): undefined reference to `strlen'
/usr/bin/ld: dl-object.c:(.text+0x29a): undefined reference to `rtld_errno'
/usr/bin/ld: dl-object.c:(.text+0x2d5): undefined reference to `__getcwd'
/usr/bin/ld: dl-object.c:(.text+0x2ed): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-reloc.os: in function `_dl_protect_relro':
dl-reloc.c:(.text+0x2ba): undefined reference to `__mprotect'
/usr/bin/ld: dl-reloc.c:(.text+0x2d5): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-reloc.os: in function `_dl_relocate_object':
dl-reloc.c:(.text+0x7d2): undefined reference to `__mprotect'
/usr/bin/ld: dl-reloc.c:(.text+0x1f79): undefined reference to `__mprotect'
/usr/bin/ld: dl-reloc.c:(.text+0x20ef): undefined reference to `__mprotect'
/usr/bin/ld: dl-reloc.c:(.text+0x2180): undefined reference to `__GI__exit'
/usr/bin/ld: dl-reloc.c:(.text+0x27af): undefined reference to `rtld_errno'
/usr/bin/ld: dl-reloc.c:(.text+0x27e0): undefined reference to `__GI__exit'
/usr/bin/ld: dl-reloc.c:(.text+0x2834): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-deps.os: in function `_dl_map_object_deps':
dl-deps.c:(.text+0x466): undefined reference to `rtld_errno'
/usr/bin/ld: dl-deps.c:(.text+0x46c): undefined reference to `rtld_errno'
/usr/bin/ld: dl-deps.c:(.text+0x638): undefined reference to `strlen'
/usr/bin/ld: dl-deps.c:(.text+0x669): undefined reference to `strlen'
/usr/bin/ld: dl-deps.c:(.text+0x882): undefined reference to `strlen'
/usr/bin/ld: dl-deps.c:(.text+0x8b1): undefined reference to `strlen'
/usr/bin/ld: dl-deps.c:(.text+0x984): undefined reference to `rtld_errno'
/usr/bin/ld: dl-deps.c:(.text+0xd12): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-hwcaps.os: in function `_dl_important_hwcaps':
dl-hwcaps.c:(.text+0x2c0): undefined reference to `strlen'
/usr/bin/ld: dl-hwcaps.c:(.text+0x37a): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-misc.os: in function `_dl_debug_vdprintf':
dl-misc.c:(.text+0x2ee): undefined reference to `strlen'
/usr/bin/ld: dl-misc.c:(.text+0x322): undefined reference to `__getpid'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-misc.os: in function `_dl_sysdep_read_whole_file':
dl-misc.c:(.text+0x484): undefined reference to `__GI___open64_nocancel'
/usr/bin/ld: dl-misc.c:(.text+0x4ae): undefined reference to `__GI___fxstat64'
/usr/bin/ld: dl-misc.c:(.text+0x4d1): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-misc.c:(.text+0x4f3): undefined reference to `__mmap'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-misc.os: in function `_dl_name_match_p':
dl-misc.c:(.text+0x592): undefined reference to `strcmp'
/usr/bin/ld: dl-misc.c:(.text+0x5be): undefined reference to `strcmp'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-version.os: in function `_dl_check_map_versions':
dl-version.c:(.text+0x280): undefined reference to `strcmp'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-profile.os: in function `_dl_start_profile':
dl-profile.c:(.text+0x1b7): undefined reference to `strlen'
/usr/bin/ld: dl-profile.c:(.text+0x1cb): undefined reference to `strlen'
/usr/bin/ld: dl-profile.c:(.text+0x22e): undefined reference to `__GI___open64_nocancel'
/usr/bin/ld: dl-profile.c:(.text+0x24e): undefined reference to `__GI___fxstat64'
/usr/bin/ld: dl-profile.c:(.text+0x2cb): undefined reference to `__mmap'
/usr/bin/ld: dl-profile.c:(.text+0x2e6): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-profile.c:(.text+0x394): undefined reference to `__munmap'
/usr/bin/ld: dl-profile.c:(.text+0x3e8): undefined reference to `rtld_errno'
/usr/bin/ld: dl-profile.c:(.text+0x3f7): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-profile.c:(.text+0x43a): undefined reference to `rtld_errno'
/usr/bin/ld: dl-profile.c:(.text+0x44b): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-profile.c:(.text+0x616): undefined reference to `__profil'
/usr/bin/ld: dl-profile.c:(.text+0x67c): undefined reference to `__lseek'
/usr/bin/ld: dl-profile.c:(.text+0x692): undefined reference to `rtld_errno'
/usr/bin/ld: dl-profile.c:(.text+0x6b2): undefined reference to `__GI___write_nocancel'
/usr/bin/ld: dl-profile.c:(.text+0x752): undefined reference to `__munmap'
/usr/bin/ld: dl-profile.c:(.text+0x76e): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-tls.os: in function `oom':
dl-tls.c:(.text+0x23): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-tls.os: in function `_dl_tls_static_surplus_init':
dl-tls.c:(.text+0x388): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-origin.os: in function `_dl_get_origin':
dl-origin.c:(.text+0xa1): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-execstack.os: in function `__GI__dl_make_stack_executable':
dl-execstack.c:(.text+0x27): undefined reference to `__mprotect'
/usr/bin/ld: dl-execstack.c:(.text+0x4a): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-open.os: in function `__GI__dl_find_dso_for_object':
dl-open.c:(.text+0x3b7): undefined reference to `_dl_addr_inside_object'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-open.os: in function `dl_open_worker':
dl-open.c:(.text+0xae5): undefined reference to `strchr'
/usr/bin/ld: dl-open.c:(.text+0x10e8): undefined reference to `strchr'
/usr/bin/ld: dl-open.c:(.text+0x155e): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-close.os: in function `_dl_close_worker.part.0.isra.0':
dl-close.c:(.text+0x11e0): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-exception.os: in function `length_mismatch':
dl-exception.c:(.text+0x23): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-exception.os: in function `__GI__dl_exception_create':
dl-exception.c:(.text+0x53): undefined reference to `strlen'
/usr/bin/ld: dl-exception.c:(.text+0x65): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-exception.os: in function `__GI__dl_exception_create_format':
dl-exception.c:(.text+0x14c): undefined reference to `strlen'
/usr/bin/ld: dl-exception.c:(.text+0x1c3): undefined reference to `strlen'
/usr/bin/ld: dl-exception.c:(.text+0x3d9): undefined reference to `__GI__exit'
/usr/bin/ld: dl-exception.c:(.text+0x3ee): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-sort-maps.os: in function `_dl_sort_maps':
dl-sort-maps.c:(.text+0x11b): undefined reference to `memmove'
/usr/bin/ld: dl-sort-maps.c:(.text+0x143): undefined reference to `memmove'
/usr/bin/ld: dl-sort-maps.c:(.text+0x1b0): undefined reference to `memmove'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-cache.os: in function `_dl_load_cache_lookup':
dl-cache.c:(.text+0x18d): undefined reference to `strcmp'
/usr/bin/ld: dl-cache.c:(.text+0x1a5): undefined reference to `strcmp'
/usr/bin/ld: dl-cache.c:(.text+0x3e3): undefined reference to `strlen'
/usr/bin/ld: dl-cache.c:(.text+0x40e): undefined reference to `__strdup'
/usr/bin/ld: dl-cache.c:(.text+0x723): undefined reference to `__munmap'
/usr/bin/ld: dl-cache.c:(.text+0x767): undefined reference to `__munmap'
/usr/bin/ld: dl-cache.c:(.text+0x96d): undefined reference to `__munmap'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-cache.os: in function `_dl_unload_cache':
dl-cache.c:(.text+0xa63): undefined reference to `__munmap'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-tunables.os: in function `__GI___tunables_init':
dl-tunables.c:(.text+0x301): undefined reference to `__sbrk'
/usr/bin/ld: dl-tunables.c:(.text+0x828): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/tlsdesc.os: in function `_dl_unmap':
tlsdesc.c:(.text+0x776): undefined reference to `__munmap'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-sysdep.os: in function `_dl_sysdep_start':
dl-sysdep.c:(.text+0x10c6): undefined reference to `_environ'
/usr/bin/ld: dl-sysdep.c:(.text+0x14c1): undefined reference to `__brk'
/usr/bin/ld: dl-sysdep.c:(.text+0x1616): undefined reference to `strlen'
/usr/bin/ld: dl-sysdep.c:(.text+0x1629): undefined reference to `__sbrk'
/usr/bin/ld: dl-sysdep.c:(.text+0x17c2): undefined reference to `__sbrk'
/usr/bin/ld: dl-sysdep.c:(.text+0x17e1): undefined reference to `__libc_check_standard_fds'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-sysdep.os: in function `_dl_discover_osversion':
dl-sysdep.c:(.text+0x1ca9): undefined reference to `__uname'
/usr/bin/ld: dl-sysdep.c:(.text+0x1d65): undefined reference to `__GI___open64_nocancel'
/usr/bin/ld: dl-sysdep.c:(.text+0x1d7e): undefined reference to `__GI___read_nocancel'
/usr/bin/ld: dl-sysdep.c:(.text+0x1d88): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-environ.os: in function `unsetenv':
dl-environ.c:(.text+0x53): undefined reference to `__environ'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-minimal.os: in function `malloc':
dl-minimal.c:(.text+0x83): undefined reference to `__mmap'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-minimal.os: in function `__GI___libc_fatal':
dl-minimal.c:(.text+0x2f7): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-minimal.os: in function `__GI___chk_fail':
dl-minimal.c:(.text+0x306): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-minimal.os: in function `__GI___assert_fail':
dl-minimal.c:(.text+0x351): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-minimal.os: in function `__GI___assert_perror_fail':
dl-minimal.c:(.text+0x455): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-error-minimal.os: in function `fatal_error':
dl-error-minimal.c:(.text+0x7d): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-error-minimal.os: in function `_dl_signal_exception':
dl-error-minimal.c:(.text+0xf2): undefined reference to `__longjmp'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-error-minimal.os: in function `_dl_signal_error':
dl-error-minimal.c:(.text+0x15a): undefined reference to `__longjmp'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-error-minimal.os: in function `_dl_catch_exception':
dl-error-minimal.c:(.text+0x2ea): undefined reference to `__sigsetjmp'
/usr/bin/ld: /home/raoof/playground/bin/myld: hidden symbol `memmove' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status