forked from OSchip/llvm-project
[ELF] Never mark the dynamic linker as DT_NEEDED
This patch adds logic to avoid putting the dynamic linker library (ld.so) as a DT_NEEDED entry in the dynamic table. It should only appear in PT_INTERP. This patch fixes SPEC programs 433, 445, 450, 453, 456, 462 when running on Ubuntu Linux x86_64 and when linking SPEC programs with LLD and glibc 2.19. http://reviews.llvm.org/D5573 llvm-svn: 218847
This commit is contained in:
parent
8400fa06b5
commit
1d73ae03c9
|
@ -19,6 +19,7 @@
|
|||
#include "lld/ReaderWriter/Writer.h"
|
||||
|
||||
#include "llvm/ADT/StringSet.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
|
||||
namespace lld {
|
||||
namespace elf {
|
||||
|
@ -193,6 +194,8 @@ void OutputELFWriter<ELFT>::buildDynamicSymbolTable(const File &file) {
|
|||
if (isNeededTagRequired(sla))
|
||||
_soNeeded.insert(sla->loadName());
|
||||
}
|
||||
// Never mark the dynamic linker as DT_NEEDED
|
||||
_soNeeded.erase(sys::path::filename(_context.getInterpreter()));
|
||||
for (const auto &loadName : _soNeeded) {
|
||||
Elf_Dyn dyn;
|
||||
dyn.d_tag = DT_NEEDED;
|
||||
|
|
Loading…
Reference in New Issue