This program:
.global _start
_start:
movl $1, %eax
movl $42, %ebx
int $0x80
“./clang -nostdlib x.s”
Will not get a dynamic section unless -E passed to lld and because of that will segfault. If the .interp section is omitted (static) then the dynamic section isn’t needed and the program will run.
Can lld recognize that an .interp is not needed (no DT_NEEDED) and omit the section even when the user/driver adds –dynamic-linker=xxx? Or should the .dynamic section be present as in the case when -E is used?