From e7566448fa442d090b4458fcc5f11611b9c1229e Mon Sep 17 00:00:00 2001 From: Alexander Richardson Date: Wed, 1 May 2024 09:41:55 -0700 Subject: [PATCH] arch-generic: More reliable special file name handling in semihosting (#1090) Currently, the filesRootDir is prepended for all paths that do not start with '/'. However, we should not be doing this for the special files :tt and :semihosting-features. Noticed this while testing semihosting with a non-empty filesRootDir. Change-Id: I156c8b680cb71cdc88788be3b0e93fc1d52e11e5 --- src/arch/generic/semihosting.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/arch/generic/semihosting.cc b/src/arch/generic/semihosting.cc index 4da54c4b4b..908638fc80 100644 --- a/src/arch/generic/semihosting.cc +++ b/src/arch/generic/semihosting.cc @@ -180,7 +180,8 @@ BaseSemihosting::callOpen( return retError(EINVAL); std::string fname = readString(tc, name_base, name_size); - if (!fname.empty() && fname.front() != '/') + if (!fname.empty() && fname.front() != '/' && fname != ":tt" && + fname != ":semihosting-features") fname = filesRootDir + fname; std::unique_ptr file =