[ELF] Fix uninitialized variables

Properly initialize _exportDynamic in ELFLinkingContext and an ELF_Sym object
created in CRuntimeFile with default values.

llvm-svn: 219380
This commit is contained in:
Rafael Auler 2014-10-09 01:54:15 +00:00
parent 147c2ea05a
commit 9fe8db2e02
2 changed files with 6 additions and 4 deletions

View File

@ -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);

View File

@ -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(); }