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
This commit is contained in:
Alexander Richardson
2024-05-01 09:41:55 -07:00
committed by GitHub
parent 666d1dd9a2
commit e7566448fa

View File

@@ -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<BaseSemihosting::FileBase> file =