From 57292f574156f817b7cbeb33ea6278c6eab22bcc Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 19 Nov 2021 06:18:56 -0800 Subject: Add GLIBC_ABI_DT_RELR for DT_RELR support The EI_ABIVERSION field of the ELF header in executables and shared libraries can be bumped to indicate the minimum ABI requirement on the dynamic linker. However, EI_ABIVERSION in executables isn't checked by the Linux kernel ELF loader nor the existing dynamic linker. Executables will crash mysteriously if the dynamic linker doesn't support the ABI features required by the EI_ABIVERSION field. The dynamic linker should be changed to check EI_ABIVERSION in executables. Add a glibc version, GLIBC_ABI_DT_RELR, to indicate DT_RELR support so that the existing dynamic linkers will issue an error on executables with GLIBC_ABI_DT_RELR dependency. When there is a DT_VERNEED entry with libc.so on DT_NEEDED, issue an error if there is a DT_RELR entry without GLIBC_ABI_DT_RELR dependency. Support __placeholder_only_for_empty_version_map as the placeholder symbol used only for empty version map to generate GLIBC_ABI_DT_RELR without any symbols. --- include/link.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/link.h') diff --git a/include/link.h b/include/link.h index 03db14c..0ac82d7 100644 --- a/include/link.h +++ b/include/link.h @@ -177,6 +177,8 @@ struct link_map lt_library, /* Library needed by main executable. */ lt_loaded /* Extra run-time loaded shared object. */ } l_type:2; + unsigned int l_dt_relr_ref:1; /* Nonzero if GLIBC_ABI_DT_RELR is + referenced. */ unsigned int l_relocated:1; /* Nonzero if object's relocations done. */ unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */ unsigned int l_global:1; /* Nonzero if object in _dl_global_scope. */ -- cgit v1.1