[flang-commits] [flang] 5e36c64 - [flang] Remove extra space added with --dependent-lib option

David Truby via flang-commits flang-commits at lists.llvm.org
Mon Nov 20 08:51:16 PST 2023


Author: David Truby
Date: 2023-11-20T16:51:02Z
New Revision: 5e36c64cb6e8f9c6c0c2db8a9a7120b28fbc36df

URL: https://github.com/llvm/llvm-project/commit/5e36c64cb6e8f9c6c0c2db8a9a7120b28fbc36df
DIFF: https://github.com/llvm/llvm-project/commit/5e36c64cb6e8f9c6c0c2db8a9a7120b28fbc36df.diff

LOG: [flang] Remove extra space added with --dependent-lib option

This patch fixes a bug with the --dependent-lib option where an
extra space is added to the directive causing linking to fail.

Added: 
    

Modified: 
    flang/lib/Frontend/FrontendActions.cpp
    flang/test/Driver/dependent-lib.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index 1e4a2f3035f1f7f..f573ac82c91cd8e 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -260,7 +260,7 @@ static void addDepdendentLibs(mlir::ModuleOp &mlirModule,
   auto builder = mlir::OpBuilder(mlirModule.getRegion());
   for (const std::string &lib : libs) {
     builder.create<mlir::LLVM::LinkerOptionsOp>(
-        mlirModule.getLoc(), builder.getStrArrayAttr({"/DEFAULTLIB:", lib}));
+        mlirModule.getLoc(), builder.getStrArrayAttr({"/DEFAULTLIB:" + lib}));
   }
 }
 

diff  --git a/flang/test/Driver/dependent-lib.f90 b/flang/test/Driver/dependent-lib.f90
index 1b9be9688c46e37..912e35158eed734 100644
--- a/flang/test/Driver/dependent-lib.f90
+++ b/flang/test/Driver/dependent-lib.f90
@@ -10,7 +10,7 @@
 ! REDEFINE: %{triple} = aarch64-apple-darwin
 ! RUN: not %{compile} | FileCheck %s --check-prefixes=CHECK-NOWIN
 
-! CHECK: llvm.linker_options ["/DEFAULTLIB:", "libtest"]
+! CHECK: llvm.linker_options ["/DEFAULTLIB:libtest"]
 program test
 end program test
 ! CHECK-NOWIN: --dependent-lib is only supported on Windows


        


More information about the flang-commits mailing list