Skip to content

Commit

Permalink
[JITLink] Use rsplit on -sectcreate argument in llvm-jitlink (llv…
Browse files Browse the repository at this point in the history
…m#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.
  • Loading branch information
dgg5503 authored Nov 10, 2024
1 parent 4edd711 commit d822c09
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion llvm/test/ExecutionEngine/JITLink/Generic/sectcreate.test
Original file line number Diff line number Diff line change
@@ -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@foo=0 \
# RUN: -sectcreate __data,%S/Inputs/sect@create/sectcreate-data.txt@foo=0 \
# RUN: %t.o
#
# Use -sectcreate to create a section from a data file.
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-jitlink/llvm-jitlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down

0 comments on commit d822c09

Please sign in to comment.