Skip to content
Snippets Groups Projects
Commit ec48d7e1 authored by Andreas Ziegler's avatar Andreas Ziegler
Browse files

test: ensure 64 bit, test .plt/.rela.plt searching

Test parsing .plt and .rela.plt from the dynamic segment.

For this we should make sure our binaries are compiled as 64
bit as a 32 bit binary will not have a .rela.plt but a
.rel.plt section instead.
parent c81794df
No related branches found
No related tags found
No related merge requests found
Pipeline #22935 passed
CC=gcc
SHARED_FLAGS=-shared -fPIC -O3
SHARED_FLAGS=-shared -fPIC -O3 -m64
CFLAGS=$(SHARED_FLAGS) -Wl,-Bsymbolic-functions
RPATH_DIR=rpath_dir
RPATH_SUBDIR=$(RPATH_DIR)/rpath_subdir
......
......@@ -425,5 +425,17 @@ class TestLibrary(unittest.TestCase):
self.assertIn(binary.fullname, lib.get_users_by_name('external_caller'))
self.assertIn(binary.fullname, lib.get_users_by_name('second_level_caller'))
def test_7_search_for_plt(self):
_, library = create_store_and_lib(TEST_LIBRARY)
searched_plt = library._search_for_plt()
section_plt = library._elffile.get_section_by_name('.plt')
self.assertEquals(searched_plt['sh_offset'], section_plt['sh_offset'])
def test_7_dynamic_rela_plt(self):
_, library = create_store_and_lib(TEST_LIBRARY)
searched_plt = library._create_mock_rela_plt()
section_plt = library._elffile.get_section_by_name('.rela.plt')
self.assertEquals(searched_plt['sh_offset'], section_plt['sh_offset'])
if __name__ == '__main__':
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment