Before this patch .interp section was never created (if -dynamic-linker was not specified) because there was no default dynamic linker assigned.
Diff Detail
Event Timeline
You're missing a test case.
Target.cpp | ||
---|---|---|
204 ↗ | (On Diff #37082) | Please make this /lib64/ld64.so.1 |
Target does not seems to be the right place to put OS-specific things. It is just architecture-specific (e.g. ELF on x86-64). I'd to write this in Driver.cpp.
As @ruiu says Linux-specific settings aren't appropriate there.
For reference on FreeBSD it should be /libexec/ld-elf.so.1.
ELF/Driver.cpp | ||
---|---|---|
70–72 | The empty string is not a valid value for .interp, so let's error out. error("--dynamic-linker is not specified"); | |
216–217 | I'd write Config->DynamicLinker = getString(Args, OPT_dynamic_linker); if (Config->DynamicLinker.empty()) Config->DynamicLinker = getDefaultInterp(); so that we don't call the function if --dynamic-linker is givne. |
ELF/Driver.cpp | ||
---|---|---|
60 | This is not valid on non-Linux |
ELF/Driver.cpp | ||
---|---|---|
60 | What's the value for FreeBSD? We don't have to make this function complete from the beginning. I'm fine with this as long as we can add new entries to this function. |
ELF/Driver.cpp | ||
---|---|---|
60 | Yes, it is not valid on non-linux. But currently it looks there is no good way to find which OS we are targeting. So it is just basic implementation to support .interp section. |
What depends on this?
Both gcc and clang pass -dynamic_linker to ld.
Having ld itself guess the dynamic linker when not given that option seems like an historical artifact.
Hm, that's an interesting point. Are you suggesting we always set the same value to .interp or make --dynamic_linker mandatory?
This is not valid on non-Linux