`Segmentation fault` when gcc `-no-pie -fuse-ld=gold`
I compile a simple C program by gcc -fuse-ld=gold -no-pie
in alpine:3.15
:
docker run -it alpine:3.15 sh -c '
apk add build-base binutils-gold
cat > hello.c << EOF
#include <stdio.h>
int main() {
printf("hello\n");
return 0;
}
EOF
gcc -fuse-ld=gold -no-pie hello.c && ./a.out
'
a.out
reports Segmentation fault (core dumped)
.