Skip to content

Commit d822c09

Browse files
authored
[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.
1 parent 4edd711 commit d822c09

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

llvm/test/ExecutionEngine/JITLink/Generic/sectcreate.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# RUN: llc -filetype=obj -o %t.o %S/Inputs/main-ret-0.ll
22
# RUN: llvm-jitlink -noexec \
3-
# RUN: -sectcreate __data,%S/Inputs/sectcreate-data.txt@foo=0 \
3+
# RUN: -sectcreate __data,%S/Inputs/sect@create/sectcreate-data.txt@foo=0 \
44
# RUN: %t.o
55
#
66
# Use -sectcreate to create a section from a data file.

llvm/tools/llvm-jitlink/llvm-jitlink.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,7 @@ static Error addSectCreates(Session &S,
17401740

17411741
StringRef SCArg(*SCItr);
17421742

1743-
auto [SectAndFileName, ExtraSymbolsString] = SCArg.split('@');
1743+
auto [SectAndFileName, ExtraSymbolsString] = SCArg.rsplit('@');
17441744
auto [SectName, FileName] = SectAndFileName.rsplit(',');
17451745
if (SectName.empty())
17461746
return make_error<StringError>("In -sectcreate=" + SCArg +

0 commit comments

Comments
 (0)