LibELF: Allow shared objects which don't have a text segment

Shared objects without a text segment are perfectly OK. For
example libicudata.so has only data segments:

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .hash         00000014  00000094  00000094  00000094  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .dynsym       00000020  000000a8  000000a8  000000a8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .dynstr       0000002a  000000c8  000000c8  000000c8  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .rodata       01b562d0  00000100  00000100  00000100  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .eh_frame     00000000  01b563d0  01b563d0  01b563d0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .dynamic      00000070  01b573d0  01b573d0  01b563d0  2**2
This commit is contained in:
Gunnar Beutner 2021-04-19 19:35:02 +02:00 committed by Andreas Kling
parent 68d1469aea
commit 6c729993a8
Notes: sideshowbarker 2024-07-18 19:22:45 +09:00

View file

@ -306,8 +306,7 @@ void DynamicLoader::load_program_headers()
return IterationDecision::Continue;
});
VERIFY(!text_regions.is_empty());
VERIFY(!data_regions.is_empty());
VERIFY(!text_regions.is_empty() || !data_regions.is_empty());
auto compare_load_address = [](ProgramHeaderRegion& a, ProgramHeaderRegion& b) {
return a.desired_load_address().as_ptr() < b.desired_load_address().as_ptr();