diff --git a/core/relinker/cli/src/NativeModules.cpp b/core/relinker/cli/src/NativeModules.cpp index f6e5bc3100..835909cfb7 100644 --- a/core/relinker/cli/src/NativeModules.cpp +++ b/core/relinker/cli/src/NativeModules.cpp @@ -81,7 +81,7 @@ NativeModules ReadModules(const std::filesystem::path& inputPath, const std::fil std::map sonames; const auto soname = [&](std::size_t index) -> const std::string& { const auto [found, inserted] = sonames.try_emplace(index); - if (inserted) found->second = GuestImageReader().Read(result.Modules[index].Path, result.Modules[index].Bytes).Soname; + if (inserted) found->second = GuestImageReader().Read(result.Modules[index].Path, result.Modules[index].Bytes, true).Soname; return found->second; }; std::vector copies(result.Modules.size()); diff --git a/core/relinker/relinker/tests/test_guest_module_directories.py b/core/relinker/relinker/tests/test_guest_module_directories.py index fcbf2375e1..5f49680e0d 100644 --- a/core/relinker/relinker/tests/test_guest_module_directories.py +++ b/core/relinker/relinker/tests/test_guest_module_directories.py @@ -24,12 +24,16 @@ def module_with_symbol(exported): return image -def module_with_soname(soname): +def module_with_soname(soname, duplicate_alias=False): image = module_with_symbol(True) - strings = b"\0shared#A#B\0" + soname.encode() + b"\0" + alias = b"shared#C#B\0" if duplicate_alias else b"" + strings = b"\0shared#A#B\0" + alias + soname.encode() + b"\0" image[0x800:0x800 + len(strings)] = strings + if duplicate_alias: + struct.pack_into("