From 3edd9bb7a3da8526eb2f4a5dae2962a987d3d566 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sat, 22 Aug 2009 11:41:10 +0000 Subject: llvm-mc/Mach-O: Improve symbol table support: - Honor .globl. - Set symbol type and section correctly ('nm' now works), and order symbols appropriately. - Take care to the string table so that the .o matches 'as' exactly (for ease of testing). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79740 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCAssembler.h | 11 +++++++++++ include/llvm/MC/MCSymbol.h | 7 +++---- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index d4a8efe..bcd678d 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -312,6 +312,10 @@ public: /// Offset - The offset to apply to the fragment address to form this symbol's /// value. uint64_t Offset; + + /// IsExternal - True if this symbol is visible outside this translation + /// unit. + unsigned IsExternal : 1; public: // Only for use as sentinel. @@ -330,6 +334,13 @@ public: uint64_t getOffset() const { return Offset; } void setOffset(uint64_t Value) { Offset = Value; } + /// @} + /// @name Symbol Attributes + /// @{ + + bool isExternal() const { return IsExternal; } + void setExternal(bool Value) { IsExternal = Value; } + /// @} }; diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h index 2b570a7..122e897 100644 --- a/include/llvm/MC/MCSymbol.h +++ b/include/llvm/MC/MCSymbol.h @@ -43,7 +43,7 @@ namespace llvm { /// undefined symbols, and the special AbsolutePseudoSection value for /// absolute symbols. const MCSection *Section; - + /// IsTemporary - True if this is an assembler temporary label, which /// typically does not survive in the .o file's symbol table. Usually /// "Lfoo" or ".foo". @@ -52,8 +52,7 @@ namespace llvm { private: // MCContext creates and uniques these. friend class MCContext; MCSymbol(const StringRef &_Name, bool _IsTemporary) - : Name(_Name), Section(0), - IsTemporary(_IsTemporary) {} + : Name(_Name), Section(0), IsTemporary(_IsTemporary) {} MCSymbol(const MCSymbol&); // DO NOT IMPLEMENT void operator=(const MCSymbol&); // DO NOT IMPLEMENT @@ -61,7 +60,7 @@ namespace llvm { /// getName - Get the symbol name. const std::string &getName() const { return Name; } - /// @name Symbol Location Functions + /// @name Symbol Type /// @{ /// isUndefined - Check if this symbol undefined (i.e., implicitly defined). -- cgit v1.1