Skip to content

replace the extension with the right functions #141110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions clang/lib/Driver/ToolChains/ZOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,10 @@ void zos::Linker::ConstructJob(Compilation &C, const JobAction &JA,
StringRef OutputName = Output.getFilename();
// Strip away the last file suffix in presence from output name and add
// a new .x suffix.
size_t Suffix = OutputName.find_last_of('.');
const char *SideDeckName =
Args.MakeArgString(OutputName.substr(0, Suffix) + ".x");
SmallString<128> SideDeckName = OutputName;
llvm::sys::path::replace_extension(SideDeckName, "x");
CmdArgs.push_back("-x");
CmdArgs.push_back(SideDeckName);
CmdArgs.push_back(Args.MakeArgString(SideDeckName));
} else {
// We need to direct side file to /dev/null to suppress linker warning when
// the object file contains exported symbols, and -shared or
Expand Down
19 changes: 19 additions & 0 deletions clang/test/Driver/zos-ld-sidedeck.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Try using various forms of output file name to see what side deck file name looks like
// RUN: %clang -### --shared --target=s390x-ibm-zos %s -o foo.out 2>&1 \
// RUN: | FileCheck --check-prefix=SD-BASE %s
// RUN: %clang -### --shared --target=s390x-ibm-zos %s -o foo 2>&1 \
// RUN: | FileCheck --check-prefix=SD-BASE %s
// SD-BASE: "-x" "foo.x"

// RUN: %clang -### --shared --target=s390x-ibm-zos %s -o lib/foo.out 2>&1 \
// RUN: | FileCheck --check-prefix=SD-SUBDIR %s
// RUN: %clang -### --shared --target=s390x-ibm-zos %s -o lib/foo 2>&1 \
// RUN: | FileCheck --check-prefix=SD-SUBDIR %s
// SD-SUBDIR: "-x" "lib/foo.x"


// RUN: %clang -### --shared --target=s390x-ibm-zos %s -o ../lib/foo.out 2>&1 \
// RUN: | FileCheck --check-prefix=SD-REL %s
// RUN: %clang -### --shared --target=s390x-ibm-zos %s -o ../lib/foo 2>&1 \
// RUN: | FileCheck --check-prefix=SD-REL %s
// SD-REL: "-x" "../lib/foo.x"