Static linking with a custom glibc version

Mahmood Naderan nt_mahmood@yahoo.com
Thu Jun 4 09:33:20 GMT 2020


>just pass -static to the compiler so it knows what you want
>
>for custom glibc you want to pass -B path/to/crtfiles and
>may be other things too.

Excuse me, I didn't get the second sentence. Is this correct?

$ gcc -c test.c
$ gcc -o test -Wl,--emit-relocs -Wl,--rpath=/opt/glibc-2.23-install -Wl,--dynamic-linker=/opt/glibc-2.23-staticinstall/lib/ld-2.23.so -static test.o

I now get a 1.3MB file (compared to 9.6KB when -static is not used). But I want to be sure that my custom glibc is embedded in the final binary file.
You said that I have to use -B for this purpose?


Regards,
Mahmood


More information about the Libc-help mailing list