2019-07-09 21:21:01 +02:00
|
|
|
//===- MC/MCAsmInfoXCOFF.cpp - XCOFF asm properties ------------ *- C++ -*-===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/MC/MCAsmInfoXCOFF.h"
|
2020-07-06 16:18:06 +02:00
|
|
|
#include "llvm/ADT/StringExtras.h"
|
2020-12-02 19:46:58 +01:00
|
|
|
#include "llvm/Support/CommandLine.h"
|
2019-07-09 21:21:01 +02:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2020-12-02 19:46:58 +01:00
|
|
|
extern cl::opt<cl::boolOrDefault> UseLEB128Directives;
|
|
|
|
|
2019-07-09 21:21:01 +02:00
|
|
|
void MCAsmInfoXCOFF::anchor() {}
|
|
|
|
|
|
|
|
MCAsmInfoXCOFF::MCAsmInfoXCOFF() {
|
|
|
|
IsLittleEndian = false;
|
[AIX] supporting the visibility attribute for aix assembly
SUMMARY:
in the aix assembly , it do not have .hidden and .protected directive.
in current llvm. if a function or a variable which has visibility attribute, it will generate something like the .hidden or .protected , it can not recognize by aix as.
in aix assembly, the visibility attribute are support in the pseudo-op like
.extern Name [ , Visibility ]
.globl Name [, Visibility ]
.weak Name [, Visibility ]
in this patch, we implement the visibility attribute for the global variable, function or extern function .
for example.
extern __attribute__ ((visibility ("hidden"))) int
bar(int* ip);
__attribute__ ((visibility ("hidden"))) int b = 0;
__attribute__ ((visibility ("hidden"))) int
foo(int* ip){
return (*ip)++;
}
the visibility of .comm linkage do not support , we will have a separate patch for it.
we have the unsupported cases ("default" and "internal") , we will implement them in a a separate patch for it.
Reviewers: Jason Liu ,hubert.reinterpretcast,James Henderson
Differential Revision: https://reviews.llvm.org/D75866
2020-06-09 22:15:06 +02:00
|
|
|
HasVisibilityOnlyWithLinkage = true;
|
2020-06-03 18:23:12 +02:00
|
|
|
PrivateGlobalPrefix = "L..";
|
|
|
|
PrivateLabelPrefix = "L..";
|
2020-05-01 02:44:04 +02:00
|
|
|
SupportsQuotedNames = false;
|
[PowerPC][AIX] Adds support for writing the .data section in assembly files
Summary:
Adds support for generating the .data section in assembly files for global variables with a non-zero initialization. The support for writing the .data section in XCOFF object files will be added in a follow-on patch. Any relocations are not included in this patch.
Reviewers: hubert.reinterpretcast, sfertile, jasonliu, daltenty, Xiangling_L
Reviewed by: hubert.reinterpretcast
Subscribers: nemanjai, hiraditya, kbarton, MaskRay, jsji, wuzish, shchenz, DiggerLin, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66154
llvm-svn: 369869
2019-08-25 17:17:25 +02:00
|
|
|
UseDotAlignForAlignment = true;
|
2021-03-05 02:47:41 +01:00
|
|
|
UsesDwarfFileAndLocDirectives = false;
|
|
|
|
DwarfSectionSizeRequired = false;
|
2020-12-02 19:46:58 +01:00
|
|
|
if (UseLEB128Directives == cl::BOU_UNSET)
|
|
|
|
HasLEB128Directives = false;
|
2020-05-01 02:44:04 +02:00
|
|
|
ZeroDirective = "\t.space\t";
|
|
|
|
ZeroDirectiveSupportsNonZeroValue = false;
|
[PowerPC][AIX] Adds support for writing the .data section in assembly files
Summary:
Adds support for generating the .data section in assembly files for global variables with a non-zero initialization. The support for writing the .data section in XCOFF object files will be added in a follow-on patch. Any relocations are not included in this patch.
Reviewers: hubert.reinterpretcast, sfertile, jasonliu, daltenty, Xiangling_L
Reviewed by: hubert.reinterpretcast
Subscribers: nemanjai, hiraditya, kbarton, MaskRay, jsji, wuzish, shchenz, DiggerLin, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66154
llvm-svn: 369869
2019-08-25 17:17:25 +02:00
|
|
|
AsciiDirective = nullptr; // not supported
|
|
|
|
AscizDirective = nullptr; // not supported
|
2020-09-30 03:11:16 +02:00
|
|
|
ByteListDirective = "\t.byte\t";
|
|
|
|
CharacterLiteralSyntax = ACLS_SingleQuotePrefix;
|
[AIX] Update data directives for AIX assembly
Summary:
The standard data emission directives (e.g. .short, .long) in the AIX assembler
have the unintended consequence of aligning their output to the natural byte
boundary. This cause problems because we aren't expecting behavior from the
Data*bitsDirectives, so the final alignment of data isn't correct in some cases
on AIX.
This patch updated the Data*bitsDirectives to use .vbyte pseudo-ops instead to emit the
data, since we will emit the .align directives as needed. We update the existing
testcases and add a test for emission of struct data.
Reviewers: hubert.reinterpretcast, Xiangling_L, jasonliu
Reviewed By: hubert.reinterpretcast, jasonliu
Subscribers: wuzish, nemanjai, hiraditya, kbarton, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80934
2020-06-03 16:54:56 +02:00
|
|
|
|
|
|
|
// Use .vbyte for data definition to avoid directives that apply an implicit
|
|
|
|
// alignment.
|
|
|
|
Data16bitsDirective = "\t.vbyte\t2, ";
|
|
|
|
Data32bitsDirective = "\t.vbyte\t4, ";
|
|
|
|
|
2020-05-01 02:44:04 +02:00
|
|
|
COMMDirectiveAlignmentIsInBytes = false;
|
|
|
|
LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
|
|
|
|
HasDotTypeDotSizeDirective = false;
|
|
|
|
UseIntegratedAssembler = false;
|
|
|
|
NeedsFunctionDescriptors = true;
|
2020-12-02 15:48:52 +01:00
|
|
|
|
|
|
|
ExceptionsType = ExceptionHandling::AIX;
|
2019-09-26 21:38:32 +02:00
|
|
|
}
|
|
|
|
|
[XCOFF][AIX] Differentiate usage of label symbol and csect symbol
Summary:
We are using symbols to represent label and csect interchangeably before, and that could be a problem.
There are cases we would need to add storage mapping class to the symbol if that symbol is actually the name of a csect, but it's hard for us to figure out whether that symbol is a label or csect.
This patch intend to do the following:
1. Construct a QualName (A name include the storage mapping class)
MCSymbolXCOFF for every MCSectionXCOFF.
2. Keep a pointer to that QualName inside of MCSectionXCOFF.
3. Use that QualName whenever we need a symbol refers to that
MCSectionXCOFF.
4. Adapt the snowball effect from the above changes in
XCOFFObjectWriter.cpp.
Reviewers: xingxue, DiggerLin, sfertile, daltenty, hubert.reinterpretcast
Reviewed By: DiggerLin, daltenty
Subscribers: wuzish, nemanjai, mgorny, hiraditya, kbarton, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69633
2019-11-08 15:26:28 +01:00
|
|
|
bool MCAsmInfoXCOFF::isAcceptableChar(char C) const {
|
|
|
|
// QualName is allowed for a MCSymbolXCOFF, and
|
|
|
|
// QualName contains '[' and ']'.
|
|
|
|
if (C == '[' || C == ']')
|
2019-09-26 21:38:32 +02:00
|
|
|
return true;
|
|
|
|
|
2020-07-06 16:18:06 +02:00
|
|
|
// For AIX assembler, symbols may consist of numeric digits,
|
|
|
|
// underscores, periods, uppercase or lowercase letters, or
|
|
|
|
// any combination of these.
|
|
|
|
return isAlnum(C) || C == '_' || C == '.';
|
2019-07-09 21:21:01 +02:00
|
|
|
}
|