File tree 5 files changed +29
-2
lines changed
5 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,10 @@ class MCAsmInfo {
341
341
// / argument and how it is interpreted. Defaults to NoAlignment.
342
342
LCOMM::LCOMMType LCOMMDirectiveAlignmentType = LCOMM::NoAlignment;
343
343
344
+ // / True if the target only has basename for .file directive. False if the
345
+ // / target also needs the directory along with the basename. Default to true.
346
+ bool HasBasenameOnlyForFileDirective = true ;
347
+
344
348
// True if the target allows .align directives on functions. This is true for
345
349
// most targets, so defaults to true.
346
350
bool HasFunctionAlignment = true ;
@@ -666,6 +670,9 @@ class MCAsmInfo {
666
670
return LCOMMDirectiveAlignmentType;
667
671
}
668
672
673
+ bool hasBasenameOnlyForFileDirective () const {
674
+ return HasBasenameOnlyForFileDirective;
675
+ }
669
676
bool hasFunctionAlignment () const { return HasFunctionAlignment; }
670
677
bool hasDotTypeDotSizeDirective () const { return HasDotTypeDotSizeDirective; }
671
678
bool hasSingleParameterDotFile () const { return HasSingleParameterDotFile; }
Original file line number Diff line number Diff line change @@ -297,8 +297,11 @@ bool AsmPrinter::doInitialization(Module &M) {
297
297
// don't, this at least helps the user find where a global came from.
298
298
if (MAI->hasSingleParameterDotFile ()) {
299
299
// .file "foo.c"
300
- OutStreamer->emitFileDirective (
301
- llvm::sys::path::filename (M.getSourceFileName ()));
300
+ if (MAI->hasBasenameOnlyForFileDirective ())
301
+ OutStreamer->emitFileDirective (
302
+ llvm::sys::path::filename (M.getSourceFileName ()));
303
+ else
304
+ OutStreamer->emitFileDirective (M.getSourceFileName ());
302
305
}
303
306
304
307
GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ void MCAsmInfoXCOFF::anchor() {}
19
19
MCAsmInfoXCOFF::MCAsmInfoXCOFF () {
20
20
IsLittleEndian = false ;
21
21
HasVisibilityOnlyWithLinkage = true ;
22
+ HasBasenameOnlyForFileDirective = false ;
22
23
PrivateGlobalPrefix = " L.." ;
23
24
PrivateLabelPrefix = " L.." ;
24
25
SupportsQuotedNames = false ;
Original file line number Diff line number Diff line change
1
+ ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff < %s \
2
+ ; RUN: | FileCheck %s
3
+ ; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff < %s \
4
+ ; RUN: | FileCheck %s
5
+
6
+ ; CHECK: .file "/absolute/path/to/file"
7
+
8
+ source_filename = "/absolute/path/to/file"
Original file line number Diff line number Diff line change
1
+ ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff < %s \
2
+ ; RUN: | FileCheck %s
3
+ ; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff < %s \
4
+ ; RUN: | FileCheck %s
5
+
6
+ ; CHECK: .file "../relative/path/to/file"
7
+
8
+ source_filename = "../relative/path/to/file"
You can’t perform that action at this time.
0 commit comments