//
// The LLVM Compiler Infrastructure
//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file was developed by Chris Lattner and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
SHF_LINK_ORDER = 1 << 7, // Preserve order after combining
SHF_OS_NONCONFORMING = 1 << 8, // nonstandard OS support required
SHF_GROUP = 1 << 9, // Section is a member of a group
- SHF_TLS = 1 << 10,// Section holds thread-local data
+ SHF_TLS = 1 << 10 // Section holds thread-local data
};
ELFSection(const std::string &name)
return *SN;
}
+ ELFSection &getDataSection() {
+ return getSection(".data", ELFSection::SHT_PROGBITS,
+ ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC);
+ }
+ ELFSection &getBSSSection() {
+ return getSection(".bss", ELFSection::SHT_NOBITS,
+ ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC);
+ }
+
/// ELFSym - This struct contains information about each symbol that is
/// added to logical symbol table for the module. This is eventually
/// turned into a real symbol table in the file.
}
void outxword(DataBuffer &Output, uint64_t X) {
if (isLittleEndian) {
- Output.push_back((X >> 0) & 255);
- Output.push_back((X >> 8) & 255);
- Output.push_back((X >> 16) & 255);
- Output.push_back((X >> 24) & 255);
- Output.push_back((X >> 32) & 255);
- Output.push_back((X >> 40) & 255);
- Output.push_back((X >> 48) & 255);
- Output.push_back((X >> 56) & 255);
+ Output.push_back(unsigned(X >> 0) & 255);
+ Output.push_back(unsigned(X >> 8) & 255);
+ Output.push_back(unsigned(X >> 16) & 255);
+ Output.push_back(unsigned(X >> 24) & 255);
+ Output.push_back(unsigned(X >> 32) & 255);
+ Output.push_back(unsigned(X >> 40) & 255);
+ Output.push_back(unsigned(X >> 48) & 255);
+ Output.push_back(unsigned(X >> 56) & 255);
} else {
- Output.push_back((X >> 56) & 255);
- Output.push_back((X >> 48) & 255);
- Output.push_back((X >> 40) & 255);
- Output.push_back((X >> 32) & 255);
- Output.push_back((X >> 24) & 255);
- Output.push_back((X >> 16) & 255);
- Output.push_back((X >> 8) & 255);
- Output.push_back((X >> 0) & 255);
+ Output.push_back(unsigned(X >> 56) & 255);
+ Output.push_back(unsigned(X >> 48) & 255);
+ Output.push_back(unsigned(X >> 40) & 255);
+ Output.push_back(unsigned(X >> 32) & 255);
+ Output.push_back(unsigned(X >> 24) & 255);
+ Output.push_back(unsigned(X >> 16) & 255);
+ Output.push_back(unsigned(X >> 8) & 255);
+ Output.push_back(unsigned(X >> 0) & 255);
}
}
void outaddr32(DataBuffer &Output, unsigned X) {
}
private:
- void EmitGlobal(GlobalVariable *GV, ELFSection &DataSection,
- ELFSection &BSSSection);
+ void EmitGlobal(GlobalVariable *GV);
void EmitSymbolTable();