[lld] r219380 - [ELF] Fix uninitialized variables
Rafael Auler
rafaelauler at gmail.com
Wed Oct 8 18:54:15 PDT 2014
Author: rafauler
Date: Wed Oct 8 20:54:15 2014
New Revision: 219380
URL: http://llvm.org/viewvc/llvm-project?rev=219380&view=rev
Log:
[ELF] Fix uninitialized variables
Properly initialize _exportDynamic in ELFLinkingContext and an ELF_Sym object
created in CRuntimeFile with default values.
Modified:
lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
Modified: lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFFile.h?rev=219380&r1=219379&r2=219380&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFFile.h Wed Oct 8 20:54:15 2014
@@ -390,6 +390,7 @@ public:
symbol->st_name = 0;
symbol->st_value = 0;
symbol->st_shndx = llvm::ELF::SHN_UNDEF;
+ symbol->setBindingAndType(llvm::ELF::STB_GLOBAL, llvm::ELF::STT_NOTYPE);
symbol->st_other = llvm::ELF::STV_DEFAULT;
symbol->st_size = 0;
auto newAtom = this->handleUndefinedSymbol(symbolName, symbol);
Modified: lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp?rev=219380&r1=219379&r2=219380&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp Wed Oct 8 20:54:15 2014
@@ -57,10 +57,11 @@ ELFLinkingContext::ELFLinkingContext(
: _outputELFType(elf::ET_EXEC), _triple(triple),
_targetHandler(std::move(targetHandler)), _baseAddress(0),
_isStaticExecutable(false), _noInhibitExec(false),
- _mergeCommonStrings(false), _runLayoutPass(true),
- _useShlibUndefines(true), _dynamicLinkerArg(false),
- _noAllowDynamicLibraries(false), _mergeRODataToTextSegment(true),
- _outputMagic(OutputMagic::DEFAULT), _sysrootPath("") {}
+ _exportDynamic(false), _mergeCommonStrings(false),
+ _runLayoutPass(true), _useShlibUndefines(true),
+ _dynamicLinkerArg(false), _noAllowDynamicLibraries(false),
+ _mergeRODataToTextSegment(true), _outputMagic(OutputMagic::DEFAULT),
+ _sysrootPath("") {}
bool ELFLinkingContext::is64Bits() const { return getTriple().isArch64Bit(); }
More information about the llvm-commits
mailing list