1) Install kernel headers into empty directory
2) Install glibc headers (and "touch" "<sysroot>/usr/include/gnu/stubs.h")
3) Install LLVM runtime builtins
4) Build glibc against sysroot

```
/<pathTo>/toolchain/bin/clang   -shared -static-libgcc -Wl,-O1
-Wl,-z,defs -Wl,-dynamic-linker=/lib64/ld-linux-x86-64.so.2
-Wl,-z,pack-relative-relocs  -B/<pathTo>/build/csu/
-Wl,--version-script=/<pathTo>/build/libm.map -Wl,--undefined-version
-Wl,-soname=libm.so.6 -Wl,-z,relro -Wl,-z,now  -L/<pathTo>/build
-L/<pathTo>/build/math -L/<pathTo>/build/elf -L/<pathTo>/build/dlfcn
-L/<pathTo>/build/nss -L/<pathTo>/build/nis -L/<pathTo>/build/rt
-L/<pathTo>/build/resolv -L/<pathTo>/build/mathvec
-L/<pathTo>/build/support -L/<pathTo>/build/misc
-L/<pathTo>/build/debug -L/<pathTo>/build/nptl
-Wl,-rpath-link=/<pathTo>/build:/<pathTo>/build/math:/<pathTo>/build/elf:/<pathTo>/build/dlfcn:/<pathTo>/build/nss:/<pathTo>/build/nis:/<pathTo>/build/rt:/<pathTo>/build/resolv:/<pathTo>/build/mathvec:/<pathTo>/build/support:/<pathTo>/build/misc:/<pathTo>/build/debug:/<pathTo>/build/nptl
-o /<pathTo>/build/math/libm.so /<pathTo>/build/csu/abi-note.o
-Wl,--whole-archive /<pathTo>/build/math/libm_pic.a
-Wl,--no-whole-archive   -Wl,--start-group /<pathTo>/build/libc.so
/<pathTo>/build/libc_nonshared.a -Wl,--as-needed
/<pathTo>/build/elf/ld.so -Wl,--no-as-needed -Wl,--end-group
ld.lld: warning: attempt to reassign symbol 'exp2l' of version
'GLIBC_2.2.5' to version 'GLIBC_2.4'
ld.lld: error: undefined symbol: __sfp_handle_exceptions
>>> referenced by e_sqrtf128.c
>>>               e_sqrtf128.os:(__ieee754_sqrtf128) in archive 
>>> /<pathTo>/build/math/libm_pic.a
clang: error: linker command failed with exit code 1
```

I also found it odd that even though I set "LDFLAGS" to include
sysroot and "-v", it didn't produce ld.lld verbose output (only
clang). It does with other projects.
My CFLAGS were included in "config.make", but no LDFLAGS.

I was trying to think where I've seen "undefined symbol" before and
just now remembered it was when I stripped binaries for musl and ended
up finding out the entry "_start" was ripped out.
That doesn't apply here I don't think, as no install even happened yet.

I see other "attempt to reassign symbol" warnings and read about using
"-Wl,--undefined-version" to LDFLAGS, but that didn't make any
difference (not sure why it would since they aren't "undefined").

A search led me to
https://inbox.sourceware.org/glibc-cvs/?t=20240410130446 with some
"sfp" related stuff.
I don't know when `sysdeps/x86_64/configure` ends up occurring.

Reply via email to