Andreas Kling
22b8110554
LibELF: Avoid doing strlen() on everything while iterating GNU hash
...
It's a lot faster to iterate the GNU hash tables if we don't have to
compute the length of every symbol name before rejecting it anyway while
comparing the first character. :^)
2021-02-23 19:43:44 +01:00
Andreas Kling
46a94a9a9e
LibELF: Rename lookup_elf_symbol() => lookup_sysv_symbol()
...
We have two kinds of lookup, SYSV and GNU hash. Both are ELF lookups.
2021-02-23 19:43:44 +01:00
Andreas Kling
cc00df0f0f
LibELF: Avoid calling strlen() in DynamicObject::hash_section()
...
The long-term fix here is to make StringView recognize compile-time
string literals and do the right thing automatically.
2021-02-23 19:43:44 +01:00
Andreas Kling
d6af3302e8
LibELF: Don't recompute the same ELF hashes over and over
...
When performing a global symbol lookup, we were recomputing the symbol
hashes once for every dynamic object searched. The hash function was
at the very top of a profile (15%) of program startup.
With this change, the hash function is no longer visible among the top
stacks in the profile. :^)
2021-02-23 19:43:44 +01:00
Andreas Kling
37420f1baf
LibELF: Move ELF hash functions to their own file (and make constexpr)
2021-02-23 19:43:44 +01:00
Andreas Kling
f23b29f605
LibELF: Move DynamicObject::lookup_symbol() to DynamicLoader
...
Also simplify it by removing an unreachable code path.
2021-02-21 00:29:52 +01:00
Andreas Kling
a43910acc3
LibELF: Make SymbolLookupResult::address a VirtualAddress
...
Let's use a stronger type than void* for this since we're talking
specifically about a virtual address and not necessarily a pointer
to something actually in memory (yet).
2021-02-21 00:02:21 +01:00
Andreas Kling
1997d5de1a
LibELF: Make symbol lookup functions return Optional<Symbol>
...
It was very confusing how these functions used the "undefined" state
of Symbol to signal lookup failure. Let's use Optional<T> to make things
a bit more understandable.
2021-02-21 00:02:21 +01:00
Andreas Kling
ba1eea9898
LibELF+DynamicLoader: Rename DynamicObject::construct() => create()
2021-02-21 00:02:21 +01:00
Andreas Kling
01f1e480e5
LibELF: Fix various clang-tidy warnings
...
Remove a bunch of unused code, unnecessary const, and make some
non-object-specific member functions static.
2021-02-21 00:02:21 +01:00
Andreas Kling
0c0127dc3f
LibELF: Use StringView instead of "const char*" in dynamic linker code
...
There's no reason to use C strings more than absolutely necessary.
2021-02-20 22:29:12 +01:00
Andreas Kling
fa4c249425
LibELF+Userland: Enable RELRO for all userland executables :^)
...
The dynamic loader will now mark RELRO segments read-only after
performing relocations. This is pretty cool!
Note that this only applies to main executables so far,.
RELRO support for shared libraries will require some reorganizing
of the dynamic loader.
2021-02-18 18:55:19 +01:00
AnotherTest
09a43969ba
Everywhere: Replace dbgln<flag>(...) with dbgln_if(flag, ...)
...
Replacement made by `find Kernel Userland -name '*.h' -o -name '*.cpp' | sed -i -Ee 's/dbgln\b<(\w+)>\(/dbgln_if(\1, /g'`
2021-02-08 18:08:55 +01:00
Andreas Kling
41d8734288
LibELF: Use Optional<SymbolLookupResult> as a return type
...
Instead of storing a "found" state inside the result object.
2021-01-25 18:57:06 +01:00
Andreas Kling
a5de46684b
LibELF: Convert String::format() to String::formatted()
2021-01-25 18:57:06 +01:00
Andreas Kling
c5e52be5d4
LibELF: Convert dbgprintf() in DynamicObject class to dbgln()
2021-01-25 18:57:06 +01:00
asynts
acdcf59a33
Everywhere: Remove unnecessary debug comments.
...
It would be tempting to uncomment these statements, but that won't work
with the new changes.
This was done with the following commands:
find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/#define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/#define/ { toggle = 1 }' {} \;
find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/ #define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/ #define/ { toggle = 1 }' {} \;
2021-01-25 09:47:36 +01:00
Andreas Kling
13d7c09125
Libraries: Move to Userland/Libraries/
2021-01-12 12:17:46 +01:00