Anonymous
7/23/2025, 1:53:29 PM
No.105997925
>>105987439
I'm running Linux on a x86_64 CPU.
Consider a text file named hello_world.c, whose contents are (6 lines):
#include <stdio.h>
int main()
{
printf("Hello world.\n");
}
Consider the following two commands, intended to create
a standalone no-libraries (static) executable:
gcc -c hello_world.c
ld -m elf_x86_64 -s -o hello_world hello_world.o /usr/lib64/libc.a
Why does ld fail? How do I force ld to do it?
To put it another way: how do a make standalong static C programs?
I'm running Linux on a x86_64 CPU.
Consider a text file named hello_world.c, whose contents are (6 lines):
#include <stdio.h>
int main()
{
printf("Hello world.\n");
}
Consider the following two commands, intended to create
a standalone no-libraries (static) executable:
gcc -c hello_world.c
ld -m elf_x86_64 -s -o hello_world hello_world.o /usr/lib64/libc.a
Why does ld fail? How do I force ld to do it?
To put it another way: how do a make standalong static C programs?