Commit 16004dc2 authored by Tom Stellard's avatar Tom Stellard
Browse files

Merging r196970:

------------------------------------------------------------------------
r196970 | fang | 2013-12-10 16:37:41 -0500 (Tue, 10 Dec 2013) | 3 lines

on darwin<10, fallback to .weak_definition (PPC,X86)
.weak_def_can_be_hidden was not yet supported by the system assembler

------------------------------------------------------------------------

llvm-svn: 206050
parent aa29e1bd
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -270,6 +270,10 @@ namespace llvm {
    /// defined symbol.
    bool HasWeakDefDirective;                // Defaults to false.

    /// True if we have a directive to declare a global as being a weak
    /// defined symbol that can be hidden (unexported).
    bool HasWeakDefCanBeHiddenDirective;     // Defaults to false.

    /// True if we have a .linkonce directive.  This is used on cygwin/mingw.
    bool HasLinkOnceDirective;               // Defaults to false.

@@ -501,6 +505,9 @@ namespace llvm {
    bool hasNoDeadStrip() const { return HasNoDeadStrip; }
    const char *getWeakRefDirective() const { return WeakRefDirective; }
    bool hasWeakDefDirective() const { return HasWeakDefDirective; }
    bool hasWeakDefCanBeHiddenDirective() const {
      return HasWeakDefCanBeHiddenDirective;
    }
    bool hasLinkOnceDirective() const { return HasLinkOnceDirective; }

    MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr;}
+2 −1
Original line number Diff line number Diff line
@@ -228,7 +228,8 @@ void AsmPrinter::EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const {

      bool CanBeHidden = false;

      if (Linkage == GlobalValue::LinkOnceODRLinkage) {
      if (Linkage == GlobalValue::LinkOnceODRLinkage &&
          MAI->hasWeakDefCanBeHiddenDirective()) {
        if (GV->hasUnnamedAddr()) {
          CanBeHidden = true;
        } else {
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ MCAsmInfo::MCAsmInfo() {
  HasNoDeadStrip = false;
  WeakRefDirective = 0;
  HasWeakDefDirective = false;
  HasWeakDefCanBeHiddenDirective = false;
  HasLinkOnceDirective = false;
  HiddenVisibilityAttr = MCSA_Hidden;
  HiddenDeclarationVisibilityAttr = MCSA_Hidden;
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() {

  // Directives:
  HasWeakDefDirective = true;
  HasWeakDefCanBeHiddenDirective = true;
  WeakRefDirective = "\t.weak_reference ";
  ZeroDirective = "\t.space\t";  // ".space N" emits N zeros.
  HasMachoZeroFillDirective = true;  // Uses .zerofill
+26 −0
Original line number Diff line number Diff line
@@ -12,10 +12,14 @@
//===----------------------------------------------------------------------===//

#include "PPCMCAsmInfo.h"
#include "llvm/ADT/Triple.h"

using namespace llvm;

void PPCMCAsmInfoDarwin::anchor() { }

/// This version of the constructor is here to maintain ABI compatibility with
/// LLVM 3.4.0
PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) {
  if (is64Bit) {
    PointerSize = CalleeSaveStackSlotSize = 8;
@@ -32,6 +36,28 @@ PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) {
  SupportsDebugInformation= true; // Debug information.
}

PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit, const Triple& T) {
  if (is64Bit) {
    PointerSize = CalleeSaveStackSlotSize = 8;
  }
  IsLittleEndian = false;

  CommentString = ";";
  ExceptionsType = ExceptionHandling::DwarfCFI;

  if (!is64Bit)
    Data64bitsDirective = 0;      // We can't emit a 64-bit unit in PPC32 mode.

  AssemblerDialect = 1;           // New-Style mnemonics.
  SupportsDebugInformation= true; // Debug information.

  // old assembler lacks some directives
  // FIXME: this should really be a check on the assembler characteristics
  // rather than OS version
  if (T.isMacOSX() && T.isMacOSXVersionLT(10, 6))
    HasWeakDefCanBeHiddenDirective = false;
}

void PPCLinuxMCAsmInfo::anchor() { }

PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) {
Loading