aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-05-17 20:12:31 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-05-17 20:12:31 +0000
commitb18d2dd115d8ff3fd75bbaa90849473266236dc3 (patch)
tree39bf1c3197f91f77ac4bf8b0dc928c1ee98dbf31 /lib/MC
parentb843d9f833aa474ae700363a445b7409665c4a6e (diff)
downloadexternal_llvm-b18d2dd115d8ff3fd75bbaa90849473266236dc3.zip
external_llvm-b18d2dd115d8ff3fd75bbaa90849473266236dc3.tar.gz
external_llvm-b18d2dd115d8ff3fd75bbaa90849473266236dc3.tar.bz2
MC/Mach-O: Fix some differences in symbol flag handling.
- Don't clear weak reference flag, 'as' was only "trying" to do this, it wasn't actually succeeding. - Clear the "lazy bound" bit when we mark something external. This corresponds roughly to the lazy clearing of the bit that 'as' implements in symbol_table_lookup. - The exact meaning of these flags appears pretty loose, since 'as' isn't very consistent. For now we just try to match 'as', we will clean this up one day hopefully. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103964 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCMachOStreamer.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp
index b27f151..b00e2bf 100644
--- a/lib/MC/MCMachOStreamer.cpp
+++ b/lib/MC/MCMachOStreamer.cpp
@@ -192,8 +192,14 @@ void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) {
SD.setFragment(F);
SD.setOffset(F->getContents().size());
- // This causes the reference type and weak reference flags to be cleared.
- SD.setFlags(SD.getFlags() & ~(SF_WeakReference | SF_ReferenceTypeMask));
+ // This causes the reference type flag to be cleared. Darwin 'as' was "trying"
+ // to clear the weak reference and weak definition bits too, but the
+ // implementation was buggy. For now we just try to match 'as', for
+ // diffability.
+ //
+ // FIXME: Cleanup this code, these bits should be emitted based on semantic
+ // properties, not on the order of definition, etc.
+ SD.setFlags(SD.getFlags() & ~SF_ReferenceTypeMask);
Symbol->setSection(*CurSection);
}
@@ -257,6 +263,13 @@ void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
case MCSA_Global:
SD.setExternal(true);
+ // This effectively clears the undefined lazy bit, in Darwin 'as', although
+ // it isn't very consistent because it implements this as part of symbol
+ // lookup.
+ //
+ // FIXME: Cleanup this code, these bits should be emitted based on semantic
+ // properties, not on the order of definition, etc.
+ SD.setFlags(SD.getFlags() & ~SF_ReferenceTypeUndefinedLazy);
break;
case MCSA_LazyReference: