Assemble calls to constant addresses. Finally address this TODO in the assembler. This will help translate non-IRT using programs (no ABI stability). The default scons testing mode is non-IRT, so this helps with that. I haven't actually tested this against scons yet, but I'm filling in the tests based on how LLVM translates the same bitcode. The filetype=asm is adjusted to omit the "*" and the "$". The filetype=obj is adjusted to check for fixups with NullSymbols, and also fill the assembler buffer at the instruction's immediate field w/ the right constant. The filetype=iasm is still TODO (hits an new assert in the Fixup's emit() function). Reverts 7ad1bed99d058199a3ba246a5383458518596fbc: "Allow stubbing of called constant addresses using command line argument." since this is now handled (except for iasm). BUG= https://code.google.com/p/nativeclient/issues/detail?id=4080 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1017373002
diff --git a/src/IceELFSection.cpp b/src/IceELFSection.cpp index f2e129d..4ca2de4 100644 --- a/src/IceELFSection.cpp +++ b/src/IceELFSection.cpp
@@ -80,6 +80,15 @@ // Symbol tables. +void ELFSymbolTableSection::createNullSymbol(ELFSection *NullSection) { + // The first entry in the symbol table should be a NULL entry, + // so make sure the map is still empty. + assert(LocalSymbols.empty()); + const IceString NullSymName(""); + createDefinedSym(NullSymName, STT_NOTYPE, STB_LOCAL, NullSection, 0, 0); + NullSymbol = findSymbol(NullSymName); +} + void ELFSymbolTableSection::createDefinedSym(const IceString &Name, uint8_t Type, uint8_t Binding, ELFSection *Section, @@ -105,7 +114,9 @@ NewSymbol.Sym.setBindingAndType(STB_GLOBAL, STT_NOTYPE); NewSymbol.Section = NullSection; NewSymbol.Number = ELFSym::UnknownNumber; - GlobalSymbols.insert(std::make_pair(Name, NewSymbol)); + bool Unique = GlobalSymbols.insert(std::make_pair(Name, NewSymbol)).second; + assert(Unique); + (void)Unique; } const ELFSym *ELFSymbolTableSection::findSymbol(const IceString &Name) const {