File tree Expand file tree Collapse file tree 5 files changed +29
-2
lines changed Expand file tree Collapse file tree 5 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,10 @@ class MCAsmInfo {
341341 // / argument and how it is interpreted. Defaults to NoAlignment.
342342 LCOMM::LCOMMType LCOMMDirectiveAlignmentType = LCOMM::NoAlignment;
343343
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+
344348 // True if the target allows .align directives on functions. This is true for
345349 // most targets, so defaults to true.
346350 bool HasFunctionAlignment = true ;
@@ -666,6 +670,9 @@ class MCAsmInfo {
666670 return LCOMMDirectiveAlignmentType;
667671 }
668672
673+ bool hasBasenameOnlyForFileDirective () const {
674+ return HasBasenameOnlyForFileDirective;
675+ }
669676 bool hasFunctionAlignment () const { return HasFunctionAlignment; }
670677 bool hasDotTypeDotSizeDirective () const { return HasDotTypeDotSizeDirective; }
671678 bool hasSingleParameterDotFile () const { return HasSingleParameterDotFile; }
Original file line number Diff line number Diff line change @@ -297,8 +297,11 @@ bool AsmPrinter::doInitialization(Module &M) {
297297 // don't, this at least helps the user find where a global came from.
298298 if (MAI->hasSingleParameterDotFile ()) {
299299 // .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 ());
302305 }
303306
304307 GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ void MCAsmInfoXCOFF::anchor() {}
1919MCAsmInfoXCOFF::MCAsmInfoXCOFF () {
2020 IsLittleEndian = false ;
2121 HasVisibilityOnlyWithLinkage = true ;
22+ HasBasenameOnlyForFileDirective = false ;
2223 PrivateGlobalPrefix = " L.." ;
2324 PrivateLabelPrefix = " L.." ;
2425 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