Package: src:gcc-14

I meet a wired problem when I am doing the follow wired work:

$ cat xx.c
#include <stdio.h>
int main() {printf("hello world\n");}
$ gcc -O2 xx.c -o a.out
$ cat ld.so.c
#include <stdio.h>
int main(int argc, char *argv[]) {
        for (int i=0; i<argc; i++) {
                printf("%s\n", argv[i]);
        }
}
$ gcc -O2 -static ld.so.c -o ld.so
$ patchelf --set-interpreter /home/syq/ld.so a.out
$ ./a.out
Segmentation fault

GDB shows that the segfault happens in __ctype_init.


I had some try with some other distribution:
1) It is Debian (and Ubuntu) Specific: I cannot reproduce it on Fedora
and openEuler.
2) It is a long term problem, at least since bullseye.
3) It doesn't seem to be about kernels: I run Debian in a container
with some other kernels of other distributions.
4) It is not about CPU architectures: I have tests with X86-64/ARM64/RISCV64.
5) I am not sure about glibc: I tried to copy ld.so/a.out from Fedora
to Debian. They work well.
6) it seems not about patchelf: I copied a.out from Fedora and run
patchelf on Debian: it works well.



-- 
YunQiang Su

Reply via email to