Skip to content

Commit

Permalink
Append default file extension for LDMD only
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke committed Mar 3, 2017
1 parent 5f7ef2d commit 8c7c732
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions driver/linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ static std::string getOutputName(bool const sharedLib) {
}

if (global.params.exefile) {
return extension ? FileName::defaultExt(global.params.exefile, extension)
: global.params.exefile;
// DMD adds the default extension if there is none
return opts::ldmd && extension
? FileName::defaultExt(global.params.exefile, extension)
: global.params.exefile;
}

// Infer output name from first object file.
Expand Down Expand Up @@ -837,7 +839,10 @@ int createStaticLibrary() {
// output filename
std::string libName;
if (global.params.libname) { // explicit
libName = FileName::defaultExt(global.params.libname, global.lib_ext);
// DMD adds the default extension if there is none
libName = opts::ldmd
? FileName::defaultExt(global.params.libname, global.lib_ext)
: global.params.libname;
} else { // infer from first object file
libName = global.params.objfiles->dim
? FileName::removeExt((*global.params.objfiles)[0])
Expand Down

0 comments on commit 8c7c732

Please sign in to comment.