[llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp MachOWriter.cpp
Bill Wendling
isanbard at gmail.com
Wed Jan 17 14:22:50 PST 2007
Changes in directory llvm/lib/CodeGen:
ELFWriter.cpp updated: 1.32 -> 1.33
MachOWriter.cpp updated: 1.14 -> 1.15
---
Log message:
Changed to use the OutputBuffer instead of the methods in MachO and ELF
writers.
---
Diffs of the changes: (+148 -126)
ELFWriter.cpp | 112 ++++++++++++++++++++------------------
MachOWriter.cpp | 162 ++++++++++++++++++++++++++++++--------------------------
2 files changed, 148 insertions(+), 126 deletions(-)
Index: llvm/lib/CodeGen/ELFWriter.cpp
diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.32 llvm/lib/CodeGen/ELFWriter.cpp:1.33
--- llvm/lib/CodeGen/ELFWriter.cpp:1.32 Wed Jan 17 03:06:13 2007
+++ llvm/lib/CodeGen/ELFWriter.cpp Wed Jan 17 16:22:31 2007
@@ -38,6 +38,7 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/Mangler.h"
+#include "llvm/Support/OutputBuffer.h"
#include "llvm/Support/Streams.h"
using namespace llvm;
@@ -50,11 +51,12 @@
/// functions to the ELF file.
class ELFCodeEmitter : public MachineCodeEmitter {
ELFWriter &EW;
+ TargetMachine &TM;
ELFWriter::ELFSection *ES; // Section to write to.
std::vector<unsigned char> *OutBuffer;
size_t FnStart;
public:
- ELFCodeEmitter(ELFWriter &ew) : EW(ew), OutBuffer(0) {}
+ ELFCodeEmitter(ELFWriter &ew) : EW(ew), TM(EW.TM), OutBuffer(0) {}
void startFunction(MachineFunction &F);
bool finishFunction(MachineFunction &F);
@@ -103,8 +105,8 @@
ELFWriter::ELFSection::SHF_EXECINSTR |
ELFWriter::ELFSection::SHF_ALLOC);
OutBuffer = &ES->SectionData;
- cerr << "FIXME: This code needs to be updated for changes in the"
- << " CodeEmitter interfaces. In particular, this should set "
+ cerr << "FIXME: This code needs to be updated for changes in the "
+ << "CodeEmitter interfaces. In particular, this should set "
<< "BufferBegin/BufferEnd/CurBufferPtr, not deal with OutBuffer!";
abort();
@@ -113,8 +115,8 @@
// Add padding zeros to the end of the buffer to make sure that the
// function will start on the correct byte alignment within the section.
- ELFWriter::align(*OutBuffer, Align);
-
+ OutputBuffer OB(TM, *OutBuffer);
+ OB.align(Align);
FnStart = OutBuffer->size();
}
@@ -145,7 +147,7 @@
FnSym.SetType(ELFWriter::ELFSym::STT_FUNC);
FnSym.SectionIdx = ES->SectionIdx;
- FnSym.Value = FnStart; // Value = Offset from start of Section.
+ FnSym.Value = FnStart; // Value = Offset from start of Section.
FnSym.Size = OutBuffer->size()-FnStart;
// Finally, add it to the symtab.
@@ -180,37 +182,38 @@
// Local alias to shortenify coming code.
std::vector<unsigned char> &FH = FileHeader;
+ OutputBuffer FHOut(TM, FH);
- outbyte(FH, 0x7F); // EI_MAG0
- outbyte(FH, 'E'); // EI_MAG1
- outbyte(FH, 'L'); // EI_MAG2
- outbyte(FH, 'F'); // EI_MAG3
- outbyte(FH, is64Bit ? 2 : 1); // EI_CLASS
- outbyte(FH, isLittleEndian ? 1 : 2); // EI_DATA
- outbyte(FH, 1); // EI_VERSION
+ FHOut.outbyte(0x7F); // EI_MAG0
+ FHOut.outbyte('E'); // EI_MAG1
+ FHOut.outbyte('L'); // EI_MAG2
+ FHOut.outbyte('F'); // EI_MAG3
+ FHOut.outbyte(is64Bit ? 2 : 1); // EI_CLASS
+ FHOut.outbyte(isLittleEndian ? 1 : 2); // EI_DATA
+ FHOut.outbyte(1); // EI_VERSION
FH.resize(16); // EI_PAD up to 16 bytes.
// This should change for shared objects.
- outhalf(FH, 1); // e_type = ET_REL
- outhalf(FH, e_machine); // e_machine = whatever the target wants
- outword(FH, 1); // e_version = 1
- outaddr(FH, 0); // e_entry = 0 -> no entry point in .o file
- outaddr(FH, 0); // e_phoff = 0 -> no program header for .o
+ FHOut.outhalf(1); // e_type = ET_REL
+ FHOut.outhalf(e_machine); // e_machine = whatever the target wants
+ FHOut.outword(1); // e_version = 1
+ FHOut.outaddr(0); // e_entry = 0 -> no entry point in .o file
+ FHOut.outaddr(0); // e_phoff = 0 -> no program header for .o
ELFHeader_e_shoff_Offset = FH.size();
- outaddr(FH, 0); // e_shoff
- outword(FH, e_flags); // e_flags = whatever the target wants
+ FHOut.outaddr(0); // e_shoff
+ FHOut.outword(e_flags); // e_flags = whatever the target wants
- outhalf(FH, is64Bit ? 64 : 52); // e_ehsize = ELF header size
- outhalf(FH, 0); // e_phentsize = prog header entry size
- outhalf(FH, 0); // e_phnum = # prog header entries = 0
- outhalf(FH, is64Bit ? 64 : 40); // e_shentsize = sect hdr entry size
+ FHOut.outhalf(is64Bit ? 64 : 52); // e_ehsize = ELF header size
+ FHOut.outhalf(0); // e_phentsize = prog header entry size
+ FHOut.outhalf(0); // e_phnum = # prog header entries = 0
+ FHOut.outhalf(is64Bit ? 64 : 40); // e_shentsize = sect hdr entry size
ELFHeader_e_shnum_Offset = FH.size();
- outhalf(FH, 0); // e_shnum = # of section header ents
+ FHOut.outhalf(0); // e_shnum = # of section header ents
ELFHeader_e_shstrndx_Offset = FH.size();
- outhalf(FH, 0); // e_shstrndx = Section # of '.shstrtab'
+ FHOut.outhalf(0); // e_shstrndx = Section # of '.shstrtab'
// Add the null section, which is required to be first in the file.
getSection("", 0, 0);
@@ -350,9 +353,10 @@
StrTab.Align = 1;
DataBuffer &StrTabBuf = StrTab.SectionData;
+ OutputBuffer StrTabOut(TM, StrTabBuf);
// Set the zero'th symbol to a null byte, as required.
- outbyte(StrTabBuf, 0);
+ StrTabOut.outbyte(0);
SymbolTable[0].NameIdx = 0;
unsigned Index = 1;
for (unsigned i = 1, e = SymbolTable.size(); i != e; ++i) {
@@ -385,26 +389,27 @@
SymTab.Info = FirstNonLocalSymbol; // First non-STB_LOCAL symbol.
SymTab.EntSize = 16; // Size of each symtab entry. FIXME: wrong for ELF64
DataBuffer &SymTabBuf = SymTab.SectionData;
+ OutputBuffer SymTabOut(TM, SymTabBuf);
if (!is64Bit) { // 32-bit and 64-bit formats are shuffled a bit.
for (unsigned i = 0, e = SymbolTable.size(); i != e; ++i) {
ELFSym &Sym = SymbolTable[i];
- outword(SymTabBuf, Sym.NameIdx);
- outaddr32(SymTabBuf, Sym.Value);
- outword(SymTabBuf, Sym.Size);
- outbyte(SymTabBuf, Sym.Info);
- outbyte(SymTabBuf, Sym.Other);
- outhalf(SymTabBuf, Sym.SectionIdx);
+ SymTabOut.outword(Sym.NameIdx);
+ SymTabOut.outaddr32(Sym.Value);
+ SymTabOut.outword(Sym.Size);
+ SymTabOut.outbyte(Sym.Info);
+ SymTabOut.outbyte(Sym.Other);
+ SymTabOut.outhalf(Sym.SectionIdx);
}
} else {
for (unsigned i = 0, e = SymbolTable.size(); i != e; ++i) {
ELFSym &Sym = SymbolTable[i];
- outword(SymTabBuf, Sym.NameIdx);
- outbyte(SymTabBuf, Sym.Info);
- outbyte(SymTabBuf, Sym.Other);
- outhalf(SymTabBuf, Sym.SectionIdx);
- outaddr64(SymTabBuf, Sym.Value);
- outxword(SymTabBuf, Sym.Size);
+ SymTabOut.outword(Sym.NameIdx);
+ SymTabOut.outbyte(Sym.Info);
+ SymTabOut.outbyte(Sym.Other);
+ SymTabOut.outhalf(Sym.SectionIdx);
+ SymTabOut.outaddr64(Sym.Value);
+ SymTabOut.outxword(Sym.Size);
}
}
@@ -420,7 +425,8 @@
// Now that we know which section number is the .shstrtab section, update the
// e_shstrndx entry in the ELF header.
- fixhalf(FileHeader, SHStrTab.SectionIdx, ELFHeader_e_shstrndx_Offset);
+ OutputBuffer FHOut(TM, FileHeader);
+ FHOut.fixhalf(SHStrTab.SectionIdx, ELFHeader_e_shstrndx_Offset);
// Set the NameIdx of each section in the string table and emit the bytes for
// the string table.
@@ -471,11 +477,12 @@
// Now that we know where all of the sections will be emitted, set the e_shnum
// entry in the ELF header.
- fixhalf(FileHeader, NumSections, ELFHeader_e_shnum_Offset);
+ OutputBuffer FHOut(TM, FileHeader);
+ FHOut.fixhalf(NumSections, ELFHeader_e_shnum_Offset);
// Now that we know the offset in the file of the section table, update the
// e_shoff address in the ELF header.
- fixaddr(FileHeader, FileOff, ELFHeader_e_shoff_Offset);
+ FHOut.fixaddr(FileOff, ELFHeader_e_shoff_Offset);
// Now that we know all of the data in the file header, emit it and all of the
// sections!
@@ -484,6 +491,7 @@
DataBuffer().swap(FileHeader);
DataBuffer Table;
+ OutputBuffer TableOut(TM, Table);
// Emit all of the section data and build the section table itself.
while (!SectionList.empty()) {
@@ -497,16 +505,16 @@
O.write((char*)&S.SectionData[0], S.SectionData.size());
FileOff += S.SectionData.size();
- outword(Table, S.NameIdx); // sh_name - Symbol table name idx
- outword(Table, S.Type); // sh_type - Section contents & semantics
- outword(Table, S.Flags); // sh_flags - Section flags.
- outaddr(Table, S.Addr); // sh_addr - The mem addr this section is in.
- outaddr(Table, S.Offset); // sh_offset - Offset from the file start.
- outword(Table, S.Size); // sh_size - The section size.
- outword(Table, S.Link); // sh_link - Section header table index link.
- outword(Table, S.Info); // sh_info - Auxillary information.
- outword(Table, S.Align); // sh_addralign - Alignment of section.
- outword(Table, S.EntSize); // sh_entsize - Size of entries in the section.
+ TableOut.outword(S.NameIdx); // sh_name - Symbol table name idx
+ TableOut.outword(S.Type); // sh_type - Section contents & semantics
+ TableOut.outword(S.Flags); // sh_flags - Section flags.
+ TableOut.outaddr(S.Addr); // sh_addr - The mem addr this section is in.
+ TableOut.outaddr(S.Offset); // sh_offset - Offset from the file start.
+ TableOut.outword(S.Size); // sh_size - The section size.
+ TableOut.outword(S.Link); // sh_link - Section header table index link.
+ TableOut.outword(S.Info); // sh_info - Auxillary information.
+ TableOut.outword(S.Align); // sh_addralign - Alignment of section.
+ TableOut.outword(S.EntSize); // sh_entsize - Size of entries in the section
SectionList.pop_front();
}
Index: llvm/lib/CodeGen/MachOWriter.cpp
diff -u llvm/lib/CodeGen/MachOWriter.cpp:1.14 llvm/lib/CodeGen/MachOWriter.cpp:1.15
--- llvm/lib/CodeGen/MachOWriter.cpp:1.14 Wed Jan 17 03:06:13 2007
+++ llvm/lib/CodeGen/MachOWriter.cpp Wed Jan 17 16:22:31 2007
@@ -34,6 +34,7 @@
#include "llvm/Target/TargetJITInfo.h"
#include "llvm/Support/Mangler.h"
#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/OutputBuffer.h"
#include "llvm/Support/Streams.h"
#include <algorithm>
@@ -49,6 +50,9 @@
class MachOCodeEmitter : public MachineCodeEmitter {
MachOWriter &MOW;
+ /// Target machine description.
+ TargetMachine &TM;
+
/// Relocations - These are the relocations that the function needs, as
/// emitted.
std::vector<MachineRelocation> Relocations;
@@ -71,7 +75,7 @@
std::vector<intptr_t> MBBLocations;
public:
- MachOCodeEmitter(MachOWriter &mow) : MOW(mow) {}
+ MachOCodeEmitter(MachOWriter &mow) : MOW(mow), TM(MOW.TM) {}
virtual void startFunction(MachineFunction &F);
virtual bool finishFunction(MachineFunction &F);
@@ -163,7 +167,7 @@
// Get a symbol for the function to add to the symbol table
const GlobalValue *FuncV = F.getFunction();
- MachOSym FnSym(FuncV, MOW.Mang->getValueName(FuncV), MOS->Index, MOW.TM);
+ MachOSym FnSym(FuncV, MOW.Mang->getValueName(FuncV), MOS->Index, TM);
// Emit constant pool to appropriate section(s)
emitConstantPool(F.getConstantPool());
@@ -211,7 +215,7 @@
if (CP.empty()) return;
// FIXME: handle PIC codegen
- bool isPIC = MOW.TM.getRelocationModel() == Reloc::PIC_;
+ bool isPIC = TM.getRelocationModel() == Reloc::PIC_;
assert(!isPIC && "PIC codegen not yet handled for mach-o jump tables!");
// Although there is no strict necessity that I am aware of, we will do what
@@ -223,9 +227,11 @@
// "giant object for PIC" optimization.
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
const Type *Ty = CP[i].getType();
- unsigned Size = MOW.TM.getTargetData()->getTypeSize(Ty);
+ unsigned Size = TM.getTargetData()->getTypeSize(Ty);
MachOWriter::MachOSection *Sec = MOW.getConstSection(Ty);
+ OutputBuffer SecDataOut(TM, Sec->SectionData);
+
CPLocations.push_back(Sec->SectionData.size());
CPSections.push_back(Sec->Index);
@@ -236,10 +242,10 @@
// FIXME: need alignment?
// FIXME: share between here and AddSymbolToSection?
for (unsigned j = 0; j < Size; ++j)
- MOW.outbyte(Sec->SectionData, 0);
+ SecDataOut.outbyte(0);
MOW.InitMem(CP[i].Val.ConstVal, &Sec->SectionData[0], CPLocations[i],
- MOW.TM.getTargetData(), Sec->Relocations);
+ TM.getTargetData(), Sec->Relocations);
}
}
@@ -250,11 +256,12 @@
if (JT.empty()) return;
// FIXME: handle PIC codegen
- bool isPIC = MOW.TM.getRelocationModel() == Reloc::PIC_;
+ bool isPIC = TM.getRelocationModel() == Reloc::PIC_;
assert(!isPIC && "PIC codegen not yet handled for mach-o jump tables!");
MachOWriter::MachOSection *Sec = MOW.getJumpTableSection();
unsigned TextSecIndex = MOW.getTextSection()->Index;
+ OutputBuffer SecDataOut(TM, Sec->SectionData);
for (unsigned i = 0, e = JT.size(); i != e; ++i) {
// For each jump table, record its offset from the start of the section,
@@ -267,7 +274,7 @@
MR.setResultPointer((void *)JTLocations[i]);
MR.setConstantVal(TextSecIndex);
Sec->Relocations.push_back(MR);
- MOW.outaddr(Sec->SectionData, 0);
+ SecDataOut.outaddr(0);
}
}
// FIXME: remove when we have unified size + output buffer
@@ -302,6 +309,8 @@
// Reserve space in the .bss section for this symbol while maintaining the
// desired section alignment, which must be at least as much as required by
// this symbol.
+ OutputBuffer SecDataOut(TM, Sec->SectionData);
+
if (Align) {
uint64_t OrigSize = Sec->size;
Align = Log2_32(Align);
@@ -312,7 +321,7 @@
// FIXME: remove when we have unified size + output buffer
unsigned AlignedSize = Sec->size - OrigSize;
for (unsigned i = 0; i < AlignedSize; ++i)
- outbyte(Sec->SectionData, 0);
+ SecDataOut.outbyte(0);
}
// Record the offset of the symbol, and then allocate space for it.
// FIXME: remove when we have unified size + output buffer
@@ -329,7 +338,7 @@
// Allocate space in the section for the global.
for (unsigned i = 0; i < Size; ++i)
- outbyte(Sec->SectionData, 0);
+ SecDataOut.outbyte(0);
}
void MachOWriter::EmitGlobal(GlobalVariable *GV) {
@@ -442,15 +451,17 @@
// Step #3: write the header to the file
// Local alias to shortenify coming code.
DataBuffer &FH = Header.HeaderData;
- outword(FH, Header.magic);
- outword(FH, Header.cputype);
- outword(FH, Header.cpusubtype);
- outword(FH, Header.filetype);
- outword(FH, Header.ncmds);
- outword(FH, Header.sizeofcmds);
- outword(FH, Header.flags);
+ OutputBuffer FHOut(TM, FH);
+
+ FHOut.outword(Header.magic);
+ FHOut.outword(Header.cputype);
+ FHOut.outword(Header.cpusubtype);
+ FHOut.outword(Header.filetype);
+ FHOut.outword(Header.ncmds);
+ FHOut.outword(Header.sizeofcmds);
+ FHOut.outword(Header.flags);
if (is64Bit)
- outword(FH, Header.reserved);
+ FHOut.outword(Header.reserved);
// Step #4: Finish filling in the segment load command and write it out
for (std::vector<MachOSection*>::iterator I = SectionList.begin(),
@@ -460,17 +471,17 @@
SEG.vmsize = SEG.filesize;
SEG.fileoff = Header.cmdSize(is64Bit) + Header.sizeofcmds;
- outword(FH, SEG.cmd);
- outword(FH, SEG.cmdsize);
- outstring(FH, SEG.segname, 16);
- outaddr(FH, SEG.vmaddr);
- outaddr(FH, SEG.vmsize);
- outaddr(FH, SEG.fileoff);
- outaddr(FH, SEG.filesize);
- outword(FH, SEG.maxprot);
- outword(FH, SEG.initprot);
- outword(FH, SEG.nsects);
- outword(FH, SEG.flags);
+ FHOut.outword(SEG.cmd);
+ FHOut.outword(SEG.cmdsize);
+ FHOut.outstring(SEG.segname, 16);
+ FHOut.outaddr(SEG.vmaddr);
+ FHOut.outaddr(SEG.vmsize);
+ FHOut.outaddr(SEG.fileoff);
+ FHOut.outaddr(SEG.filesize);
+ FHOut.outword(SEG.maxprot);
+ FHOut.outword(SEG.initprot);
+ FHOut.outword(SEG.nsects);
+ FHOut.outword(SEG.flags);
// Step #5: Finish filling in the fields of the MachOSections
uint64_t currentAddr = 0;
@@ -497,19 +508,19 @@
currentAddr += MOS->nreloc * 8;
// write the finalized section command to the output buffer
- outstring(FH, MOS->sectname, 16);
- outstring(FH, MOS->segname, 16);
- outaddr(FH, MOS->addr);
- outaddr(FH, MOS->size);
- outword(FH, MOS->offset);
- outword(FH, MOS->align);
- outword(FH, MOS->reloff);
- outword(FH, MOS->nreloc);
- outword(FH, MOS->flags);
- outword(FH, MOS->reserved1);
- outword(FH, MOS->reserved2);
+ FHOut.outstring(MOS->sectname, 16);
+ FHOut.outstring(MOS->segname, 16);
+ FHOut.outaddr(MOS->addr);
+ FHOut.outaddr(MOS->size);
+ FHOut.outword(MOS->offset);
+ FHOut.outword(MOS->align);
+ FHOut.outword(MOS->reloff);
+ FHOut.outword(MOS->nreloc);
+ FHOut.outword(MOS->flags);
+ FHOut.outword(MOS->reserved1);
+ FHOut.outword(MOS->reserved2);
if (is64Bit)
- outword(FH, MOS->reserved3);
+ FHOut.outword(MOS->reserved3);
}
// Step #7: Emit the symbol table to temporary buffers, so that we know the
@@ -521,36 +532,36 @@
SymTab.nsyms = SymbolTable.size();
SymTab.stroff = SymTab.symoff + SymT.size();
SymTab.strsize = StrT.size();
- outword(FH, SymTab.cmd);
- outword(FH, SymTab.cmdsize);
- outword(FH, SymTab.symoff);
- outword(FH, SymTab.nsyms);
- outword(FH, SymTab.stroff);
- outword(FH, SymTab.strsize);
+ FHOut.outword(SymTab.cmd);
+ FHOut.outword(SymTab.cmdsize);
+ FHOut.outword(SymTab.symoff);
+ FHOut.outword(SymTab.nsyms);
+ FHOut.outword(SymTab.stroff);
+ FHOut.outword(SymTab.strsize);
// FIXME: set DySymTab fields appropriately
// We should probably just update these in BufferSymbolAndStringTable since
// thats where we're partitioning up the different kinds of symbols.
- outword(FH, DySymTab.cmd);
- outword(FH, DySymTab.cmdsize);
- outword(FH, DySymTab.ilocalsym);
- outword(FH, DySymTab.nlocalsym);
- outword(FH, DySymTab.iextdefsym);
- outword(FH, DySymTab.nextdefsym);
- outword(FH, DySymTab.iundefsym);
- outword(FH, DySymTab.nundefsym);
- outword(FH, DySymTab.tocoff);
- outword(FH, DySymTab.ntoc);
- outword(FH, DySymTab.modtaboff);
- outword(FH, DySymTab.nmodtab);
- outword(FH, DySymTab.extrefsymoff);
- outword(FH, DySymTab.nextrefsyms);
- outword(FH, DySymTab.indirectsymoff);
- outword(FH, DySymTab.nindirectsyms);
- outword(FH, DySymTab.extreloff);
- outword(FH, DySymTab.nextrel);
- outword(FH, DySymTab.locreloff);
- outword(FH, DySymTab.nlocrel);
+ FHOut.outword(DySymTab.cmd);
+ FHOut.outword(DySymTab.cmdsize);
+ FHOut.outword(DySymTab.ilocalsym);
+ FHOut.outword(DySymTab.nlocalsym);
+ FHOut.outword(DySymTab.iextdefsym);
+ FHOut.outword(DySymTab.nextdefsym);
+ FHOut.outword(DySymTab.iundefsym);
+ FHOut.outword(DySymTab.nundefsym);
+ FHOut.outword(DySymTab.tocoff);
+ FHOut.outword(DySymTab.ntoc);
+ FHOut.outword(DySymTab.modtaboff);
+ FHOut.outword(DySymTab.nmodtab);
+ FHOut.outword(DySymTab.extrefsymoff);
+ FHOut.outword(DySymTab.nextrefsyms);
+ FHOut.outword(DySymTab.indirectsymoff);
+ FHOut.outword(DySymTab.nindirectsyms);
+ FHOut.outword(DySymTab.extreloff);
+ FHOut.outword(DySymTab.nextrel);
+ FHOut.outword(DySymTab.locreloff);
+ FHOut.outword(DySymTab.nlocrel);
O.write((char*)&FH[0], FH.size());
}
@@ -627,7 +638,8 @@
// Write out a leading zero byte when emitting string table, for n_strx == 0
// which means an empty string.
- outbyte(StrT, 0);
+ OutputBuffer StrTOut(TM, StrT);
+ StrTOut.outbyte(0);
// The order of the string table is:
// 1. strings for external symbols
@@ -640,10 +652,12 @@
I->n_strx = 0;
} else {
I->n_strx = StrT.size();
- outstring(StrT, I->GVName, I->GVName.length()+1);
+ StrTOut.outstring(I->GVName, I->GVName.length()+1);
}
}
+ OutputBuffer SymTOut(TM, SymT);
+
for (std::vector<MachOSym>::iterator I = SymbolTable.begin(),
E = SymbolTable.end(); I != E; ++I) {
// Add the section base address to the section offset in the n_value field
@@ -654,11 +668,11 @@
I->n_value += GVSection[GV]->addr;
// Emit nlist to buffer
- outword(SymT, I->n_strx);
- outbyte(SymT, I->n_type);
- outbyte(SymT, I->n_sect);
- outhalf(SymT, I->n_desc);
- outaddr(SymT, I->n_value);
+ SymTOut.outword(I->n_strx);
+ SymTOut.outbyte(I->n_type);
+ SymTOut.outbyte(I->n_sect);
+ SymTOut.outhalf(I->n_desc);
+ SymTOut.outaddr(I->n_value);
}
}
More information about the llvm-commits
mailing list