forked from OSchip/llvm-project
parent
685508cf49
commit
0bfd279b37
|
@ -376,7 +376,7 @@ namespace llvm {
|
||||||
|
|
||||||
/// printVisibility - This prints visibility information about symbol, if
|
/// printVisibility - This prints visibility information about symbol, if
|
||||||
/// this is suported by the target.
|
/// this is suported by the target.
|
||||||
void printVisibility(const MCSymbol *Sym, unsigned Visibility) const;
|
void printVisibility(MCSymbol *Sym, unsigned Visibility) const;
|
||||||
|
|
||||||
/// printOffset - This is just convenient handler for printing offsets.
|
/// printOffset - This is just convenient handler for printing offsets.
|
||||||
void printOffset(int64_t Offset) const;
|
void printOffset(int64_t Offset) const;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#ifndef LLVM_TARGET_ASM_INFO_H
|
#ifndef LLVM_TARGET_ASM_INFO_H
|
||||||
#define LLVM_TARGET_ASM_INFO_H
|
#define LLVM_TARGET_ASM_INFO_H
|
||||||
|
|
||||||
|
#include "llvm/MC/MCDirectives.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
@ -225,13 +226,13 @@ namespace llvm {
|
||||||
/// global as being a weak defined symbol. This is used on cygwin/mingw.
|
/// global as being a weak defined symbol. This is used on cygwin/mingw.
|
||||||
const char *LinkOnceDirective; // Defaults to NULL.
|
const char *LinkOnceDirective; // Defaults to NULL.
|
||||||
|
|
||||||
/// HiddenDirective - This directive, if non-null, is used to declare a
|
/// HiddenVisibilityAttr - This attribute, if not MCSA_Invalid, is used to
|
||||||
/// global or function as having hidden visibility.
|
/// declare a symbol as having hidden visibility.
|
||||||
const char *HiddenDirective; // Defaults to "\t.hidden\t".
|
MCSymbolAttr HiddenVisibilityAttr; // Defaults to MCSA_Hidden.
|
||||||
|
|
||||||
/// ProtectedDirective - This directive, if non-null, is used to declare a
|
/// ProtectedVisibilityAttr - This attribute, if not MCSA_Invalid, is used
|
||||||
/// global or function as having protected visibility.
|
/// to declare a symbol as having protected visibility.
|
||||||
const char *ProtectedDirective; // Defaults to "\t.protected\t".
|
MCSymbolAttr ProtectedVisibilityAttr; // Defaults to MCSA_Protected
|
||||||
|
|
||||||
//===--- Dwarf Emission Directives -----------------------------------===//
|
//===--- Dwarf Emission Directives -----------------------------------===//
|
||||||
|
|
||||||
|
@ -415,11 +416,10 @@ namespace llvm {
|
||||||
const char *getWeakRefDirective() const { return WeakRefDirective; }
|
const char *getWeakRefDirective() const { return WeakRefDirective; }
|
||||||
const char *getWeakDefDirective() const { return WeakDefDirective; }
|
const char *getWeakDefDirective() const { return WeakDefDirective; }
|
||||||
const char *getLinkOnceDirective() const { return LinkOnceDirective; }
|
const char *getLinkOnceDirective() const { return LinkOnceDirective; }
|
||||||
const char *getHiddenDirective() const {
|
|
||||||
return HiddenDirective;
|
MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr;}
|
||||||
}
|
MCSymbolAttr getProtectedVisibilityAttr() const {
|
||||||
const char *getProtectedDirective() const {
|
return ProtectedVisibilityAttr;
|
||||||
return ProtectedDirective;
|
|
||||||
}
|
}
|
||||||
bool isAbsoluteDebugSectionOffsets() const {
|
bool isAbsoluteDebugSectionOffsets() const {
|
||||||
return AbsoluteDebugSectionOffsets;
|
return AbsoluteDebugSectionOffsets;
|
||||||
|
|
|
@ -1588,15 +1588,21 @@ void AsmPrinter::printPICJumpTableSetLabel(unsigned uid, unsigned uid2,
|
||||||
<< '_' << uid << '_' << uid2 << '\n';
|
<< '_' << uid << '_' << uid2 << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsmPrinter::printVisibility(const MCSymbol *Sym,
|
void AsmPrinter::printVisibility(MCSymbol *Sym, unsigned Visibility) const {
|
||||||
unsigned Visibility) const {
|
MCSymbolAttr Attr = MCSA_Invalid;
|
||||||
if (Visibility == GlobalValue::HiddenVisibility) {
|
|
||||||
if (const char *Directive = MAI->getHiddenDirective())
|
switch (Visibility) {
|
||||||
O << Directive << *Sym << '\n';
|
default: break;
|
||||||
} else if (Visibility == GlobalValue::ProtectedVisibility) {
|
case GlobalValue::HiddenVisibility:
|
||||||
if (const char *Directive = MAI->getProtectedDirective())
|
Attr = MAI->getHiddenVisibilityAttr();
|
||||||
O << Directive << *Sym << '\n';
|
break;
|
||||||
|
case GlobalValue::ProtectedVisibility:
|
||||||
|
Attr = MAI->getProtectedVisibilityAttr();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Attr != MCSA_Invalid)
|
||||||
|
OutStreamer.EmitSymbolAttribute(Sym, Attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsmPrinter::printOffset(int64_t Offset) const {
|
void AsmPrinter::printOffset(int64_t Offset) const {
|
||||||
|
|
|
@ -230,8 +230,9 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
|
||||||
|
|
||||||
// If corresponding function is hidden, this should be too.
|
// If corresponding function is hidden, this should be too.
|
||||||
if (TheFunc->hasHiddenVisibility())
|
if (TheFunc->hasHiddenVisibility())
|
||||||
if (const char *HiddenDirective = MAI->getHiddenDirective())
|
if (MCSymbolAttr HiddenAttr = MAI->getHiddenVisibilityAttr())
|
||||||
O << HiddenDirective << *EHFrameInfo.FunctionEHSym << '\n';
|
Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,
|
||||||
|
HiddenAttr);
|
||||||
|
|
||||||
// If there are no calls then you can't unwind. This may mean we can omit the
|
// If there are no calls then you can't unwind. This may mean we can omit the
|
||||||
// EH Frame, but some environments do not handle weak absolute symbols. If
|
// EH Frame, but some environments do not handle weak absolute symbols. If
|
||||||
|
|
|
@ -61,9 +61,8 @@ MCAsmInfo::MCAsmInfo() {
|
||||||
WeakRefDirective = 0;
|
WeakRefDirective = 0;
|
||||||
WeakDefDirective = 0;
|
WeakDefDirective = 0;
|
||||||
LinkOnceDirective = 0;
|
LinkOnceDirective = 0;
|
||||||
// FIXME: These are ELFish - move to ELFMAI.
|
HiddenVisibilityAttr = MCSA_Hidden;
|
||||||
HiddenDirective = "\t.hidden\t";
|
ProtectedVisibilityAttr = MCSA_Protected;
|
||||||
ProtectedDirective = "\t.protected\t";
|
|
||||||
AbsoluteDebugSectionOffsets = false;
|
AbsoluteDebugSectionOffsets = false;
|
||||||
AbsoluteEHSectionOffsets = false;
|
AbsoluteEHSectionOffsets = false;
|
||||||
HasLEB128 = false;
|
HasLEB128 = false;
|
||||||
|
|
|
@ -22,12 +22,14 @@ MCAsmInfoCOFF::MCAsmInfoCOFF() {
|
||||||
COMMDirectiveTakesAlignment = false;
|
COMMDirectiveTakesAlignment = false;
|
||||||
HasDotTypeDotSizeDirective = false;
|
HasDotTypeDotSizeDirective = false;
|
||||||
HasSingleParameterDotFile = false;
|
HasSingleParameterDotFile = false;
|
||||||
HiddenDirective = NULL;
|
|
||||||
PrivateGlobalPrefix = "L"; // Prefix for private global symbols
|
PrivateGlobalPrefix = "L"; // Prefix for private global symbols
|
||||||
WeakRefDirective = "\t.weak\t";
|
WeakRefDirective = "\t.weak\t";
|
||||||
LinkOnceDirective = "\t.linkonce same_size\n";
|
LinkOnceDirective = "\t.linkonce same_size\n";
|
||||||
SetDirective = "\t.set\t";
|
SetDirective = "\t.set\t";
|
||||||
|
|
||||||
|
// Doesn't support visibility:
|
||||||
|
HiddenVisibilityAttr = ProtectedVisibilityAttr = MCSA_Invalid;
|
||||||
|
|
||||||
// Set up DWARF directives
|
// Set up DWARF directives
|
||||||
HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
|
HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
|
||||||
AbsoluteDebugSectionOffsets = true;
|
AbsoluteDebugSectionOffsets = true;
|
||||||
|
|
|
@ -32,12 +32,16 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() {
|
||||||
// Directives:
|
// Directives:
|
||||||
WeakDefDirective = "\t.weak_definition ";
|
WeakDefDirective = "\t.weak_definition ";
|
||||||
WeakRefDirective = "\t.weak_reference ";
|
WeakRefDirective = "\t.weak_reference ";
|
||||||
HiddenDirective = "\t.private_extern ";
|
|
||||||
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
|
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
|
||||||
HasMachoZeroFillDirective = true; // Uses .zerofill
|
HasMachoZeroFillDirective = true; // Uses .zerofill
|
||||||
HasStaticCtorDtorReferenceInStaticMode = true;
|
HasStaticCtorDtorReferenceInStaticMode = true;
|
||||||
SetDirective = "\t.set";
|
SetDirective = "\t.set";
|
||||||
ProtectedDirective = "\t.globl\t";
|
|
||||||
|
HiddenVisibilityAttr = MCSA_PrivateExtern;
|
||||||
|
// Doesn't support protected visibility.
|
||||||
|
ProtectedVisibilityAttr = MCSA_Global;
|
||||||
|
|
||||||
|
|
||||||
HasDotTypeDotSizeDirective = false;
|
HasDotTypeDotSizeDirective = false;
|
||||||
HasNoDeadStrip = true;
|
HasNoDeadStrip = true;
|
||||||
// Note: Even though darwin has the .lcomm directive, it is just a synonym for
|
// Note: Even though darwin has the .lcomm directive, it is just a synonym for
|
||||||
|
|
Loading…
Reference in New Issue