LibELF/DynamicLinker: Evaluate symbols in library insertion order (#8802)

When loading libraries, it is required that each library uses the same
instance of each symbol, and that they use the one from the executable
if any. This is barely noticeable if done incorrectly; except that it
completely breaks RTTI on Clang. This switches the hash map to be
ordered; tested to work for Clang by @Bertaland
This commit is contained in:
Peter Bindels 2021-07-16 11:55:01 +02:00 committed by GitHub
parent 5f3e6085a2
commit ca9c53c1a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: sideshowbarker 2024-07-18 08:56:39 +09:00

View file

@ -34,7 +34,7 @@ namespace ELF {
static HashMap<String, NonnullRefPtr<ELF::DynamicLoader>> s_loaders;
static String s_main_program_name;
static HashMap<String, NonnullRefPtr<ELF::DynamicObject>> s_global_objects;
static OrderedHashMap<String, NonnullRefPtr<ELF::DynamicObject>> s_global_objects;
using EntryPointFunction = int (*)(int, char**, char**);
using LibCExitFunction = void (*)(int);