Skip to content

Commit 6ee5473

Browse files
DanielCChenGeorgeARM
authored andcommitted
[driver] return immediately in addArchSpecificRPath and getArchSpecificLibPaths on AIX (llvm#134520)
`addArchSpecificRPath` should immediately return for AIX as AIX doesn't support `rpath` option. `getArchSpecificLibPaths` should return as well as we don't want `-L/ArchSepcificLibPaths` sent to the linker on AIX.
1 parent 2d53b32 commit 6ee5473

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

clang/lib/Driver/ToolChains/AIX.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ class LLVM_LIBRARY_VISIBILITY AIX : public ToolChain {
9898
return llvm::DebuggerKind::DBX;
9999
}
100100

101+
path_list getArchSpecificLibPaths() const override { return path_list(); };
102+
101103
protected:
102104
Tool *buildAssembler() const override;
103105
Tool *buildLinker() const override;

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,9 @@ void tools::addArchSpecificRPath(const ToolChain &TC, const ArgList &Args,
12521252
options::OPT_fno_rtlib_add_rpath, false))
12531253
return;
12541254

1255+
if (TC.getTriple().isOSAIX()) // TODO: AIX doesn't support -rpath option.
1256+
return;
1257+
12551258
SmallVector<std::string> CandidateRPaths(TC.getArchSpecificLibPaths());
12561259
if (const auto CandidateRPath = TC.getStdlibPath())
12571260
CandidateRPaths.emplace_back(*CandidateRPath);

flang/test/Driver/flang-ld-powerpc.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
! AIX64-LD-PER-TARGET-DEFAULT-SAME: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}powerpc64-ibm-aix{{/|\\\\}}libflang_rt.runtime.a"
2424
! AIX64-LD-PER-TARGET-DEFAULT-SAME: "-lm"
2525
! AIX64-LD-PER-TARGET-DEFAULT-SAME: "-lpthread"
26+
! AIX64-LD-PER-TARGET-DEFAULT-NOT: "-L/[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}powerpc64-ibm-aix"
2627

2728

2829
! Check powerpc64-ibm-aix 64-bit linking to static flang-rt by option

0 commit comments

Comments
 (0)