[llvm] d822c09 - [JITLink] Use `rsplit` on `-sectcreate` argument in llvm-jitlink (#115511)

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 10 00:19:06 PST 2024


Author: Douglas
Date: 2024-11-10T19:19:02+11:00
New Revision: d822c099eeacc69f6bf834a6373a41d0c9f84a3e

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

LOG: [JITLink] Use `rsplit` on `-sectcreate` argument in llvm-jitlink (#115511)

This accounts for cases where the file path may contain an `@` symbol.
In such cases, the split occurs too early causing argument parsing to
fail.

Added: 
    llvm/test/ExecutionEngine/JITLink/Generic/Inputs/sect at create/sectcreate-data.txt

Modified: 
    llvm/test/ExecutionEngine/JITLink/Generic/sectcreate.test
    llvm/tools/llvm-jitlink/llvm-jitlink.cpp

Removed: 
    llvm/test/ExecutionEngine/JITLink/Generic/Inputs/sectcreate-data.txt


################################################################################
diff  --git a/llvm/test/ExecutionEngine/JITLink/Generic/Inputs/sectcreate-data.txt b/llvm/test/ExecutionEngine/JITLink/Generic/Inputs/sect at create/sectcreate-data.txt
similarity index 100%
rename from llvm/test/ExecutionEngine/JITLink/Generic/Inputs/sectcreate-data.txt
rename to llvm/test/ExecutionEngine/JITLink/Generic/Inputs/sect at create/sectcreate-data.txt

diff  --git a/llvm/test/ExecutionEngine/JITLink/Generic/sectcreate.test b/llvm/test/ExecutionEngine/JITLink/Generic/sectcreate.test
index c09513a7d3707c..08b6372dcf2c73 100644
--- a/llvm/test/ExecutionEngine/JITLink/Generic/sectcreate.test
+++ b/llvm/test/ExecutionEngine/JITLink/Generic/sectcreate.test
@@ -1,6 +1,6 @@
 # RUN: llc -filetype=obj -o %t.o %S/Inputs/main-ret-0.ll
 # RUN: llvm-jitlink -noexec \
-# RUN:   -sectcreate __data,%S/Inputs/sectcreate-data.txt at foo=0 \
+# RUN:   -sectcreate __data,%S/Inputs/sect at create/sectcreate-data.txt at foo=0 \
 # RUN:   %t.o
 #
 # Use -sectcreate to create a section from a data file.

diff  --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index cc144cda18e1a3..261daae5e67f94 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -1740,7 +1740,7 @@ static Error addSectCreates(Session &S,
 
     StringRef SCArg(*SCItr);
 
-    auto [SectAndFileName, ExtraSymbolsString] = SCArg.split('@');
+    auto [SectAndFileName, ExtraSymbolsString] = SCArg.rsplit('@');
     auto [SectName, FileName] = SectAndFileName.rsplit(',');
     if (SectName.empty())
       return make_error<StringError>("In -sectcreate=" + SCArg +


        


More information about the llvm-commits mailing list