summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-22 10:13:24 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-22 10:13:24 +0000
commitf3d2ef0c9712381a105118336975adcfbf733db0 (patch)
treecd8c6582f4f2475cd461578b360fae595e1fdca6 /include
parentd889ac3b56211b43af9dc94d831969952b22f3f8 (diff)
downloadllvm-f3d2ef0c9712381a105118336975adcfbf733db0.tar.gz
llvm-f3d2ef0c9712381a105118336975adcfbf733db0.tar.bz2
llvm-f3d2ef0c9712381a105118336975adcfbf733db0.tar.xz
llvm-mc/Mach-O: Sketch symbol table support.
- The only .s syntax this honors right now is emitting labels, and some parts of the symbol table generation are wrong or faked. - This is enough to get nm to report such symbols... incorrectly, but still. Also, fixed byte emission to extend the previous fragment if possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/MC/MCAssembler.h58
1 files changed, 56 insertions, 2 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h
index 86ad502c7e..d4a8efe01d 100644
--- a/include/llvm/MC/MCAssembler.h
+++ b/include/llvm/MC/MCAssembler.h
@@ -64,7 +64,7 @@ public:
// FIXME: This should be abstract, fix sentinel.
virtual uint64_t getMaxFileSize() const {
- assert(0 && "Invalid getMaxFileSize call !");
+ assert(0 && "Invalid getMaxFileSize call!");
return 0;
};
@@ -270,7 +270,6 @@ public:
unsigned getAlignment() const { return Alignment; }
void setAlignment(unsigned Value) { Alignment = Value; }
-
/// @name Section List Access
/// @{
@@ -285,6 +284,8 @@ public:
size_t size() const { return Fragments.size(); }
+ bool empty() const { return Fragments.empty(); }
+
/// @}
/// @name Assembler Backend Support
/// @{
@@ -300,13 +301,49 @@ public:
/// @}
};
+// FIXME: Same concerns as with SectionData.
+class MCSymbolData : public ilist_node<MCSymbolData> {
+public:
+ MCSymbol &Symbol;
+
+ /// Fragment - The fragment this symbol's value is relative to, if any.
+ MCFragment *Fragment;
+
+ /// Offset - The offset to apply to the fragment address to form this symbol's
+ /// value.
+ uint64_t Offset;
+
+public:
+ // Only for use as sentinel.
+ MCSymbolData();
+ MCSymbolData(MCSymbol &_Symbol, MCFragment *_Fragment, uint64_t _Offset,
+ MCAssembler *A = 0);
+
+ /// @name Accessors
+ /// @{
+
+ MCSymbol &getSymbol() const { return Symbol; }
+
+ MCFragment *getFragment() const { return Fragment; }
+ void setFragment(MCFragment *Value) { Fragment = Value; }
+
+ uint64_t getOffset() const { return Offset; }
+ void setOffset(uint64_t Value) { Offset = Value; }
+
+ /// @}
+};
+
class MCAssembler {
public:
typedef iplist<MCSectionData> SectionDataListType;
+ typedef iplist<MCSymbolData> SymbolDataListType;
typedef SectionDataListType::const_iterator const_iterator;
typedef SectionDataListType::iterator iterator;
+ typedef SymbolDataListType::const_iterator const_symbol_iterator;
+ typedef SymbolDataListType::iterator symbol_iterator;
+
private:
MCAssembler(const MCAssembler&); // DO NOT IMPLEMENT
void operator=(const MCAssembler&); // DO NOT IMPLEMENT
@@ -315,6 +352,8 @@ private:
iplist<MCSectionData> Sections;
+ iplist<MCSymbolData> Symbols;
+
private:
/// LayoutSection - Assign offsets and sizes to the fragments in the section
/// \arg SD, and update the section size. The section file offset should
@@ -351,6 +390,21 @@ public:
size_t size() const { return Sections.size(); }
/// @}
+ /// @name Symbol List Access
+ /// @{
+
+ const SymbolDataListType &getSymbolList() const { return Symbols; }
+ SymbolDataListType &getSymbolList() { return Symbols; }
+
+ symbol_iterator symbol_begin() { return Symbols.begin(); }
+ const_symbol_iterator symbol_begin() const { return Symbols.begin(); }
+
+ symbol_iterator symbol_end() { return Symbols.end(); }
+ const_symbol_iterator symbol_end() const { return Symbols.end(); }
+
+ size_t symbol_size() const { return Symbols.size(); }
+
+ /// @}
};
} // end namespace llvm