Issue 107749
Summary [lld elf] Segfault within ld-linux in -nostdlib executable
Labels
Assignees
Reporter yaram
    When linking an executable with `-nostdlib`, no PIE, and no linked dynamic libraries, the executable wil crash with a segmentation fault within `audit_list_add_dynamic_tag` in the ld-linux interpreter. Switching to PIE, or linking any dynamic libraries fixes the crash.

Steps to reproduce:
1. Create some simple `main.c`
```c
void _start() {
 while(1);
}
``` 
2. Run the following commands to generate a minimal object and link it into an executable
```sh
clang -nostdlib -nostdinc -c -o main.o main.c

clang -fuse-ld=lld -nostdlib -o test main.o
```
3.
Run the generated executable, producing the segmentation fault
```sh
./test
```

I suspect the issue is due to missing dynamic segments in the executable trying to be accessed by ld-linux. Perhaps lld or clang frontend is adding the .interp section when it should not be.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to