LibELF: Allow (but ignore) PT_LOAD headers with zero size

GNU ld sometimes generates zero-sized PT_LOAD headers when running with
the "-z separate-code" option. Let's not choke on such headers, we can
just ignore them and move along.
This commit is contained in:
Andreas Kling 2021-08-31 16:30:26 +02:00
commit 0819f0a3fd
Notes: sideshowbarker 2024-07-18 05:00:31 +09:00
2 changed files with 2 additions and 6 deletions

View file

@ -260,6 +260,8 @@ void DynamicLoader::load_program_headers()
VERIFY(!tls_region.has_value());
tls_region = region;
} else if (region.is_load()) {
if (region.size_in_memory() == 0)
return;
load_regions.append(region);
if (region.is_executable()) {
text_regions.append(region);