Issue |
128180
|
Summary |
Sample code segfaults in clang, but not in gcc
|
Labels |
clang
|
Assignees |
|
Reporter |
d33tah
|
Consider following `1.c`:
```c
__attribute__((noreturn, naked))
void _start() {
asm volatile(
"mov $60, %%rax\n"
"mov $42, %%rdi\n"
"syscall"
::: "%rax", "%rdi"
);
}
```
Compiling it under `gcc` has the program work as intended, but not with `clang`:
```
> rm a ; gcc 1.c -o a -s -nostdlib -static -fno-ident -fno-asynchronous-unwind-tables -Wl,--build-id=none -z max-page-size=0x4 ; ./a ; echo $?
42
> rm a ; clang 1.c -o a -s -nostdlib -static -fno-ident -fno-asynchronous-unwind-tables -Wl,--build-id=none -z max-page-size=0x4 ; ./a ; echo $?
Segmentation fault
139
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs