diff --git a/glibc.spec b/glibc.spec index 524ab22..82807c7 100644 --- a/glibc.spec +++ b/glibc.spec @@ -145,7 +145,7 @@ Version: %{glibcversion} # - It allows using the Release number without the %%dist tag in the dependency # generator to make the generated requires interchangeable between Rawhide # and ELN (.elnYY < .fcXX). -%global baserelease 46 +%global baserelease 47 Release: %{baserelease}%{?dist} # Licenses: @@ -211,6 +211,12 @@ Source10: wrap-find-debuginfo.sh Source11: parse-SUPPORTED.py # Include in the source RPM for reference. Source12: ChangeLog.old +Source13: verify-ld-so-abi.sh +Source14: ld-so-abi-aarch64.baseline +Source15: ld-so-abi-ppc64le.baseline +Source16: ld-so-abi-riscv64.baseline +Source17: ld-so-abi-s390x.baseline +Source18: ld-so-abi-x86_64.baseline # glibc_ldso: ABI-specific program interpreter name. Used for debuginfo # extraction (wrap-find-debuginfo.sh) and smoke testing ($run_ldso below). @@ -638,6 +644,10 @@ BuildRequires: audit-libs-devel >= 1.1.3, sed >= 3.95, libcap-devel, gettext BuildRequires: procps-ng, util-linux, gawk BuildRequires: systemtap-sdt-devel +%if %{with testsuite} +BuildRequires: gdb +%endif + %if %{with valgrind} # Require valgrind for smoke testing the dynamic loader to make sure we # have not broken valgrind. @@ -1423,6 +1433,12 @@ diff -u \ --label "glibc localedata/SUPPORTED" localedata/SUPPORTED.glibc rm localedata/SUPPORTED.spec localedata/SUPPORTED.glibc +# Prepare for ld.so ABI check +cp %{SOURCE13} . +chmod +x verify-ld-so-abi.sh + +cp %{_sourcedir}/*.baseline . + ############################################################################## # Build glibc... ############################################################################## @@ -2203,6 +2219,11 @@ $run_ldso /usr/bin/valgrind --error-exitcode=1 \ %endif %endif +# Verify ld.so ABI. +if test -f "ld-so-abi-%{_arch}.baseline" ; then + ./verify-ld-so-abi.sh %{_arch} %{glibc_sysroot}%{_prefix}%{glibc_ldso} +fi + %endif @@ -2577,6 +2598,9 @@ update_gconv_modules_cache () %endif %changelog +* Tue Jul 29 2025 Frédéric Bérat - 2.39-47 +- Add ld-so-abi-check + * Thu Jul 24 2025 Florian Weimer - 2.39-46 - CVE-2025-8058: Double free in regcomp (RHEL-105324) diff --git a/ld-so-abi-aarch64.baseline b/ld-so-abi-aarch64.baseline new file mode 100644 index 0000000..f851c7b --- /dev/null +++ b/ld-so-abi-aarch64.baseline @@ -0,0 +1,545 @@ +--- _rtld_global_ro --- +/* offset | size */ type = struct rtld_global_ro { +/* 0 | 4 */ int _dl_debug_mask; +/* XXX 4-byte hole */ +/* 8 | 8 */ const char *_dl_platform; +/* 16 | 8 */ size_t _dl_platformlen; +/* 24 | 8 */ size_t _dl_pagesize; +/* 32 | 8 */ size_t _dl_minsigstacksize; +/* 40 | 4 */ int _dl_inhibit_cache; +/* XXX 4-byte hole */ +/* 48 | 16 */ struct r_scope_elem { +/* 48 | 8 */ struct link_map **r_list; +/* 56 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } _dl_initial_searchlist; +/* 64 | 4 */ int _dl_clktck; +/* 68 | 4 */ int _dl_verbose; +/* 72 | 4 */ int _dl_debug_fd; +/* 76 | 4 */ int _dl_lazy; +/* 80 | 4 */ int _dl_bind_not; +/* 84 | 4 */ int _dl_dynamic_weak; +/* 88 | 4 */ fpu_control_t _dl_fpu_control; +/* XXX 4-byte hole */ +/* 96 | 8 */ uint64_t _dl_hwcap; +/* 104 | 8 */ Elf64_auxv_t *_dl_auxv; +/* 112 | 24 */ struct cpu_features { +/* 112 | 8 */ uint64_t midr_el1; +/* 120 | 4 */ unsigned int zva_size; +/* 124 | 1 */ _Bool bti; +/* 125 | 1 */ uint8_t mte_state; +/* 126 | 1 */ _Bool sve; +/* 127 | 1 */ _Bool prefer_sve_ifuncs; +/* 128 | 1 */ _Bool mops; +/* XXX 7-byte padding */ + + /* total size (bytes): 24 */ + } _dl_aarch64_cpu_features; +/* 136 | 320 */ const char _dl_aarch64_cap_flags[32][10]; +/* 456 | 8 */ const char *_dl_inhibit_rpath; +/* 464 | 8 */ const char *_dl_origin_path; +/* 472 | 8 */ size_t _dl_tls_static_size; +/* 480 | 8 */ size_t _dl_tls_static_align; +/* 488 | 8 */ size_t _dl_tls_static_surplus; +/* 496 | 8 */ const char *_dl_profile; +/* 504 | 8 */ const char *_dl_profile_output; +/* 512 | 8 */ struct r_search_path_elem *_dl_init_all_dirs; +/* 520 | 8 */ const Elf64_Ehdr *_dl_sysinfo_dso; +/* 528 | 8 */ struct link_map *_dl_sysinfo_map; +/* 536 | 8 */ int (*_dl_vdso_clock_gettime64)(clockid_t, struct timespec *); +/* 544 | 8 */ int (*_dl_vdso_gettimeofday)(struct timeval *, void *); +/* 552 | 8 */ int (*_dl_vdso_clock_getres_time64)(clockid_t, struct timespec *); +/* 560 | 8 */ ssize_t (*_dl_vdso_getrandom)(void *, size_t, unsigned int, void *, size_t); +/* 568 | 8 */ uint64_t _dl_hwcap2; +/* 576 | 8 */ uint64_t _dl_hwcap3; +/* 584 | 8 */ uint64_t _dl_hwcap4; +/* 592 | 4 */ enum dso_sort_algorithm _dl_dso_sort_algo; +/* XXX 4-byte hole */ +/* 600 | 8 */ void (*_dl_debug_printf)(const char *, ...); +/* 608 | 8 */ void (*_dl_mcount)(Elf64_Addr, Elf64_Addr); +/* 616 | 8 */ lookup_t (*_dl_lookup_symbol_x)(const char *, struct link_map *, const Elf64_Sym **, struct r_scope_elem **, const struct r_found_version *, int, int, struct link_map *); +/* 624 | 8 */ void *(*_dl_open)(const char *, int, const void *, Lmid_t, int, char **, char **); +/* 632 | 8 */ void (*_dl_close)(void *); +/* 640 | 8 */ int (*_dl_catch_error)(const char **, const char **, _Bool *, void (*)(void *), void *); +/* 648 | 8 */ void (*_dl_error_free)(void *); +/* 656 | 8 */ void *(*_dl_tls_get_addr_soft)(struct link_map *); +/* 664 | 8 */ void (*_dl_libc_freeres)(void); +/* 672 | 8 */ int (*_dl_find_object)(void *, struct dl_find_object *); +/* 680 | 8 */ const struct dlfcn_hook *_dl_dlfcn_hook; +/* 688 | 8 */ struct audit_ifaces *_dl_audit; +/* 696 | 4 */ unsigned int _dl_naudit; +/* XXX 4-byte padding */ + + /* total size (bytes): 704 */ + } +--- _rtld_global --- +/* offset | size */ type = struct rtld_global { +/* 0 | 2688 */ struct link_namespaces _dl_ns[16]; +/* 2688 | 8 */ size_t _dl_nns; +/* 2696 | 48 */ __rtld_lock_recursive_t _dl_load_lock; +/* 2744 | 48 */ __rtld_lock_recursive_t _dl_load_write_lock; +/* 2792 | 48 */ __rtld_lock_recursive_t _dl_load_tls_lock; +/* 2840 | 8 */ unsigned long long _dl_load_adds; +/* 2848 | 8 */ struct link_map *_dl_initfirst; +/* 2856 | 8 */ struct link_map *_dl_profile_map; +/* 2864 | 8 */ unsigned long _dl_num_relocations; +/* 2872 | 8 */ unsigned long _dl_num_cache_relocations; +/* 2880 | 8 */ struct r_search_path_elem *_dl_all_dirs; +/* 2888 | 1216 */ struct link_map { +/* 2888 | 8 */ Elf64_Addr l_addr; +/* 2896 | 8 */ char *l_name; +/* 2904 | 8 */ Elf64_Dyn *l_ld; +/* 2912 | 8 */ struct link_map *l_next; +/* 2920 | 8 */ struct link_map *l_prev; +/* 2928 | 8 */ struct link_map *l_real; +/* 2936 | 8 */ Lmid_t l_ns; +/* 2944 | 8 */ struct libname_list *l_libname; +/* 2952 | 688 */ Elf64_Dyn *l_info[86]; +/* 3640 | 8 */ const Elf64_Phdr *l_phdr; +/* 3648 | 8 */ Elf64_Addr l_entry; +/* 3656 | 2 */ Elf64_Half l_phnum; +/* 3658 | 2 */ Elf64_Half l_ldnum; +/* XXX 4-byte hole */ +/* 3664 | 16 */ struct r_scope_elem { +/* 3664 | 8 */ struct link_map **r_list; +/* 3672 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_searchlist; +/* 3680 | 16 */ struct r_scope_elem { +/* 3680 | 8 */ struct link_map **r_list; +/* 3688 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_symbolic_searchlist; +/* 3696 | 8 */ struct link_map *l_loader; +/* 3704 | 8 */ struct r_found_version *l_versions; +/* 3712 | 4 */ unsigned int l_nversions; +/* 3716 | 4 */ Elf_Symndx l_nbuckets; +/* 3720 | 4 */ Elf32_Word l_gnu_bitmask_idxbits; +/* 3724 | 4 */ Elf32_Word l_gnu_shift; +/* 3728 | 8 */ const Elf64_Addr *l_gnu_bitmask; +/* 3736 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_buckets; +/* 8 */ const Elf_Symndx *l_chain; + + /* total size (bytes): 8 */ + }; +/* 3744 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_chain_zero; +/* 8 */ const Elf_Symndx *l_buckets; + + /* total size (bytes): 8 */ + }; +/* 3752 | 4 */ unsigned int l_direct_opencount; +/* 3756: 0 | 4 */ enum {lt_executable, lt_library, lt_loaded} l_type : 2; +/* 3756: 2 | 4 */ unsigned int l_dt_relr_ref : 1; +/* 3756: 3 | 4 */ unsigned int l_relocated : 1; +/* 3756: 4 | 4 */ unsigned int l_init_called : 1; +/* 3756: 5 | 4 */ unsigned int l_global : 1; +/* 3756: 6 | 4 */ unsigned int l_reserved : 2; +/* 3757: 0 | 4 */ unsigned int l_main_map : 1; +/* 3757: 1 | 4 */ unsigned int l_visited : 1; +/* 3757: 2 | 4 */ unsigned int l_map_used : 1; +/* 3757: 3 | 4 */ unsigned int l_map_done : 1; +/* 3757: 4 | 4 */ unsigned int l_phdr_allocated : 1; +/* 3757: 5 | 4 */ unsigned int l_soname_added : 1; +/* 3757: 6 | 4 */ unsigned int l_faked : 1; +/* 3757: 7 | 4 */ unsigned int l_need_tls_init : 1; +/* 3758: 0 | 4 */ unsigned int l_auditing : 1; +/* 3758: 1 | 4 */ unsigned int l_audit_any_plt : 1; +/* 3758: 2 | 4 */ unsigned int l_removed : 1; +/* 3758: 3 | 4 */ unsigned int l_contiguous : 1; +/* 3758: 4 | 4 */ unsigned int l_free_initfini : 1; +/* 3758: 5 | 4 */ unsigned int l_ld_readonly : 1; +/* 3758: 6 | 4 */ unsigned int l_find_object_processed : 1; +/* 3758: 7 | 4 */ unsigned int l_tls_in_slotinfo : 1; +/* 3759 | 1 */ _Bool l_nodelete_active; +/* 3760 | 1 */ _Bool l_nodelete_pending; +/* XXX 3-byte hole */ +/* 3764 | 4 */ unsigned int l_1_needed; +/* 3768 | 16 */ struct r_search_path_struct { +/* 3768 | 8 */ struct r_search_path_elem **dirs; +/* 3776 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_rpath_dirs; +/* 3784 | 8 */ struct reloc_result *l_reloc_result; +/* 3792 | 8 */ Elf64_Versym *l_versyms; +/* 3800 | 8 */ const char *l_origin; +/* 3808 | 8 */ Elf64_Addr l_map_start; +/* 3816 | 8 */ Elf64_Addr l_map_end; +/* 3824 | 32 */ struct r_scope_elem *l_scope_mem[4]; +/* 3856 | 8 */ size_t l_scope_max; +/* 3864 | 8 */ struct r_scope_elem **l_scope; +/* 3872 | 16 */ struct r_scope_elem *l_local_scope[2]; +/* 3888 | 16 */ struct r_file_id { +/* 3888 | 8 */ dev_t dev; +/* 3896 | 8 */ ino64_t ino; + + /* total size (bytes): 16 */ + } l_file_id; +/* 3904 | 16 */ struct r_search_path_struct { +/* 3904 | 8 */ struct r_search_path_elem **dirs; +/* 3912 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_runpath_dirs; +/* 3920 | 8 */ struct link_map **l_initfini; +/* 3928 | 8 */ struct link_map_reldeps *l_reldeps; +/* 3936 | 4 */ unsigned int l_reldepsmax; +/* 3940 | 4 */ unsigned int l_used; +/* 3944 | 4 */ Elf64_Word l_feature_1; +/* 3948 | 4 */ Elf64_Word l_flags_1; +/* 3952 | 4 */ Elf64_Word l_flags; +/* 3956 | 4 */ int l_idx; +/* 3960 | 24 */ struct link_map_machine { +/* 3960 | 8 */ Elf64_Addr plt; +/* 3968 | 8 */ void *tlsdesc_table; +/* 3976 | 1 */ _Bool bti_fail; +/* XXX 7-byte padding */ + + /* total size (bytes): 24 */ + } l_mach; +/* 3984 | 32 */ struct { +/* 3984 | 8 */ const Elf64_Sym *sym; +/* 3992 | 4 */ int type_class; +/* XXX 4-byte hole */ +/* 4000 | 8 */ struct link_map *value; +/* 4008 | 8 */ const Elf64_Sym *ret; + + /* total size (bytes): 32 */ + } l_lookup_cache; +/* 4016 | 8 */ void *l_tls_initimage; +/* 4024 | 8 */ size_t l_tls_initimage_size; +/* 4032 | 8 */ size_t l_tls_blocksize; +/* 4040 | 8 */ size_t l_tls_align; +/* 4048 | 8 */ size_t l_tls_firstbyte_offset; +/* 4056 | 8 */ ptrdiff_t l_tls_offset; +/* 4064 | 8 */ size_t l_tls_modid; +/* 4072 | 8 */ size_t l_tls_dtor_count; +/* 4080 | 8 */ Elf64_Addr l_relro_addr; +/* 4088 | 8 */ size_t l_relro_size; +/* 4096 | 8 */ unsigned long long l_serial; + + /* total size (bytes): 1216 */ + } _dl_rtld_map; +/* 4104 | 256 */ struct auditstate _dl_rtld_auditstate[16]; +/* 4360 | 4 */ Elf64_Word _dl_stack_flags; +/* 4364 | 1 */ _Bool _dl_tls_dtv_gaps; +/* XXX 3-byte hole */ +/* 4368 | 8 */ size_t _dl_tls_max_dtv_idx; +/* 4376 | 8 */ struct dtv_slotinfo_list *_dl_tls_dtv_slotinfo_list; +/* 4384 | 8 */ size_t _dl_tls_static_nelem; +/* 4392 | 8 */ size_t _dl_tls_static_used; +/* 4400 | 8 */ size_t _dl_tls_static_optional; +/* 4408 | 8 */ void *_dl_initial_dtv; +/* 4416 | 8 */ size_t _dl_tls_generation; +/* 4424 | 8 */ struct dl_scope_free_list *_dl_scope_free_list; +/* 4432 | 16 */ list_t _dl_stack_used; +/* 4448 | 16 */ list_t _dl_stack_user; +/* 4464 | 16 */ list_t _dl_stack_cache; +/* 4480 | 8 */ size_t _dl_stack_cache_actsize; +/* 4488 | 8 */ uintptr_t _dl_in_flight_stack; +/* 4496 | 4 */ int _dl_stack_cache_lock; +/* XXX 4-byte padding */ + + /* total size (bytes): 4504 */ + } +--- struct link_map --- +/* offset | size */ type = struct link_map { +/* 0 | 8 */ Elf64_Addr l_addr; +/* 8 | 8 */ char *l_name; +/* 16 | 8 */ Elf64_Dyn *l_ld; +/* 24 | 8 */ struct link_map *l_next; +/* 32 | 8 */ struct link_map *l_prev; +/* 40 | 8 */ struct link_map *l_real; +/* 48 | 8 */ Lmid_t l_ns; +/* 56 | 8 */ struct libname_list *l_libname; +/* 64 | 688 */ Elf64_Dyn *l_info[86]; +/* 752 | 8 */ const Elf64_Phdr *l_phdr; +/* 760 | 8 */ Elf64_Addr l_entry; +/* 768 | 2 */ Elf64_Half l_phnum; +/* 770 | 2 */ Elf64_Half l_ldnum; +/* XXX 4-byte hole */ +/* 776 | 16 */ struct r_scope_elem { +/* 776 | 8 */ struct link_map **r_list; +/* 784 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_searchlist; +/* 792 | 16 */ struct r_scope_elem { +/* 792 | 8 */ struct link_map **r_list; +/* 800 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_symbolic_searchlist; +/* 808 | 8 */ struct link_map *l_loader; +/* 816 | 8 */ struct r_found_version *l_versions; +/* 824 | 4 */ unsigned int l_nversions; +/* 828 | 4 */ Elf_Symndx l_nbuckets; +/* 832 | 4 */ Elf32_Word l_gnu_bitmask_idxbits; +/* 836 | 4 */ Elf32_Word l_gnu_shift; +/* 840 | 8 */ const Elf64_Addr *l_gnu_bitmask; +/* 848 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_buckets; +/* 8 */ const Elf_Symndx *l_chain; + + /* total size (bytes): 8 */ + }; +/* 856 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_chain_zero; +/* 8 */ const Elf_Symndx *l_buckets; + + /* total size (bytes): 8 */ + }; +/* 864 | 4 */ unsigned int l_direct_opencount; +/* 868: 0 | 4 */ enum {lt_executable, lt_library, lt_loaded} l_type : 2; +/* 868: 2 | 4 */ unsigned int l_dt_relr_ref : 1; +/* 868: 3 | 4 */ unsigned int l_relocated : 1; +/* 868: 4 | 4 */ unsigned int l_init_called : 1; +/* 868: 5 | 4 */ unsigned int l_global : 1; +/* 868: 6 | 4 */ unsigned int l_reserved : 2; +/* 869: 0 | 4 */ unsigned int l_main_map : 1; +/* 869: 1 | 4 */ unsigned int l_visited : 1; +/* 869: 2 | 4 */ unsigned int l_map_used : 1; +/* 869: 3 | 4 */ unsigned int l_map_done : 1; +/* 869: 4 | 4 */ unsigned int l_phdr_allocated : 1; +/* 869: 5 | 4 */ unsigned int l_soname_added : 1; +/* 869: 6 | 4 */ unsigned int l_faked : 1; +/* 869: 7 | 4 */ unsigned int l_need_tls_init : 1; +/* 870: 0 | 4 */ unsigned int l_auditing : 1; +/* 870: 1 | 4 */ unsigned int l_audit_any_plt : 1; +/* 870: 2 | 4 */ unsigned int l_removed : 1; +/* 870: 3 | 4 */ unsigned int l_contiguous : 1; +/* 870: 4 | 4 */ unsigned int l_free_initfini : 1; +/* 870: 5 | 4 */ unsigned int l_ld_readonly : 1; +/* 870: 6 | 4 */ unsigned int l_find_object_processed : 1; +/* 870: 7 | 4 */ unsigned int l_tls_in_slotinfo : 1; +/* 871 | 1 */ _Bool l_nodelete_active; +/* 872 | 1 */ _Bool l_nodelete_pending; +/* XXX 3-byte hole */ +/* 876 | 4 */ unsigned int l_1_needed; +/* 880 | 16 */ struct r_search_path_struct { +/* 880 | 8 */ struct r_search_path_elem **dirs; +/* 888 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_rpath_dirs; +/* 896 | 8 */ struct reloc_result *l_reloc_result; +/* 904 | 8 */ Elf64_Versym *l_versyms; +/* 912 | 8 */ const char *l_origin; +/* 920 | 8 */ Elf64_Addr l_map_start; +/* 928 | 8 */ Elf64_Addr l_map_end; +/* 936 | 32 */ struct r_scope_elem *l_scope_mem[4]; +/* 968 | 8 */ size_t l_scope_max; +/* 976 | 8 */ struct r_scope_elem **l_scope; +/* 984 | 16 */ struct r_scope_elem *l_local_scope[2]; +/* 1000 | 16 */ struct r_file_id { +/* 1000 | 8 */ dev_t dev; +/* 1008 | 8 */ ino64_t ino; + + /* total size (bytes): 16 */ + } l_file_id; +/* 1016 | 16 */ struct r_search_path_struct { +/* 1016 | 8 */ struct r_search_path_elem **dirs; +/* 1024 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_runpath_dirs; +/* 1032 | 8 */ struct link_map **l_initfini; +/* 1040 | 8 */ struct link_map_reldeps *l_reldeps; +/* 1048 | 4 */ unsigned int l_reldepsmax; +/* 1052 | 4 */ unsigned int l_used; +/* 1056 | 4 */ Elf64_Word l_feature_1; +/* 1060 | 4 */ Elf64_Word l_flags_1; +/* 1064 | 4 */ Elf64_Word l_flags; +/* 1068 | 4 */ int l_idx; +/* 1072 | 24 */ struct link_map_machine { +/* 1072 | 8 */ Elf64_Addr plt; +/* 1080 | 8 */ void *tlsdesc_table; +/* 1088 | 1 */ _Bool bti_fail; +/* XXX 7-byte padding */ + + /* total size (bytes): 24 */ + } l_mach; +/* 1096 | 32 */ struct { +/* 1096 | 8 */ const Elf64_Sym *sym; +/* 1104 | 4 */ int type_class; +/* XXX 4-byte hole */ +/* 1112 | 8 */ struct link_map *value; +/* 1120 | 8 */ const Elf64_Sym *ret; + + /* total size (bytes): 32 */ + } l_lookup_cache; +/* 1128 | 8 */ void *l_tls_initimage; +/* 1136 | 8 */ size_t l_tls_initimage_size; +/* 1144 | 8 */ size_t l_tls_blocksize; +/* 1152 | 8 */ size_t l_tls_align; +/* 1160 | 8 */ size_t l_tls_firstbyte_offset; +/* 1168 | 8 */ ptrdiff_t l_tls_offset; +/* 1176 | 8 */ size_t l_tls_modid; +/* 1184 | 8 */ size_t l_tls_dtor_count; +/* 1192 | 8 */ Elf64_Addr l_relro_addr; +/* 1200 | 8 */ size_t l_relro_size; +/* 1208 | 8 */ unsigned long long l_serial; + + /* total size (bytes): 1216 */ + } +--- struct pthread --- +/* offset | size */ type = struct pthread { +/* 0 | 192 */ union { +/* 8 */ struct { +/* 0 | 4 */ int multiple_threads; +/* 4 | 4 */ int gscope_flag; + + /* total size (bytes): 8 */ + } header; +/* 192 */ void *__padding[24]; + + /* total size (bytes): 192 */ + }; +/* 192 | 16 */ list_t list; +/* 208 | 4 */ pid_t tid; +/* XXX 4-byte hole */ +/* 216 | 8 */ void *robust_prev; +/* 224 | 24 */ struct robust_list_head { +/* 224 | 8 */ void *list; +/* 232 | 8 */ long futex_offset; +/* 240 | 8 */ void *list_op_pending; + + /* total size (bytes): 24 */ + } robust_head; +/* 248 | 8 */ struct _pthread_cleanup_buffer *cleanup; +/* 256 | 8 */ struct pthread_unwind_buf *cleanup_jmp_buf; +/* 264 | 4 */ int cancelhandling; +/* 268 | 4 */ int flags; +/* 272 | 512 */ struct pthread_key_data specific_1stblock[32]; +/* 784 | 256 */ struct pthread_key_data *specific[32]; +/* 1040 | 1 */ _Bool specific_used; +/* 1041 | 1 */ _Bool report_events; +/* 1042 | 1 */ _Bool user_stack; +/* 1043 | 1 */ _Bool stopped_start; +/* 1044 | 4 */ int setup_failed; +/* 1048 | 4 */ int lock; +/* 1052 | 4 */ unsigned int setxid_futex; +/* 1056 | 8 */ struct pthread *joinid; +/* 1064 | 8 */ void *result; +/* 1072 | 4 */ struct sched_param { +/* 1072 | 4 */ int sched_priority; + + /* total size (bytes): 4 */ + } schedparam; +/* 1076 | 4 */ int schedpolicy; +/* 1080 | 8 */ void *(*start_routine)(void *); +/* 1088 | 8 */ void *arg; +/* 1096 | 24 */ td_eventbuf_t eventbuf; +/* 1120 | 8 */ struct pthread *nextevent; +/* XXX 8-byte hole */ +/* 1136 | 32 */ struct _Unwind_Exception { +/* 1136 | 32 */ union { +/* 32 */ struct { +/* 1136 | 8 */ _Unwind_Exception_Class exception_class; +/* 1144 | 8 */ _Unwind_Exception_Cleanup_Fn exception_cleanup; +/* 1152 | 8 */ _Unwind_Word private_1; +/* 1160 | 8 */ _Unwind_Word private_2; + + /* total size (bytes): 32 */ + }; +/* 16 */ _Unwind_Word unwind_exception_align[2]; + + /* total size (bytes): 32 */ + }; + + /* total size (bytes): 32 */ + } exc; +/* 1168 | 8 */ void *stackblock; +/* 1176 | 8 */ size_t stackblock_size; +/* 1184 | 8 */ size_t guardsize; +/* 1192 | 8 */ size_t reported_guardsize; +/* 1200 | 8 */ struct priority_protection_data *tpp; +/* 1208 | 568 */ struct __res_state { +/* 1208 | 4 */ int retrans; +/* 1212 | 4 */ int retry; +/* 1216 | 8 */ unsigned long options; +/* 1224 | 4 */ int nscount; +/* 1228 | 48 */ struct sockaddr_in nsaddr_list[3]; +/* 1276 | 2 */ unsigned short id; +/* XXX 2-byte hole */ +/* 1280 | 56 */ char *dnsrch[7]; +/* 1336 | 256 */ char defdname[256]; +/* 1592 | 8 */ unsigned long pfcode; +/* 1600: 0 | 4 */ unsigned int ndots : 4; +/* 1600: 4 | 4 */ unsigned int nsort : 4; +/* 1601: 0 | 4 */ unsigned int ipv6_unavail : 1; +/* 1601: 1 | 4 */ unsigned int unused : 23; +/* 1604 | 80 */ struct { +/* 0 | 4 */ struct in_addr addr; +/* 4 | 4 */ uint32_t mask; + } sort_list[10]; +/* XXX 4-byte hole */ +/* 1688 | 8 */ void *__glibc_unused_qhook; +/* 1696 | 8 */ void *__glibc_unused_rhook; +/* 1704 | 4 */ int res_h_errno; +/* 1708 | 4 */ int _vcsock; +/* 1712 | 4 */ unsigned int _flags; +/* XXX 4-byte hole */ +/* 1720 | 56 */ union { +/* 52 */ char pad[52]; +/* 56 */ struct { +/* 1720 | 2 */ uint16_t nscount; +/* 1722 | 6 */ uint16_t nsmap[3]; +/* 1728 | 12 */ int nssocks[3]; +/* 1740 | 2 */ uint16_t nscount6; +/* 1742 | 2 */ uint16_t nsinit; +/* 1744 | 24 */ struct sockaddr_in6 *nsaddrs[3]; +/* 1768 | 8 */ unsigned long long __glibc_extension_index; + + /* total size (bytes): 56 */ + } _ext; + + /* total size (bytes): 56 */ + } _u; + + /* total size (bytes): 568 */ + } res; +/* 1776 | 8 */ internal_sigset_t sigmask; +/* 1784 | 8 */ struct rtld_catch *rtld_catch; +/* 1792 | 1 */ _Bool c11; +/* 1793 | 1 */ _Bool exiting; +/* XXX 2-byte hole */ +/* 1796 | 4 */ int exit_lock; +/* 1800 | 16 */ struct tls_internal_t { +/* 1800 | 8 */ char *strsignal_buf; +/* 1808 | 8 */ char *strerror_l_buf; + + /* total size (bytes): 16 */ + } tls_state; +/* 1816 | 8 */ void *getrandom_buf; +/* 1824 | 32 */ union { +/* 24 */ struct { +/* 1824 | 4 */ uint32_t cpu_id_start; +/* 1828 | 4 */ uint32_t cpu_id; +/* 1832 | 8 */ uint64_t rseq_cs; +/* 1840 | 4 */ uint32_t flags; +/* XXX 4-byte padding */ + + /* total size (bytes): 24 */ + }; +/* 32 */ char pad[32]; + + /* total size (bytes): 32 */ + } rseq_area; + + /* total size (bytes): 1856 */ + } diff --git a/ld-so-abi-ppc64le.baseline b/ld-so-abi-ppc64le.baseline new file mode 100644 index 0000000..5b1daae --- /dev/null +++ b/ld-so-abi-ppc64le.baseline @@ -0,0 +1,542 @@ +--- _rtld_global_ro --- +/* offset | size */ type = struct rtld_global_ro { +/* 0 | 4 */ int _dl_debug_mask; +/* XXX 4-byte hole */ +/* 8 | 8 */ const char *_dl_platform; +/* 16 | 8 */ size_t _dl_platformlen; +/* 24 | 8 */ size_t _dl_pagesize; +/* 32 | 8 */ size_t _dl_minsigstacksize; +/* 40 | 4 */ int _dl_inhibit_cache; +/* XXX 4-byte hole */ +/* 48 | 16 */ struct r_scope_elem { +/* 48 | 8 */ struct link_map **r_list; +/* 56 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } _dl_initial_searchlist; +/* 64 | 4 */ int _dl_clktck; +/* 68 | 4 */ int _dl_verbose; +/* 72 | 4 */ int _dl_debug_fd; +/* 76 | 4 */ int _dl_lazy; +/* 80 | 4 */ int _dl_bind_not; +/* 84 | 4 */ int _dl_dynamic_weak; +/* 88 | 4 */ fpu_control_t _dl_fpu_control; +/* XXX 4-byte hole */ +/* 96 | 8 */ uint64_t _dl_hwcap; +/* 104 | 8 */ Elf64_auxv_t *_dl_auxv; +/* 112 | 40 */ struct cpu_features { +/* 112 | 1 */ _Bool use_cached_memopt; +/* XXX 7-byte hole */ +/* 120 | 8 */ unsigned long hwcap; +/* 128 | 8 */ unsigned long hwcap2; +/* 136 | 8 */ unsigned long hwcap3; +/* 144 | 8 */ unsigned long hwcap4; + + /* total size (bytes): 40 */ + } _dl_powerpc_cpu_features; +/* 152 | 1920 */ const char _dl_powerpc_cap_flags[128][15]; +/* 2072 | 4 */ int _dl_cache_line_size; +/* XXX 4-byte hole */ +/* 2080 | 8 */ const char *_dl_inhibit_rpath; +/* 2088 | 8 */ const char *_dl_origin_path; +/* 2096 | 8 */ size_t _dl_tls_static_size; +/* 2104 | 8 */ size_t _dl_tls_static_align; +/* 2112 | 8 */ size_t _dl_tls_static_surplus; +/* 2120 | 8 */ const char *_dl_profile; +/* 2128 | 8 */ const char *_dl_profile_output; +/* 2136 | 8 */ struct r_search_path_elem *_dl_init_all_dirs; +/* 2144 | 8 */ const Elf64_Ehdr *_dl_sysinfo_dso; +/* 2152 | 8 */ struct link_map *_dl_sysinfo_map; +/* 2160 | 8 */ int (*_dl_vdso_clock_gettime64)(clockid_t, struct timespec *); +/* 2168 | 8 */ int (*_dl_vdso_gettimeofday)(struct timeval *, void *); +/* 2176 | 8 */ time_t (*_dl_vdso_time)(time_t *); +/* 2184 | 8 */ int (*_dl_vdso_getcpu)(unsigned int *, unsigned int *, void *); +/* 2192 | 8 */ int (*_dl_vdso_clock_getres_time64)(clockid_t, struct timespec *); +/* 2200 | 8 */ ssize_t (*_dl_vdso_getrandom)(void *, size_t, unsigned int, void *, size_t); +/* 2208 | 8 */ uint64_t (*_dl_vdso_get_tbfreq)(void); +/* 2216 | 8 */ uint64_t _dl_hwcap2; +/* 2224 | 8 */ uint64_t _dl_hwcap3; +/* 2232 | 8 */ uint64_t _dl_hwcap4; +/* 2240 | 4 */ enum dso_sort_algorithm _dl_dso_sort_algo; +/* XXX 4-byte hole */ +/* 2248 | 8 */ void (*_dl_debug_printf)(const char *, ...); +/* 2256 | 8 */ void (*_dl_mcount)(Elf64_Addr, Elf64_Addr); +/* 2264 | 8 */ lookup_t (*_dl_lookup_symbol_x)(const char *, struct link_map *, const Elf64_Sym **, struct r_scope_elem **, const struct r_found_version *, int, int, struct link_map *); +/* 2272 | 8 */ void *(*_dl_open)(const char *, int, const void *, Lmid_t, int, char **, char **); +/* 2280 | 8 */ void (*_dl_close)(void *); +/* 2288 | 8 */ int (*_dl_catch_error)(const char **, const char **, _Bool *, void (*)(void *), void *); +/* 2296 | 8 */ void (*_dl_error_free)(void *); +/* 2304 | 8 */ void *(*_dl_tls_get_addr_soft)(struct link_map *); +/* 2312 | 8 */ void (*_dl_libc_freeres)(void); +/* 2320 | 8 */ int (*_dl_find_object)(void *, struct dl_find_object *); +/* 2328 | 8 */ const struct dlfcn_hook *_dl_dlfcn_hook; +/* 2336 | 8 */ struct audit_ifaces *_dl_audit; +/* 2344 | 4 */ unsigned int _dl_naudit; +/* XXX 4-byte padding */ + + /* total size (bytes): 2352 */ + } +--- _rtld_global --- +/* offset | size */ type = struct rtld_global { +/* 0 | 2560 */ struct link_namespaces _dl_ns[16]; +/* 2560 | 8 */ size_t _dl_nns; +/* 2568 | 40 */ __rtld_lock_recursive_t _dl_load_lock; +/* 2608 | 40 */ __rtld_lock_recursive_t _dl_load_write_lock; +/* 2648 | 40 */ __rtld_lock_recursive_t _dl_load_tls_lock; +/* 2688 | 8 */ unsigned long long _dl_load_adds; +/* 2696 | 8 */ struct link_map *_dl_initfirst; +/* 2704 | 8 */ struct link_map *_dl_profile_map; +/* 2712 | 8 */ unsigned long _dl_num_relocations; +/* 2720 | 8 */ unsigned long _dl_num_cache_relocations; +/* 2728 | 8 */ struct r_search_path_elem *_dl_all_dirs; +/* 2736 | 1176 */ struct link_map { +/* 2736 | 8 */ Elf64_Addr l_addr; +/* 2744 | 8 */ char *l_name; +/* 2752 | 8 */ Elf64_Dyn *l_ld; +/* 2760 | 8 */ struct link_map *l_next; +/* 2768 | 8 */ struct link_map *l_prev; +/* 2776 | 8 */ struct link_map *l_real; +/* 2784 | 8 */ Lmid_t l_ns; +/* 2792 | 8 */ struct libname_list *l_libname; +/* 2800 | 672 */ Elf64_Dyn *l_info[84]; +/* 3472 | 8 */ const Elf64_Phdr *l_phdr; +/* 3480 | 8 */ Elf64_Addr l_entry; +/* 3488 | 2 */ Elf64_Half l_phnum; +/* 3490 | 2 */ Elf64_Half l_ldnum; +/* XXX 4-byte hole */ +/* 3496 | 16 */ struct r_scope_elem { +/* 3496 | 8 */ struct link_map **r_list; +/* 3504 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_searchlist; +/* 3512 | 16 */ struct r_scope_elem { +/* 3512 | 8 */ struct link_map **r_list; +/* 3520 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_symbolic_searchlist; +/* 3528 | 8 */ struct link_map *l_loader; +/* 3536 | 8 */ struct r_found_version *l_versions; +/* 3544 | 4 */ unsigned int l_nversions; +/* 3548 | 4 */ Elf_Symndx l_nbuckets; +/* 3552 | 4 */ Elf32_Word l_gnu_bitmask_idxbits; +/* 3556 | 4 */ Elf32_Word l_gnu_shift; +/* 3560 | 8 */ const Elf64_Addr *l_gnu_bitmask; +/* 3568 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_buckets; +/* 8 */ const Elf_Symndx *l_chain; + + /* total size (bytes): 8 */ + }; +/* 3576 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_chain_zero; +/* 8 */ const Elf_Symndx *l_buckets; + + /* total size (bytes): 8 */ + }; +/* 3584 | 4 */ unsigned int l_direct_opencount; +/* 3588: 0 | 4 */ enum {lt_executable, lt_library, lt_loaded} l_type : 2; +/* 3588: 2 | 4 */ unsigned int l_dt_relr_ref : 1; +/* 3588: 3 | 4 */ unsigned int l_relocated : 1; +/* 3588: 4 | 4 */ unsigned int l_init_called : 1; +/* 3588: 5 | 4 */ unsigned int l_global : 1; +/* 3588: 6 | 4 */ unsigned int l_reserved : 2; +/* 3589: 0 | 4 */ unsigned int l_main_map : 1; +/* 3589: 1 | 4 */ unsigned int l_visited : 1; +/* 3589: 2 | 4 */ unsigned int l_map_used : 1; +/* 3589: 3 | 4 */ unsigned int l_map_done : 1; +/* 3589: 4 | 4 */ unsigned int l_phdr_allocated : 1; +/* 3589: 5 | 4 */ unsigned int l_soname_added : 1; +/* 3589: 6 | 4 */ unsigned int l_faked : 1; +/* 3589: 7 | 4 */ unsigned int l_need_tls_init : 1; +/* 3590: 0 | 4 */ unsigned int l_auditing : 1; +/* 3590: 1 | 4 */ unsigned int l_audit_any_plt : 1; +/* 3590: 2 | 4 */ unsigned int l_removed : 1; +/* 3590: 3 | 4 */ unsigned int l_contiguous : 1; +/* 3590: 4 | 4 */ unsigned int l_free_initfini : 1; +/* 3590: 5 | 4 */ unsigned int l_ld_readonly : 1; +/* 3590: 6 | 4 */ unsigned int l_find_object_processed : 1; +/* 3590: 7 | 4 */ unsigned int l_tls_in_slotinfo : 1; +/* 3591 | 1 */ _Bool l_nodelete_active; +/* 3592 | 1 */ _Bool l_nodelete_pending; +/* XXX 3-byte hole */ +/* 3596 | 4 */ unsigned int l_1_needed; +/* 3600 | 16 */ struct r_search_path_struct { +/* 3600 | 8 */ struct r_search_path_elem **dirs; +/* 3608 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_rpath_dirs; +/* 3616 | 8 */ struct reloc_result *l_reloc_result; +/* 3624 | 8 */ Elf64_Versym *l_versyms; +/* 3632 | 8 */ const char *l_origin; +/* 3640 | 8 */ Elf64_Addr l_map_start; +/* 3648 | 8 */ Elf64_Addr l_map_end; +/* 3656 | 32 */ struct r_scope_elem *l_scope_mem[4]; +/* 3688 | 8 */ size_t l_scope_max; +/* 3696 | 8 */ struct r_scope_elem **l_scope; +/* 3704 | 16 */ struct r_scope_elem *l_local_scope[2]; +/* 3720 | 16 */ struct r_file_id { +/* 3720 | 8 */ dev_t dev; +/* 3728 | 8 */ ino64_t ino; + + /* total size (bytes): 16 */ + } l_file_id; +/* 3736 | 16 */ struct r_search_path_struct { +/* 3736 | 8 */ struct r_search_path_elem **dirs; +/* 3744 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_runpath_dirs; +/* 3752 | 8 */ struct link_map **l_initfini; +/* 3760 | 8 */ struct link_map_reldeps *l_reldeps; +/* 3768 | 4 */ unsigned int l_reldepsmax; +/* 3772 | 4 */ unsigned int l_used; +/* 3776 | 4 */ Elf64_Word l_feature_1; +/* 3780 | 4 */ Elf64_Word l_flags_1; +/* 3784 | 4 */ Elf64_Word l_flags; +/* 3788 | 4 */ int l_idx; +/* 3792 | 0 */ struct link_map_machine { + + + /* total size (bytes): 0 */ + } l_mach; +/* 3792 | 32 */ struct { +/* 3792 | 8 */ const Elf64_Sym *sym; +/* 3800 | 4 */ int type_class; +/* XXX 4-byte hole */ +/* 3808 | 8 */ struct link_map *value; +/* 3816 | 8 */ const Elf64_Sym *ret; + + /* total size (bytes): 32 */ + } l_lookup_cache; +/* 3824 | 8 */ void *l_tls_initimage; +/* 3832 | 8 */ size_t l_tls_initimage_size; +/* 3840 | 8 */ size_t l_tls_blocksize; +/* 3848 | 8 */ size_t l_tls_align; +/* 3856 | 8 */ size_t l_tls_firstbyte_offset; +/* 3864 | 8 */ ptrdiff_t l_tls_offset; +/* 3872 | 8 */ size_t l_tls_modid; +/* 3880 | 8 */ size_t l_tls_dtor_count; +/* 3888 | 8 */ Elf64_Addr l_relro_addr; +/* 3896 | 8 */ size_t l_relro_size; +/* 3904 | 8 */ unsigned long long l_serial; + + /* total size (bytes): 1176 */ + } _dl_rtld_map; +/* 3912 | 256 */ struct auditstate _dl_rtld_auditstate[16]; +/* 4168 | 4 */ Elf64_Word _dl_stack_flags; +/* 4172 | 1 */ _Bool _dl_tls_dtv_gaps; +/* XXX 3-byte hole */ +/* 4176 | 8 */ size_t _dl_tls_max_dtv_idx; +/* 4184 | 8 */ struct dtv_slotinfo_list *_dl_tls_dtv_slotinfo_list; +/* 4192 | 8 */ size_t _dl_tls_static_nelem; +/* 4200 | 8 */ size_t _dl_tls_static_used; +/* 4208 | 8 */ size_t _dl_tls_static_optional; +/* 4216 | 8 */ void *_dl_initial_dtv; +/* 4224 | 8 */ size_t _dl_tls_generation; +/* 4232 | 8 */ struct dl_scope_free_list *_dl_scope_free_list; +/* 4240 | 16 */ list_t _dl_stack_used; +/* 4256 | 16 */ list_t _dl_stack_user; +/* 4272 | 16 */ list_t _dl_stack_cache; +/* 4288 | 8 */ size_t _dl_stack_cache_actsize; +/* 4296 | 8 */ uintptr_t _dl_in_flight_stack; +/* 4304 | 4 */ int _dl_stack_cache_lock; +/* XXX 4-byte padding */ + + /* total size (bytes): 4312 */ + } +--- struct link_map --- +/* offset | size */ type = struct link_map { +/* 0 | 8 */ Elf64_Addr l_addr; +/* 8 | 8 */ char *l_name; +/* 16 | 8 */ Elf64_Dyn *l_ld; +/* 24 | 8 */ struct link_map *l_next; +/* 32 | 8 */ struct link_map *l_prev; +/* 40 | 8 */ struct link_map *l_real; +/* 48 | 8 */ Lmid_t l_ns; +/* 56 | 8 */ struct libname_list *l_libname; +/* 64 | 672 */ Elf64_Dyn *l_info[84]; +/* 736 | 8 */ const Elf64_Phdr *l_phdr; +/* 744 | 8 */ Elf64_Addr l_entry; +/* 752 | 2 */ Elf64_Half l_phnum; +/* 754 | 2 */ Elf64_Half l_ldnum; +/* XXX 4-byte hole */ +/* 760 | 16 */ struct r_scope_elem { +/* 760 | 8 */ struct link_map **r_list; +/* 768 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_searchlist; +/* 776 | 16 */ struct r_scope_elem { +/* 776 | 8 */ struct link_map **r_list; +/* 784 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_symbolic_searchlist; +/* 792 | 8 */ struct link_map *l_loader; +/* 800 | 8 */ struct r_found_version *l_versions; +/* 808 | 4 */ unsigned int l_nversions; +/* 812 | 4 */ Elf_Symndx l_nbuckets; +/* 816 | 4 */ Elf32_Word l_gnu_bitmask_idxbits; +/* 820 | 4 */ Elf32_Word l_gnu_shift; +/* 824 | 8 */ const Elf64_Addr *l_gnu_bitmask; +/* 832 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_buckets; +/* 8 */ const Elf_Symndx *l_chain; + + /* total size (bytes): 8 */ + }; +/* 840 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_chain_zero; +/* 8 */ const Elf_Symndx *l_buckets; + + /* total size (bytes): 8 */ + }; +/* 848 | 4 */ unsigned int l_direct_opencount; +/* 852: 0 | 4 */ enum {lt_executable, lt_library, lt_loaded} l_type : 2; +/* 852: 2 | 4 */ unsigned int l_dt_relr_ref : 1; +/* 852: 3 | 4 */ unsigned int l_relocated : 1; +/* 852: 4 | 4 */ unsigned int l_init_called : 1; +/* 852: 5 | 4 */ unsigned int l_global : 1; +/* 852: 6 | 4 */ unsigned int l_reserved : 2; +/* 853: 0 | 4 */ unsigned int l_main_map : 1; +/* 853: 1 | 4 */ unsigned int l_visited : 1; +/* 853: 2 | 4 */ unsigned int l_map_used : 1; +/* 853: 3 | 4 */ unsigned int l_map_done : 1; +/* 853: 4 | 4 */ unsigned int l_phdr_allocated : 1; +/* 853: 5 | 4 */ unsigned int l_soname_added : 1; +/* 853: 6 | 4 */ unsigned int l_faked : 1; +/* 853: 7 | 4 */ unsigned int l_need_tls_init : 1; +/* 854: 0 | 4 */ unsigned int l_auditing : 1; +/* 854: 1 | 4 */ unsigned int l_audit_any_plt : 1; +/* 854: 2 | 4 */ unsigned int l_removed : 1; +/* 854: 3 | 4 */ unsigned int l_contiguous : 1; +/* 854: 4 | 4 */ unsigned int l_free_initfini : 1; +/* 854: 5 | 4 */ unsigned int l_ld_readonly : 1; +/* 854: 6 | 4 */ unsigned int l_find_object_processed : 1; +/* 854: 7 | 4 */ unsigned int l_tls_in_slotinfo : 1; +/* 855 | 1 */ _Bool l_nodelete_active; +/* 856 | 1 */ _Bool l_nodelete_pending; +/* XXX 3-byte hole */ +/* 860 | 4 */ unsigned int l_1_needed; +/* 864 | 16 */ struct r_search_path_struct { +/* 864 | 8 */ struct r_search_path_elem **dirs; +/* 872 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_rpath_dirs; +/* 880 | 8 */ struct reloc_result *l_reloc_result; +/* 888 | 8 */ Elf64_Versym *l_versyms; +/* 896 | 8 */ const char *l_origin; +/* 904 | 8 */ Elf64_Addr l_map_start; +/* 912 | 8 */ Elf64_Addr l_map_end; +/* 920 | 32 */ struct r_scope_elem *l_scope_mem[4]; +/* 952 | 8 */ size_t l_scope_max; +/* 960 | 8 */ struct r_scope_elem **l_scope; +/* 968 | 16 */ struct r_scope_elem *l_local_scope[2]; +/* 984 | 16 */ struct r_file_id { +/* 984 | 8 */ dev_t dev; +/* 992 | 8 */ ino64_t ino; + + /* total size (bytes): 16 */ + } l_file_id; +/* 1000 | 16 */ struct r_search_path_struct { +/* 1000 | 8 */ struct r_search_path_elem **dirs; +/* 1008 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_runpath_dirs; +/* 1016 | 8 */ struct link_map **l_initfini; +/* 1024 | 8 */ struct link_map_reldeps *l_reldeps; +/* 1032 | 4 */ unsigned int l_reldepsmax; +/* 1036 | 4 */ unsigned int l_used; +/* 1040 | 4 */ Elf64_Word l_feature_1; +/* 1044 | 4 */ Elf64_Word l_flags_1; +/* 1048 | 4 */ Elf64_Word l_flags; +/* 1052 | 4 */ int l_idx; +/* 1056 | 0 */ struct link_map_machine { + + + /* total size (bytes): 0 */ + } l_mach; +/* 1056 | 32 */ struct { +/* 1056 | 8 */ const Elf64_Sym *sym; +/* 1064 | 4 */ int type_class; +/* XXX 4-byte hole */ +/* 1072 | 8 */ struct link_map *value; +/* 1080 | 8 */ const Elf64_Sym *ret; + + /* total size (bytes): 32 */ + } l_lookup_cache; +/* 1088 | 8 */ void *l_tls_initimage; +/* 1096 | 8 */ size_t l_tls_initimage_size; +/* 1104 | 8 */ size_t l_tls_blocksize; +/* 1112 | 8 */ size_t l_tls_align; +/* 1120 | 8 */ size_t l_tls_firstbyte_offset; +/* 1128 | 8 */ ptrdiff_t l_tls_offset; +/* 1136 | 8 */ size_t l_tls_modid; +/* 1144 | 8 */ size_t l_tls_dtor_count; +/* 1152 | 8 */ Elf64_Addr l_relro_addr; +/* 1160 | 8 */ size_t l_relro_size; +/* 1168 | 8 */ unsigned long long l_serial; + + /* total size (bytes): 1176 */ + } +--- struct pthread --- +/* offset | size */ type = struct pthread { +/* 0 | 192 */ union { +/* 8 */ struct { +/* 0 | 4 */ int multiple_threads; +/* 4 | 4 */ int gscope_flag; + + /* total size (bytes): 8 */ + } header; +/* 192 */ void *__padding[24]; + + /* total size (bytes): 192 */ + }; +/* 192 | 16 */ list_t list; +/* 208 | 4 */ pid_t tid; +/* XXX 4-byte hole */ +/* 216 | 8 */ void *robust_prev; +/* 224 | 24 */ struct robust_list_head { +/* 224 | 8 */ void *list; +/* 232 | 8 */ long futex_offset; +/* 240 | 8 */ void *list_op_pending; + + /* total size (bytes): 24 */ + } robust_head; +/* 248 | 8 */ struct _pthread_cleanup_buffer *cleanup; +/* 256 | 8 */ struct pthread_unwind_buf *cleanup_jmp_buf; +/* 264 | 4 */ int cancelhandling; +/* 268 | 4 */ int flags; +/* 272 | 512 */ struct pthread_key_data specific_1stblock[32]; +/* 784 | 256 */ struct pthread_key_data *specific[32]; +/* 1040 | 1 */ _Bool specific_used; +/* 1041 | 1 */ _Bool report_events; +/* 1042 | 1 */ _Bool user_stack; +/* 1043 | 1 */ _Bool stopped_start; +/* 1044 | 4 */ int setup_failed; +/* 1048 | 4 */ int lock; +/* 1052 | 4 */ unsigned int setxid_futex; +/* 1056 | 8 */ struct pthread *joinid; +/* 1064 | 8 */ void *result; +/* 1072 | 4 */ struct sched_param { +/* 1072 | 4 */ int sched_priority; + + /* total size (bytes): 4 */ + } schedparam; +/* 1076 | 4 */ int schedpolicy; +/* 1080 | 8 */ void *(*start_routine)(void *); +/* 1088 | 8 */ void *arg; +/* 1096 | 24 */ td_eventbuf_t eventbuf; +/* 1120 | 8 */ struct pthread *nextevent; +/* XXX 8-byte hole */ +/* 1136 | 32 */ struct _Unwind_Exception { +/* 1136 | 32 */ union { +/* 32 */ struct { +/* 1136 | 8 */ _Unwind_Exception_Class exception_class; +/* 1144 | 8 */ _Unwind_Exception_Cleanup_Fn exception_cleanup; +/* 1152 | 8 */ _Unwind_Word private_1; +/* 1160 | 8 */ _Unwind_Word private_2; + + /* total size (bytes): 32 */ + }; +/* 16 */ _Unwind_Word unwind_exception_align[2]; + + /* total size (bytes): 32 */ + }; + + /* total size (bytes): 32 */ + } exc; +/* 1168 | 8 */ void *stackblock; +/* 1176 | 8 */ size_t stackblock_size; +/* 1184 | 8 */ size_t guardsize; +/* 1192 | 8 */ size_t reported_guardsize; +/* 1200 | 8 */ struct priority_protection_data *tpp; +/* 1208 | 568 */ struct __res_state { +/* 1208 | 4 */ int retrans; +/* 1212 | 4 */ int retry; +/* 1216 | 8 */ unsigned long options; +/* 1224 | 4 */ int nscount; +/* 1228 | 48 */ struct sockaddr_in nsaddr_list[3]; +/* 1276 | 2 */ unsigned short id; +/* XXX 2-byte hole */ +/* 1280 | 56 */ char *dnsrch[7]; +/* 1336 | 256 */ char defdname[256]; +/* 1592 | 8 */ unsigned long pfcode; +/* 1600: 0 | 4 */ unsigned int ndots : 4; +/* 1600: 4 | 4 */ unsigned int nsort : 4; +/* 1601: 0 | 4 */ unsigned int ipv6_unavail : 1; +/* 1601: 1 | 4 */ unsigned int unused : 23; +/* 1604 | 80 */ struct { +/* 0 | 4 */ struct in_addr addr; +/* 4 | 4 */ uint32_t mask; + } sort_list[10]; +/* XXX 4-byte hole */ +/* 1688 | 8 */ void *__glibc_unused_qhook; +/* 1696 | 8 */ void *__glibc_unused_rhook; +/* 1704 | 4 */ int res_h_errno; +/* 1708 | 4 */ int _vcsock; +/* 1712 | 4 */ unsigned int _flags; +/* XXX 4-byte hole */ +/* 1720 | 56 */ union { +/* 52 */ char pad[52]; +/* 56 */ struct { +/* 1720 | 2 */ uint16_t nscount; +/* 1722 | 6 */ uint16_t nsmap[3]; +/* 1728 | 12 */ int nssocks[3]; +/* 1740 | 2 */ uint16_t nscount6; +/* 1742 | 2 */ uint16_t nsinit; +/* 1744 | 24 */ struct sockaddr_in6 *nsaddrs[3]; +/* 1768 | 8 */ unsigned long long __glibc_extension_index; + + /* total size (bytes): 56 */ + } _ext; + + /* total size (bytes): 56 */ + } _u; + + /* total size (bytes): 568 */ + } res; +/* 1776 | 8 */ internal_sigset_t sigmask; +/* 1784 | 8 */ struct rtld_catch *rtld_catch; +/* 1792 | 1 */ _Bool c11; +/* 1793 | 1 */ _Bool exiting; +/* XXX 2-byte hole */ +/* 1796 | 4 */ int exit_lock; +/* 1800 | 16 */ struct tls_internal_t { +/* 1800 | 8 */ char *strsignal_buf; +/* 1808 | 8 */ char *strerror_l_buf; + + /* total size (bytes): 16 */ + } tls_state; +/* 1816 | 8 */ void *getrandom_buf; +/* 1824 | 32 */ union { +/* 24 */ struct { +/* 1824 | 4 */ uint32_t cpu_id_start; +/* 1828 | 4 */ uint32_t cpu_id; +/* 1832 | 8 */ uint64_t rseq_cs; +/* 1840 | 4 */ uint32_t flags; +/* XXX 4-byte padding */ + + /* total size (bytes): 24 */ + }; +/* 32 */ char pad[32]; + + /* total size (bytes): 32 */ + } rseq_area; + + /* total size (bytes): 1856 */ + } diff --git a/ld-so-abi-riscv64.baseline b/ld-so-abi-riscv64.baseline new file mode 100644 index 0000000..6595d04 --- /dev/null +++ b/ld-so-abi-riscv64.baseline @@ -0,0 +1,526 @@ +--- _rtld_global_ro --- +/* offset | size */ type = struct rtld_global_ro { +/* 0 | 4 */ int _dl_debug_mask; +/* XXX 4-byte hole */ +/* 8 | 8 */ const char *_dl_platform; +/* 16 | 8 */ size_t _dl_platformlen; +/* 24 | 8 */ size_t _dl_pagesize; +/* 32 | 8 */ size_t _dl_minsigstacksize; +/* 40 | 4 */ int _dl_inhibit_cache; +/* XXX 4-byte hole */ +/* 48 | 16 */ struct r_scope_elem { +/* 48 | 8 */ struct link_map **r_list; +/* 56 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } _dl_initial_searchlist; +/* 64 | 4 */ int _dl_clktck; +/* 68 | 4 */ int _dl_verbose; +/* 72 | 4 */ int _dl_debug_fd; +/* 76 | 4 */ int _dl_lazy; +/* 80 | 4 */ int _dl_bind_not; +/* 84 | 4 */ int _dl_dynamic_weak; +/* 88 | 4 */ fpu_control_t _dl_fpu_control; +/* XXX 4-byte hole */ +/* 96 | 8 */ uint64_t _dl_hwcap; +/* 104 | 8 */ Elf64_auxv_t *_dl_auxv; +/* 112 | 8 */ const char *_dl_inhibit_rpath; +/* 120 | 8 */ const char *_dl_origin_path; +/* 128 | 8 */ size_t _dl_tls_static_size; +/* 136 | 8 */ size_t _dl_tls_static_align; +/* 144 | 8 */ size_t _dl_tls_static_surplus; +/* 152 | 8 */ const char *_dl_profile; +/* 160 | 8 */ const char *_dl_profile_output; +/* 168 | 8 */ struct r_search_path_elem *_dl_init_all_dirs; +/* 176 | 8 */ const Elf64_Ehdr *_dl_sysinfo_dso; +/* 184 | 8 */ struct link_map *_dl_sysinfo_map; +/* 192 | 8 */ int (*_dl_vdso_clock_gettime64)(clockid_t, struct timespec *); +/* 200 | 8 */ int (*_dl_vdso_gettimeofday)(struct timeval *, void *); +/* 208 | 8 */ int (*_dl_vdso_getcpu)(unsigned int *, unsigned int *, void *); +/* 216 | 8 */ int (*_dl_vdso_clock_getres_time64)(clockid_t, struct timespec *); +/* 224 | 8 */ uint64_t _dl_hwcap2; +/* 232 | 8 */ uint64_t _dl_hwcap3; +/* 240 | 8 */ uint64_t _dl_hwcap4; +/* 248 | 4 */ enum dso_sort_algorithm _dl_dso_sort_algo; +/* XXX 4-byte hole */ +/* 256 | 8 */ void (*_dl_debug_printf)(const char *, ...); +/* 264 | 8 */ void (*_dl_mcount)(Elf64_Addr, Elf64_Addr); +/* 272 | 8 */ lookup_t (*_dl_lookup_symbol_x)(const char *, struct link_map *, const Elf64_Sym **, struct r_scope_elem **, const struct r_found_version *, int, int, struct link_map *); +/* 280 | 8 */ void *(*_dl_open)(const char *, int, const void *, Lmid_t, int, char **, char **); +/* 288 | 8 */ void (*_dl_close)(void *); +/* 296 | 8 */ int (*_dl_catch_error)(const char **, const char **, _Bool *, void (*)(void *), void *); +/* 304 | 8 */ void (*_dl_error_free)(void *); +/* 312 | 8 */ void *(*_dl_tls_get_addr_soft)(struct link_map *); +/* 320 | 8 */ void (*_dl_libc_freeres)(void); +/* 328 | 8 */ int (*_dl_find_object)(void *, struct dl_find_object *); +/* 336 | 8 */ const struct dlfcn_hook *_dl_dlfcn_hook; +/* 344 | 8 */ struct audit_ifaces *_dl_audit; +/* 352 | 4 */ unsigned int _dl_naudit; +/* XXX 4-byte padding */ + + /* total size (bytes): 360 */ + } +--- _rtld_global --- +/* offset | size */ type = struct rtld_global { +/* 0 | 2560 */ struct link_namespaces _dl_ns[16]; +/* 2560 | 8 */ size_t _dl_nns; +/* 2568 | 40 */ __rtld_lock_recursive_t _dl_load_lock; +/* 2608 | 40 */ __rtld_lock_recursive_t _dl_load_write_lock; +/* 2648 | 40 */ __rtld_lock_recursive_t _dl_load_tls_lock; +/* 2688 | 8 */ unsigned long long _dl_load_adds; +/* 2696 | 8 */ struct link_map *_dl_initfirst; +/* 2704 | 8 */ struct link_map *_dl_profile_map; +/* 2712 | 8 */ unsigned long _dl_num_relocations; +/* 2720 | 8 */ unsigned long _dl_num_cache_relocations; +/* 2728 | 8 */ struct r_search_path_elem *_dl_all_dirs; +/* 2736 | 1152 */ struct link_map { +/* 2736 | 8 */ Elf64_Addr l_addr; +/* 2744 | 8 */ char *l_name; +/* 2752 | 8 */ Elf64_Dyn *l_ld; +/* 2760 | 8 */ struct link_map *l_next; +/* 2768 | 8 */ struct link_map *l_prev; +/* 2776 | 8 */ struct link_map *l_real; +/* 2784 | 8 */ Lmid_t l_ns; +/* 2792 | 8 */ struct libname_list *l_libname; +/* 2800 | 640 */ Elf64_Dyn *l_info[80]; +/* 3440 | 8 */ const Elf64_Phdr *l_phdr; +/* 3448 | 8 */ Elf64_Addr l_entry; +/* 3456 | 2 */ Elf64_Half l_phnum; +/* 3458 | 2 */ Elf64_Half l_ldnum; +/* XXX 4-byte hole */ +/* 3464 | 16 */ struct r_scope_elem { +/* 3464 | 8 */ struct link_map **r_list; +/* 3472 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_searchlist; +/* 3480 | 16 */ struct r_scope_elem { +/* 3480 | 8 */ struct link_map **r_list; +/* 3488 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_symbolic_searchlist; +/* 3496 | 8 */ struct link_map *l_loader; +/* 3504 | 8 */ struct r_found_version *l_versions; +/* 3512 | 4 */ unsigned int l_nversions; +/* 3516 | 4 */ Elf_Symndx l_nbuckets; +/* 3520 | 4 */ Elf32_Word l_gnu_bitmask_idxbits; +/* 3524 | 4 */ Elf32_Word l_gnu_shift; +/* 3528 | 8 */ const Elf64_Addr *l_gnu_bitmask; +/* 3536 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_buckets; +/* 8 */ const Elf_Symndx *l_chain; + + /* total size (bytes): 8 */ + }; +/* 3544 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_chain_zero; +/* 8 */ const Elf_Symndx *l_buckets; + + /* total size (bytes): 8 */ + }; +/* 3552 | 4 */ unsigned int l_direct_opencount; +/* 3556: 0 | 4 */ enum {lt_executable, lt_library, lt_loaded} l_type : 2; +/* 3556: 2 | 4 */ unsigned int l_dt_relr_ref : 1; +/* 3556: 3 | 4 */ unsigned int l_relocated : 1; +/* 3556: 4 | 4 */ unsigned int l_init_called : 1; +/* 3556: 5 | 4 */ unsigned int l_global : 1; +/* 3556: 6 | 4 */ unsigned int l_reserved : 2; +/* 3557: 0 | 4 */ unsigned int l_main_map : 1; +/* 3557: 1 | 4 */ unsigned int l_visited : 1; +/* 3557: 2 | 4 */ unsigned int l_map_used : 1; +/* 3557: 3 | 4 */ unsigned int l_map_done : 1; +/* 3557: 4 | 4 */ unsigned int l_phdr_allocated : 1; +/* 3557: 5 | 4 */ unsigned int l_soname_added : 1; +/* 3557: 6 | 4 */ unsigned int l_faked : 1; +/* 3557: 7 | 4 */ unsigned int l_need_tls_init : 1; +/* 3558: 0 | 4 */ unsigned int l_auditing : 1; +/* 3558: 1 | 4 */ unsigned int l_audit_any_plt : 1; +/* 3558: 2 | 4 */ unsigned int l_removed : 1; +/* 3558: 3 | 4 */ unsigned int l_contiguous : 1; +/* 3558: 4 | 4 */ unsigned int l_free_initfini : 1; +/* 3558: 5 | 4 */ unsigned int l_ld_readonly : 1; +/* 3558: 6 | 4 */ unsigned int l_find_object_processed : 1; +/* 3558: 7 | 4 */ unsigned int l_tls_in_slotinfo : 1; +/* 3559 | 1 */ _Bool l_nodelete_active; +/* 3560 | 1 */ _Bool l_nodelete_pending; +/* XXX 3-byte hole */ +/* 3564 | 4 */ unsigned int l_1_needed; +/* 3568 | 16 */ struct r_search_path_struct { +/* 3568 | 8 */ struct r_search_path_elem **dirs; +/* 3576 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_rpath_dirs; +/* 3584 | 8 */ struct reloc_result *l_reloc_result; +/* 3592 | 8 */ Elf64_Versym *l_versyms; +/* 3600 | 8 */ const char *l_origin; +/* 3608 | 8 */ Elf64_Addr l_map_start; +/* 3616 | 8 */ Elf64_Addr l_map_end; +/* 3624 | 32 */ struct r_scope_elem *l_scope_mem[4]; +/* 3656 | 8 */ size_t l_scope_max; +/* 3664 | 8 */ struct r_scope_elem **l_scope; +/* 3672 | 16 */ struct r_scope_elem *l_local_scope[2]; +/* 3688 | 16 */ struct r_file_id { +/* 3688 | 8 */ dev_t dev; +/* 3696 | 8 */ ino64_t ino; + + /* total size (bytes): 16 */ + } l_file_id; +/* 3704 | 16 */ struct r_search_path_struct { +/* 3704 | 8 */ struct r_search_path_elem **dirs; +/* 3712 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_runpath_dirs; +/* 3720 | 8 */ struct link_map **l_initfini; +/* 3728 | 8 */ struct link_map_reldeps *l_reldeps; +/* 3736 | 4 */ unsigned int l_reldepsmax; +/* 3740 | 4 */ unsigned int l_used; +/* 3744 | 4 */ Elf64_Word l_feature_1; +/* 3748 | 4 */ Elf64_Word l_flags_1; +/* 3752 | 4 */ Elf64_Word l_flags; +/* 3756 | 4 */ int l_idx; +/* 3760 | 8 */ struct link_map_machine { +/* 3760 | 8 */ Elf64_Addr plt; + + /* total size (bytes): 8 */ + } l_mach; +/* 3768 | 32 */ struct { +/* 3768 | 8 */ const Elf64_Sym *sym; +/* 3776 | 4 */ int type_class; +/* XXX 4-byte hole */ +/* 3784 | 8 */ struct link_map *value; +/* 3792 | 8 */ const Elf64_Sym *ret; + + /* total size (bytes): 32 */ + } l_lookup_cache; +/* 3800 | 8 */ void *l_tls_initimage; +/* 3808 | 8 */ size_t l_tls_initimage_size; +/* 3816 | 8 */ size_t l_tls_blocksize; +/* 3824 | 8 */ size_t l_tls_align; +/* 3832 | 8 */ size_t l_tls_firstbyte_offset; +/* 3840 | 8 */ ptrdiff_t l_tls_offset; +/* 3848 | 8 */ size_t l_tls_modid; +/* 3856 | 8 */ size_t l_tls_dtor_count; +/* 3864 | 8 */ Elf64_Addr l_relro_addr; +/* 3872 | 8 */ size_t l_relro_size; +/* 3880 | 8 */ unsigned long long l_serial; + + /* total size (bytes): 1152 */ + } _dl_rtld_map; +/* 3888 | 256 */ struct auditstate _dl_rtld_auditstate[16]; +/* 4144 | 4 */ Elf64_Word _dl_stack_flags; +/* 4148 | 1 */ _Bool _dl_tls_dtv_gaps; +/* XXX 3-byte hole */ +/* 4152 | 8 */ size_t _dl_tls_max_dtv_idx; +/* 4160 | 8 */ struct dtv_slotinfo_list *_dl_tls_dtv_slotinfo_list; +/* 4168 | 8 */ size_t _dl_tls_static_nelem; +/* 4176 | 8 */ size_t _dl_tls_static_used; +/* 4184 | 8 */ size_t _dl_tls_static_optional; +/* 4192 | 8 */ void *_dl_initial_dtv; +/* 4200 | 8 */ size_t _dl_tls_generation; +/* 4208 | 8 */ struct dl_scope_free_list *_dl_scope_free_list; +/* 4216 | 16 */ list_t _dl_stack_used; +/* 4232 | 16 */ list_t _dl_stack_user; +/* 4248 | 16 */ list_t _dl_stack_cache; +/* 4264 | 8 */ size_t _dl_stack_cache_actsize; +/* 4272 | 8 */ uintptr_t _dl_in_flight_stack; +/* 4280 | 4 */ int _dl_stack_cache_lock; +/* XXX 4-byte padding */ + + /* total size (bytes): 4288 */ + } +--- struct link_map --- +/* offset | size */ type = struct link_map { +/* 0 | 8 */ Elf64_Addr l_addr; +/* 8 | 8 */ char *l_name; +/* 16 | 8 */ Elf64_Dyn *l_ld; +/* 24 | 8 */ struct link_map *l_next; +/* 32 | 8 */ struct link_map *l_prev; +/* 40 | 8 */ struct link_map *l_real; +/* 48 | 8 */ Lmid_t l_ns; +/* 56 | 8 */ struct libname_list *l_libname; +/* 64 | 640 */ Elf64_Dyn *l_info[80]; +/* 704 | 8 */ const Elf64_Phdr *l_phdr; +/* 712 | 8 */ Elf64_Addr l_entry; +/* 720 | 2 */ Elf64_Half l_phnum; +/* 722 | 2 */ Elf64_Half l_ldnum; +/* XXX 4-byte hole */ +/* 728 | 16 */ struct r_scope_elem { +/* 728 | 8 */ struct link_map **r_list; +/* 736 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_searchlist; +/* 744 | 16 */ struct r_scope_elem { +/* 744 | 8 */ struct link_map **r_list; +/* 752 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_symbolic_searchlist; +/* 760 | 8 */ struct link_map *l_loader; +/* 768 | 8 */ struct r_found_version *l_versions; +/* 776 | 4 */ unsigned int l_nversions; +/* 780 | 4 */ Elf_Symndx l_nbuckets; +/* 784 | 4 */ Elf32_Word l_gnu_bitmask_idxbits; +/* 788 | 4 */ Elf32_Word l_gnu_shift; +/* 792 | 8 */ const Elf64_Addr *l_gnu_bitmask; +/* 800 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_buckets; +/* 8 */ const Elf_Symndx *l_chain; + + /* total size (bytes): 8 */ + }; +/* 808 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_chain_zero; +/* 8 */ const Elf_Symndx *l_buckets; + + /* total size (bytes): 8 */ + }; +/* 816 | 4 */ unsigned int l_direct_opencount; +/* 820: 0 | 4 */ enum {lt_executable, lt_library, lt_loaded} l_type : 2; +/* 820: 2 | 4 */ unsigned int l_dt_relr_ref : 1; +/* 820: 3 | 4 */ unsigned int l_relocated : 1; +/* 820: 4 | 4 */ unsigned int l_init_called : 1; +/* 820: 5 | 4 */ unsigned int l_global : 1; +/* 820: 6 | 4 */ unsigned int l_reserved : 2; +/* 821: 0 | 4 */ unsigned int l_main_map : 1; +/* 821: 1 | 4 */ unsigned int l_visited : 1; +/* 821: 2 | 4 */ unsigned int l_map_used : 1; +/* 821: 3 | 4 */ unsigned int l_map_done : 1; +/* 821: 4 | 4 */ unsigned int l_phdr_allocated : 1; +/* 821: 5 | 4 */ unsigned int l_soname_added : 1; +/* 821: 6 | 4 */ unsigned int l_faked : 1; +/* 821: 7 | 4 */ unsigned int l_need_tls_init : 1; +/* 822: 0 | 4 */ unsigned int l_auditing : 1; +/* 822: 1 | 4 */ unsigned int l_audit_any_plt : 1; +/* 822: 2 | 4 */ unsigned int l_removed : 1; +/* 822: 3 | 4 */ unsigned int l_contiguous : 1; +/* 822: 4 | 4 */ unsigned int l_free_initfini : 1; +/* 822: 5 | 4 */ unsigned int l_ld_readonly : 1; +/* 822: 6 | 4 */ unsigned int l_find_object_processed : 1; +/* 822: 7 | 4 */ unsigned int l_tls_in_slotinfo : 1; +/* 823 | 1 */ _Bool l_nodelete_active; +/* 824 | 1 */ _Bool l_nodelete_pending; +/* XXX 3-byte hole */ +/* 828 | 4 */ unsigned int l_1_needed; +/* 832 | 16 */ struct r_search_path_struct { +/* 832 | 8 */ struct r_search_path_elem **dirs; +/* 840 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_rpath_dirs; +/* 848 | 8 */ struct reloc_result *l_reloc_result; +/* 856 | 8 */ Elf64_Versym *l_versyms; +/* 864 | 8 */ const char *l_origin; +/* 872 | 8 */ Elf64_Addr l_map_start; +/* 880 | 8 */ Elf64_Addr l_map_end; +/* 888 | 32 */ struct r_scope_elem *l_scope_mem[4]; +/* 920 | 8 */ size_t l_scope_max; +/* 928 | 8 */ struct r_scope_elem **l_scope; +/* 936 | 16 */ struct r_scope_elem *l_local_scope[2]; +/* 952 | 16 */ struct r_file_id { +/* 952 | 8 */ dev_t dev; +/* 960 | 8 */ ino64_t ino; + + /* total size (bytes): 16 */ + } l_file_id; +/* 968 | 16 */ struct r_search_path_struct { +/* 968 | 8 */ struct r_search_path_elem **dirs; +/* 976 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_runpath_dirs; +/* 984 | 8 */ struct link_map **l_initfini; +/* 992 | 8 */ struct link_map_reldeps *l_reldeps; +/* 1000 | 4 */ unsigned int l_reldepsmax; +/* 1004 | 4 */ unsigned int l_used; +/* 1008 | 4 */ Elf64_Word l_feature_1; +/* 1012 | 4 */ Elf64_Word l_flags_1; +/* 1016 | 4 */ Elf64_Word l_flags; +/* 1020 | 4 */ int l_idx; +/* 1024 | 8 */ struct link_map_machine { +/* 1024 | 8 */ Elf64_Addr plt; + + /* total size (bytes): 8 */ + } l_mach; +/* 1032 | 32 */ struct { +/* 1032 | 8 */ const Elf64_Sym *sym; +/* 1040 | 4 */ int type_class; +/* XXX 4-byte hole */ +/* 1048 | 8 */ struct link_map *value; +/* 1056 | 8 */ const Elf64_Sym *ret; + + /* total size (bytes): 32 */ + } l_lookup_cache; +/* 1064 | 8 */ void *l_tls_initimage; +/* 1072 | 8 */ size_t l_tls_initimage_size; +/* 1080 | 8 */ size_t l_tls_blocksize; +/* 1088 | 8 */ size_t l_tls_align; +/* 1096 | 8 */ size_t l_tls_firstbyte_offset; +/* 1104 | 8 */ ptrdiff_t l_tls_offset; +/* 1112 | 8 */ size_t l_tls_modid; +/* 1120 | 8 */ size_t l_tls_dtor_count; +/* 1128 | 8 */ Elf64_Addr l_relro_addr; +/* 1136 | 8 */ size_t l_relro_size; +/* 1144 | 8 */ unsigned long long l_serial; + + /* total size (bytes): 1152 */ + } +--- struct pthread --- +/* offset | size */ type = struct pthread { +/* 0 | 192 */ union { +/* 8 */ struct { +/* 0 | 4 */ int multiple_threads; +/* 4 | 4 */ int gscope_flag; + + /* total size (bytes): 8 */ + } header; +/* 192 */ void *__padding[24]; + + /* total size (bytes): 192 */ + }; +/* 192 | 16 */ list_t list; +/* 208 | 4 */ pid_t tid; +/* XXX 4-byte hole */ +/* 216 | 8 */ void *robust_prev; +/* 224 | 24 */ struct robust_list_head { +/* 224 | 8 */ void *list; +/* 232 | 8 */ long futex_offset; +/* 240 | 8 */ void *list_op_pending; + + /* total size (bytes): 24 */ + } robust_head; +/* 248 | 8 */ struct _pthread_cleanup_buffer *cleanup; +/* 256 | 8 */ struct pthread_unwind_buf *cleanup_jmp_buf; +/* 264 | 4 */ int cancelhandling; +/* 268 | 4 */ int flags; +/* 272 | 512 */ struct pthread_key_data specific_1stblock[32]; +/* 784 | 256 */ struct pthread_key_data *specific[32]; +/* 1040 | 1 */ _Bool specific_used; +/* 1041 | 1 */ _Bool report_events; +/* 1042 | 1 */ _Bool user_stack; +/* 1043 | 1 */ _Bool stopped_start; +/* 1044 | 4 */ int setup_failed; +/* 1048 | 4 */ int lock; +/* 1052 | 4 */ unsigned int setxid_futex; +/* 1056 | 8 */ struct pthread *joinid; +/* 1064 | 8 */ void *result; +/* 1072 | 4 */ struct sched_param { +/* 1072 | 4 */ int sched_priority; + + /* total size (bytes): 4 */ + } schedparam; +/* 1076 | 4 */ int schedpolicy; +/* 1080 | 8 */ void *(*start_routine)(void *); +/* 1088 | 8 */ void *arg; +/* 1096 | 24 */ td_eventbuf_t eventbuf; +/* 1120 | 8 */ struct pthread *nextevent; +/* XXX 8-byte hole */ +/* 1136 | 32 */ struct _Unwind_Exception { +/* 1136 | 32 */ union { +/* 32 */ struct { +/* 1136 | 8 */ _Unwind_Exception_Class exception_class; +/* 1144 | 8 */ _Unwind_Exception_Cleanup_Fn exception_cleanup; +/* 1152 | 8 */ _Unwind_Word private_1; +/* 1160 | 8 */ _Unwind_Word private_2; + + /* total size (bytes): 32 */ + }; +/* 16 */ _Unwind_Word unwind_exception_align[2]; + + /* total size (bytes): 32 */ + }; + + /* total size (bytes): 32 */ + } exc; +/* 1168 | 8 */ void *stackblock; +/* 1176 | 8 */ size_t stackblock_size; +/* 1184 | 8 */ size_t guardsize; +/* 1192 | 8 */ size_t reported_guardsize; +/* 1200 | 8 */ struct priority_protection_data *tpp; +/* 1208 | 568 */ struct __res_state { +/* 1208 | 4 */ int retrans; +/* 1212 | 4 */ int retry; +/* 1216 | 8 */ unsigned long options; +/* 1224 | 4 */ int nscount; +/* 1228 | 48 */ struct sockaddr_in nsaddr_list[3]; +/* 1276 | 2 */ unsigned short id; +/* XXX 2-byte hole */ +/* 1280 | 56 */ char *dnsrch[7]; +/* 1336 | 256 */ char defdname[256]; +/* 1592 | 8 */ unsigned long pfcode; +/* 1600: 0 | 4 */ unsigned int ndots : 4; +/* 1600: 4 | 4 */ unsigned int nsort : 4; +/* 1601: 0 | 4 */ unsigned int ipv6_unavail : 1; +/* 1601: 1 | 4 */ unsigned int unused : 23; +/* 1604 | 80 */ struct { +/* 0 | 4 */ struct in_addr addr; +/* 4 | 4 */ uint32_t mask; + } sort_list[10]; +/* XXX 4-byte hole */ +/* 1688 | 8 */ void *__glibc_unused_qhook; +/* 1696 | 8 */ void *__glibc_unused_rhook; +/* 1704 | 4 */ int res_h_errno; +/* 1708 | 4 */ int _vcsock; +/* 1712 | 4 */ unsigned int _flags; +/* XXX 4-byte hole */ +/* 1720 | 56 */ union { +/* 52 */ char pad[52]; +/* 56 */ struct { +/* 1720 | 2 */ uint16_t nscount; +/* 1722 | 6 */ uint16_t nsmap[3]; +/* 1728 | 12 */ int nssocks[3]; +/* 1740 | 2 */ uint16_t nscount6; +/* 1742 | 2 */ uint16_t nsinit; +/* 1744 | 24 */ struct sockaddr_in6 *nsaddrs[3]; +/* 1768 | 8 */ unsigned long long __glibc_extension_index; + + /* total size (bytes): 56 */ + } _ext; + + /* total size (bytes): 56 */ + } _u; + + /* total size (bytes): 568 */ + } res; +/* 1776 | 8 */ internal_sigset_t sigmask; +/* 1784 | 8 */ struct rtld_catch *rtld_catch; +/* 1792 | 1 */ _Bool c11; +/* 1793 | 1 */ _Bool exiting; +/* XXX 2-byte hole */ +/* 1796 | 4 */ int exit_lock; +/* 1800 | 16 */ struct tls_internal_t { +/* 1800 | 8 */ char *strsignal_buf; +/* 1808 | 8 */ char *strerror_l_buf; + + /* total size (bytes): 16 */ + } tls_state; +/* 1816 | 8 */ void *getrandom_buf; +/* 1824 | 32 */ union { +/* 24 */ struct { +/* 1824 | 4 */ uint32_t cpu_id_start; +/* 1828 | 4 */ uint32_t cpu_id; +/* 1832 | 8 */ uint64_t rseq_cs; +/* 1840 | 4 */ uint32_t flags; +/* XXX 4-byte padding */ + + /* total size (bytes): 24 */ + }; +/* 32 */ char pad[32]; + + /* total size (bytes): 32 */ + } rseq_area; + + /* total size (bytes): 1856 */ + } diff --git a/ld-so-abi-s390x.baseline b/ld-so-abi-s390x.baseline new file mode 100644 index 0000000..9405390 --- /dev/null +++ b/ld-so-abi-s390x.baseline @@ -0,0 +1,534 @@ +--- _rtld_global_ro --- +/* offset | size */ type = struct rtld_global_ro { +/* 0 | 4 */ int _dl_debug_mask; +/* XXX 4-byte hole */ +/* 8 | 8 */ const char *_dl_platform; +/* 16 | 8 */ size_t _dl_platformlen; +/* 24 | 8 */ size_t _dl_pagesize; +/* 32 | 8 */ size_t _dl_minsigstacksize; +/* 40 | 4 */ int _dl_inhibit_cache; +/* XXX 4-byte hole */ +/* 48 | 16 */ struct r_scope_elem { +/* 48 | 8 */ struct link_map **r_list; +/* 56 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } _dl_initial_searchlist; +/* 64 | 4 */ int _dl_clktck; +/* 68 | 4 */ int _dl_verbose; +/* 72 | 4 */ int _dl_debug_fd; +/* 76 | 4 */ int _dl_lazy; +/* 80 | 4 */ int _dl_bind_not; +/* 84 | 4 */ int _dl_dynamic_weak; +/* 88 | 4 */ fpu_control_t _dl_fpu_control; +/* XXX 4-byte hole */ +/* 96 | 8 */ uint64_t _dl_hwcap; +/* 104 | 8 */ Elf64_auxv_t *_dl_auxv; +/* 112 | 128 */ struct cpu_features { +/* 112 | 8 */ unsigned long hwcap; +/* 120 | 8 */ unsigned long __reserved_hwcap2; +/* 128 | 24 */ unsigned long long stfle_bits[3]; +/* 152 | 88 */ unsigned long long __reserved[11]; + + /* total size (bytes): 128 */ + } _dl_s390_cpu_features; +/* 240 | 8 */ const char *_dl_inhibit_rpath; +/* 248 | 8 */ const char *_dl_origin_path; +/* 256 | 8 */ size_t _dl_tls_static_size; +/* 264 | 8 */ size_t _dl_tls_static_align; +/* 272 | 8 */ size_t _dl_tls_static_surplus; +/* 280 | 8 */ const char *_dl_profile; +/* 288 | 8 */ const char *_dl_profile_output; +/* 296 | 8 */ struct r_search_path_elem *_dl_init_all_dirs; +/* 304 | 8 */ const Elf64_Ehdr *_dl_sysinfo_dso; +/* 312 | 8 */ struct link_map *_dl_sysinfo_map; +/* 320 | 8 */ int (*_dl_vdso_clock_gettime64)(clockid_t, struct timespec *); +/* 328 | 8 */ int (*_dl_vdso_gettimeofday)(struct timeval *, void *); +/* 336 | 8 */ int (*_dl_vdso_getcpu)(unsigned int *, unsigned int *, void *); +/* 344 | 8 */ int (*_dl_vdso_clock_getres_time64)(clockid_t, struct timespec *); +/* 352 | 8 */ ssize_t (*_dl_vdso_getrandom)(void *, size_t, unsigned int, void *, size_t); +/* 360 | 8 */ uint64_t _dl_hwcap2; +/* 368 | 8 */ uint64_t _dl_hwcap3; +/* 376 | 8 */ uint64_t _dl_hwcap4; +/* 384 | 4 */ enum dso_sort_algorithm _dl_dso_sort_algo; +/* XXX 4-byte hole */ +/* 392 | 8 */ void (*_dl_debug_printf)(const char *, ...); +/* 400 | 8 */ void (*_dl_mcount)(Elf64_Addr, Elf64_Addr); +/* 408 | 8 */ lookup_t (*_dl_lookup_symbol_x)(const char *, struct link_map *, const Elf64_Sym **, struct r_scope_elem **, const struct r_found_version *, int, int, struct link_map *); +/* 416 | 8 */ void *(*_dl_open)(const char *, int, const void *, Lmid_t, int, char **, char **); +/* 424 | 8 */ void (*_dl_close)(void *); +/* 432 | 8 */ int (*_dl_catch_error)(const char **, const char **, _Bool *, void (*)(void *), void *); +/* 440 | 8 */ void (*_dl_error_free)(void *); +/* 448 | 8 */ void *(*_dl_tls_get_addr_soft)(struct link_map *); +/* 456 | 8 */ void (*_dl_libc_freeres)(void); +/* 464 | 8 */ int (*_dl_find_object)(void *, struct dl_find_object *); +/* 472 | 8 */ const struct dlfcn_hook *_dl_dlfcn_hook; +/* 480 | 8 */ struct audit_ifaces *_dl_audit; +/* 488 | 4 */ unsigned int _dl_naudit; +/* XXX 4-byte padding */ + + /* total size (bytes): 496 */ + } +--- _rtld_global --- +/* offset | size */ type = struct rtld_global { +/* 0 | 2560 */ struct link_namespaces _dl_ns[16]; +/* 2560 | 8 */ size_t _dl_nns; +/* 2568 | 40 */ __rtld_lock_recursive_t _dl_load_lock; +/* 2608 | 40 */ __rtld_lock_recursive_t _dl_load_write_lock; +/* 2648 | 40 */ __rtld_lock_recursive_t _dl_load_tls_lock; +/* 2688 | 8 */ unsigned long long _dl_load_adds; +/* 2696 | 8 */ struct link_map *_dl_initfirst; +/* 2704 | 8 */ struct link_map *_dl_profile_map; +/* 2712 | 8 */ unsigned long _dl_num_relocations; +/* 2720 | 8 */ unsigned long _dl_num_cache_relocations; +/* 2728 | 8 */ struct r_search_path_elem *_dl_all_dirs; +/* 2736 | 1168 */ struct link_map { +/* 2736 | 8 */ Elf64_Addr l_addr; +/* 2744 | 8 */ char *l_name; +/* 2752 | 8 */ Elf64_Dyn *l_ld; +/* 2760 | 8 */ struct link_map *l_next; +/* 2768 | 8 */ struct link_map *l_prev; +/* 2776 | 8 */ struct link_map *l_real; +/* 2784 | 8 */ Lmid_t l_ns; +/* 2792 | 8 */ struct libname_list *l_libname; +/* 2800 | 640 */ Elf64_Dyn *l_info[80]; +/* 3440 | 8 */ const Elf64_Phdr *l_phdr; +/* 3448 | 8 */ Elf64_Addr l_entry; +/* 3456 | 2 */ Elf64_Half l_phnum; +/* 3458 | 2 */ Elf64_Half l_ldnum; +/* XXX 4-byte hole */ +/* 3464 | 16 */ struct r_scope_elem { +/* 3464 | 8 */ struct link_map **r_list; +/* 3472 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_searchlist; +/* 3480 | 16 */ struct r_scope_elem { +/* 3480 | 8 */ struct link_map **r_list; +/* 3488 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_symbolic_searchlist; +/* 3496 | 8 */ struct link_map *l_loader; +/* 3504 | 8 */ struct r_found_version *l_versions; +/* 3512 | 4 */ unsigned int l_nversions; +/* XXX 4-byte hole */ +/* 3520 | 8 */ Elf_Symndx l_nbuckets; +/* 3528 | 4 */ Elf32_Word l_gnu_bitmask_idxbits; +/* 3532 | 4 */ Elf32_Word l_gnu_shift; +/* 3536 | 8 */ const Elf64_Addr *l_gnu_bitmask; +/* 3544 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_buckets; +/* 8 */ const Elf_Symndx *l_chain; + + /* total size (bytes): 8 */ + }; +/* 3552 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_chain_zero; +/* 8 */ const Elf_Symndx *l_buckets; + + /* total size (bytes): 8 */ + }; +/* 3560 | 4 */ unsigned int l_direct_opencount; +/* 3564: 0 | 4 */ enum {lt_executable, lt_library, lt_loaded} l_type : 2; +/* 3564: 2 | 4 */ unsigned int l_dt_relr_ref : 1; +/* 3564: 3 | 4 */ unsigned int l_relocated : 1; +/* 3564: 4 | 4 */ unsigned int l_init_called : 1; +/* 3564: 5 | 4 */ unsigned int l_global : 1; +/* 3564: 6 | 4 */ unsigned int l_reserved : 2; +/* 3565: 0 | 4 */ unsigned int l_main_map : 1; +/* 3565: 1 | 4 */ unsigned int l_visited : 1; +/* 3565: 2 | 4 */ unsigned int l_map_used : 1; +/* 3565: 3 | 4 */ unsigned int l_map_done : 1; +/* 3565: 4 | 4 */ unsigned int l_phdr_allocated : 1; +/* 3565: 5 | 4 */ unsigned int l_soname_added : 1; +/* 3565: 6 | 4 */ unsigned int l_faked : 1; +/* 3565: 7 | 4 */ unsigned int l_need_tls_init : 1; +/* 3566: 0 | 4 */ unsigned int l_auditing : 1; +/* 3566: 1 | 4 */ unsigned int l_audit_any_plt : 1; +/* 3566: 2 | 4 */ unsigned int l_removed : 1; +/* 3566: 3 | 4 */ unsigned int l_contiguous : 1; +/* 3566: 4 | 4 */ unsigned int l_free_initfini : 1; +/* 3566: 5 | 4 */ unsigned int l_ld_readonly : 1; +/* 3566: 6 | 4 */ unsigned int l_find_object_processed : 1; +/* 3566: 7 | 4 */ unsigned int l_tls_in_slotinfo : 1; +/* 3567 | 1 */ _Bool l_nodelete_active; +/* 3568 | 1 */ _Bool l_nodelete_pending; +/* XXX 3-byte hole */ +/* 3572 | 4 */ unsigned int l_1_needed; +/* 3576 | 16 */ struct r_search_path_struct { +/* 3576 | 8 */ struct r_search_path_elem **dirs; +/* 3584 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_rpath_dirs; +/* 3592 | 8 */ struct reloc_result *l_reloc_result; +/* 3600 | 8 */ Elf64_Versym *l_versyms; +/* 3608 | 8 */ const char *l_origin; +/* 3616 | 8 */ Elf64_Addr l_map_start; +/* 3624 | 8 */ Elf64_Addr l_map_end; +/* 3632 | 32 */ struct r_scope_elem *l_scope_mem[4]; +/* 3664 | 8 */ size_t l_scope_max; +/* 3672 | 8 */ struct r_scope_elem **l_scope; +/* 3680 | 16 */ struct r_scope_elem *l_local_scope[2]; +/* 3696 | 16 */ struct r_file_id { +/* 3696 | 8 */ dev_t dev; +/* 3704 | 8 */ ino64_t ino; + + /* total size (bytes): 16 */ + } l_file_id; +/* 3712 | 16 */ struct r_search_path_struct { +/* 3712 | 8 */ struct r_search_path_elem **dirs; +/* 3720 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_runpath_dirs; +/* 3728 | 8 */ struct link_map **l_initfini; +/* 3736 | 8 */ struct link_map_reldeps *l_reldeps; +/* 3744 | 4 */ unsigned int l_reldepsmax; +/* 3748 | 4 */ unsigned int l_used; +/* 3752 | 4 */ Elf64_Word l_feature_1; +/* 3756 | 4 */ Elf64_Word l_flags_1; +/* 3760 | 4 */ Elf64_Word l_flags; +/* 3764 | 4 */ int l_idx; +/* 3768 | 16 */ struct link_map_machine { +/* 3768 | 8 */ Elf64_Addr plt; +/* 3776 | 8 */ const Elf64_Rela *jmprel; + + /* total size (bytes): 16 */ + } l_mach; +/* 3784 | 32 */ struct { +/* 3784 | 8 */ const Elf64_Sym *sym; +/* 3792 | 4 */ int type_class; +/* XXX 4-byte hole */ +/* 3800 | 8 */ struct link_map *value; +/* 3808 | 8 */ const Elf64_Sym *ret; + + /* total size (bytes): 32 */ + } l_lookup_cache; +/* 3816 | 8 */ void *l_tls_initimage; +/* 3824 | 8 */ size_t l_tls_initimage_size; +/* 3832 | 8 */ size_t l_tls_blocksize; +/* 3840 | 8 */ size_t l_tls_align; +/* 3848 | 8 */ size_t l_tls_firstbyte_offset; +/* 3856 | 8 */ ptrdiff_t l_tls_offset; +/* 3864 | 8 */ size_t l_tls_modid; +/* 3872 | 8 */ size_t l_tls_dtor_count; +/* 3880 | 8 */ Elf64_Addr l_relro_addr; +/* 3888 | 8 */ size_t l_relro_size; +/* 3896 | 8 */ unsigned long long l_serial; + + /* total size (bytes): 1168 */ + } _dl_rtld_map; +/* 3904 | 256 */ struct auditstate _dl_rtld_auditstate[16]; +/* 4160 | 4 */ Elf64_Word _dl_stack_flags; +/* 4164 | 1 */ _Bool _dl_tls_dtv_gaps; +/* XXX 3-byte hole */ +/* 4168 | 8 */ size_t _dl_tls_max_dtv_idx; +/* 4176 | 8 */ struct dtv_slotinfo_list *_dl_tls_dtv_slotinfo_list; +/* 4184 | 8 */ size_t _dl_tls_static_nelem; +/* 4192 | 8 */ size_t _dl_tls_static_used; +/* 4200 | 8 */ size_t _dl_tls_static_optional; +/* 4208 | 8 */ void *_dl_initial_dtv; +/* 4216 | 8 */ size_t _dl_tls_generation; +/* 4224 | 8 */ struct dl_scope_free_list *_dl_scope_free_list; +/* 4232 | 16 */ list_t _dl_stack_used; +/* 4248 | 16 */ list_t _dl_stack_user; +/* 4264 | 16 */ list_t _dl_stack_cache; +/* 4280 | 8 */ size_t _dl_stack_cache_actsize; +/* 4288 | 8 */ uintptr_t _dl_in_flight_stack; +/* 4296 | 4 */ int _dl_stack_cache_lock; +/* XXX 4-byte padding */ + + /* total size (bytes): 4304 */ + } +--- struct link_map --- +/* offset | size */ type = struct link_map { +/* 0 | 8 */ Elf64_Addr l_addr; +/* 8 | 8 */ char *l_name; +/* 16 | 8 */ Elf64_Dyn *l_ld; +/* 24 | 8 */ struct link_map *l_next; +/* 32 | 8 */ struct link_map *l_prev; +/* 40 | 8 */ struct link_map *l_real; +/* 48 | 8 */ Lmid_t l_ns; +/* 56 | 8 */ struct libname_list *l_libname; +/* 64 | 640 */ Elf64_Dyn *l_info[80]; +/* 704 | 8 */ const Elf64_Phdr *l_phdr; +/* 712 | 8 */ Elf64_Addr l_entry; +/* 720 | 2 */ Elf64_Half l_phnum; +/* 722 | 2 */ Elf64_Half l_ldnum; +/* XXX 4-byte hole */ +/* 728 | 16 */ struct r_scope_elem { +/* 728 | 8 */ struct link_map **r_list; +/* 736 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_searchlist; +/* 744 | 16 */ struct r_scope_elem { +/* 744 | 8 */ struct link_map **r_list; +/* 752 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_symbolic_searchlist; +/* 760 | 8 */ struct link_map *l_loader; +/* 768 | 8 */ struct r_found_version *l_versions; +/* 776 | 4 */ unsigned int l_nversions; +/* XXX 4-byte hole */ +/* 784 | 8 */ Elf_Symndx l_nbuckets; +/* 792 | 4 */ Elf32_Word l_gnu_bitmask_idxbits; +/* 796 | 4 */ Elf32_Word l_gnu_shift; +/* 800 | 8 */ const Elf64_Addr *l_gnu_bitmask; +/* 808 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_buckets; +/* 8 */ const Elf_Symndx *l_chain; + + /* total size (bytes): 8 */ + }; +/* 816 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_chain_zero; +/* 8 */ const Elf_Symndx *l_buckets; + + /* total size (bytes): 8 */ + }; +/* 824 | 4 */ unsigned int l_direct_opencount; +/* 828: 0 | 4 */ enum {lt_executable, lt_library, lt_loaded} l_type : 2; +/* 828: 2 | 4 */ unsigned int l_dt_relr_ref : 1; +/* 828: 3 | 4 */ unsigned int l_relocated : 1; +/* 828: 4 | 4 */ unsigned int l_init_called : 1; +/* 828: 5 | 4 */ unsigned int l_global : 1; +/* 828: 6 | 4 */ unsigned int l_reserved : 2; +/* 829: 0 | 4 */ unsigned int l_main_map : 1; +/* 829: 1 | 4 */ unsigned int l_visited : 1; +/* 829: 2 | 4 */ unsigned int l_map_used : 1; +/* 829: 3 | 4 */ unsigned int l_map_done : 1; +/* 829: 4 | 4 */ unsigned int l_phdr_allocated : 1; +/* 829: 5 | 4 */ unsigned int l_soname_added : 1; +/* 829: 6 | 4 */ unsigned int l_faked : 1; +/* 829: 7 | 4 */ unsigned int l_need_tls_init : 1; +/* 830: 0 | 4 */ unsigned int l_auditing : 1; +/* 830: 1 | 4 */ unsigned int l_audit_any_plt : 1; +/* 830: 2 | 4 */ unsigned int l_removed : 1; +/* 830: 3 | 4 */ unsigned int l_contiguous : 1; +/* 830: 4 | 4 */ unsigned int l_free_initfini : 1; +/* 830: 5 | 4 */ unsigned int l_ld_readonly : 1; +/* 830: 6 | 4 */ unsigned int l_find_object_processed : 1; +/* 830: 7 | 4 */ unsigned int l_tls_in_slotinfo : 1; +/* 831 | 1 */ _Bool l_nodelete_active; +/* 832 | 1 */ _Bool l_nodelete_pending; +/* XXX 3-byte hole */ +/* 836 | 4 */ unsigned int l_1_needed; +/* 840 | 16 */ struct r_search_path_struct { +/* 840 | 8 */ struct r_search_path_elem **dirs; +/* 848 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_rpath_dirs; +/* 856 | 8 */ struct reloc_result *l_reloc_result; +/* 864 | 8 */ Elf64_Versym *l_versyms; +/* 872 | 8 */ const char *l_origin; +/* 880 | 8 */ Elf64_Addr l_map_start; +/* 888 | 8 */ Elf64_Addr l_map_end; +/* 896 | 32 */ struct r_scope_elem *l_scope_mem[4]; +/* 928 | 8 */ size_t l_scope_max; +/* 936 | 8 */ struct r_scope_elem **l_scope; +/* 944 | 16 */ struct r_scope_elem *l_local_scope[2]; +/* 960 | 16 */ struct r_file_id { +/* 960 | 8 */ dev_t dev; +/* 968 | 8 */ ino64_t ino; + + /* total size (bytes): 16 */ + } l_file_id; +/* 976 | 16 */ struct r_search_path_struct { +/* 976 | 8 */ struct r_search_path_elem **dirs; +/* 984 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_runpath_dirs; +/* 992 | 8 */ struct link_map **l_initfini; +/* 1000 | 8 */ struct link_map_reldeps *l_reldeps; +/* 1008 | 4 */ unsigned int l_reldepsmax; +/* 1012 | 4 */ unsigned int l_used; +/* 1016 | 4 */ Elf64_Word l_feature_1; +/* 1020 | 4 */ Elf64_Word l_flags_1; +/* 1024 | 4 */ Elf64_Word l_flags; +/* 1028 | 4 */ int l_idx; +/* 1032 | 16 */ struct link_map_machine { +/* 1032 | 8 */ Elf64_Addr plt; +/* 1040 | 8 */ const Elf64_Rela *jmprel; + + /* total size (bytes): 16 */ + } l_mach; +/* 1048 | 32 */ struct { +/* 1048 | 8 */ const Elf64_Sym *sym; +/* 1056 | 4 */ int type_class; +/* XXX 4-byte hole */ +/* 1064 | 8 */ struct link_map *value; +/* 1072 | 8 */ const Elf64_Sym *ret; + + /* total size (bytes): 32 */ + } l_lookup_cache; +/* 1080 | 8 */ void *l_tls_initimage; +/* 1088 | 8 */ size_t l_tls_initimage_size; +/* 1096 | 8 */ size_t l_tls_blocksize; +/* 1104 | 8 */ size_t l_tls_align; +/* 1112 | 8 */ size_t l_tls_firstbyte_offset; +/* 1120 | 8 */ ptrdiff_t l_tls_offset; +/* 1128 | 8 */ size_t l_tls_modid; +/* 1136 | 8 */ size_t l_tls_dtor_count; +/* 1144 | 8 */ Elf64_Addr l_relro_addr; +/* 1152 | 8 */ size_t l_relro_size; +/* 1160 | 8 */ unsigned long long l_serial; + + /* total size (bytes): 1168 */ + } +--- struct pthread --- +/* offset | size */ type = struct pthread { +/* 0 | 192 */ union { +/* 64 */ tcbhead_t header; +/* 192 */ void *__padding[24]; + + /* total size (bytes): 192 */ + }; +/* 192 | 16 */ list_t list; +/* 208 | 4 */ pid_t tid; +/* XXX 4-byte hole */ +/* 216 | 8 */ void *robust_prev; +/* 224 | 24 */ struct robust_list_head { +/* 224 | 8 */ void *list; +/* 232 | 8 */ long futex_offset; +/* 240 | 8 */ void *list_op_pending; + + /* total size (bytes): 24 */ + } robust_head; +/* 248 | 8 */ struct _pthread_cleanup_buffer *cleanup; +/* 256 | 8 */ struct pthread_unwind_buf *cleanup_jmp_buf; +/* 264 | 4 */ int cancelhandling; +/* 268 | 4 */ int flags; +/* 272 | 512 */ struct pthread_key_data specific_1stblock[32]; +/* 784 | 256 */ struct pthread_key_data *specific[32]; +/* 1040 | 1 */ _Bool specific_used; +/* 1041 | 1 */ _Bool report_events; +/* 1042 | 1 */ _Bool user_stack; +/* 1043 | 1 */ _Bool stopped_start; +/* 1044 | 4 */ int setup_failed; +/* 1048 | 4 */ int lock; +/* 1052 | 4 */ unsigned int setxid_futex; +/* 1056 | 8 */ struct pthread *joinid; +/* 1064 | 8 */ void *result; +/* 1072 | 4 */ struct sched_param { +/* 1072 | 4 */ int sched_priority; + + /* total size (bytes): 4 */ + } schedparam; +/* 1076 | 4 */ int schedpolicy; +/* 1080 | 8 */ void *(*start_routine)(void *); +/* 1088 | 8 */ void *arg; +/* 1096 | 24 */ td_eventbuf_t eventbuf; +/* 1120 | 8 */ struct pthread *nextevent; +/* XXX 8-byte hole */ +/* 1136 | 32 */ struct _Unwind_Exception { +/* 1136 | 32 */ union { +/* 32 */ struct { +/* 1136 | 8 */ _Unwind_Exception_Class exception_class; +/* 1144 | 8 */ _Unwind_Exception_Cleanup_Fn exception_cleanup; +/* 1152 | 8 */ _Unwind_Word private_1; +/* 1160 | 8 */ _Unwind_Word private_2; + + /* total size (bytes): 32 */ + }; +/* 16 */ _Unwind_Word unwind_exception_align[2]; + + /* total size (bytes): 32 */ + }; + + /* total size (bytes): 32 */ + } exc; +/* 1168 | 8 */ void *stackblock; +/* 1176 | 8 */ size_t stackblock_size; +/* 1184 | 8 */ size_t guardsize; +/* 1192 | 8 */ size_t reported_guardsize; +/* 1200 | 8 */ struct priority_protection_data *tpp; +/* 1208 | 568 */ struct __res_state { +/* 1208 | 4 */ int retrans; +/* 1212 | 4 */ int retry; +/* 1216 | 8 */ unsigned long options; +/* 1224 | 4 */ int nscount; +/* 1228 | 48 */ struct sockaddr_in nsaddr_list[3]; +/* 1276 | 2 */ unsigned short id; +/* XXX 2-byte hole */ +/* 1280 | 56 */ char *dnsrch[7]; +/* 1336 | 256 */ char defdname[256]; +/* 1592 | 8 */ unsigned long pfcode; +/* 1600: 0 | 4 */ unsigned int ndots : 4; +/* 1600: 4 | 4 */ unsigned int nsort : 4; +/* 1601: 0 | 4 */ unsigned int ipv6_unavail : 1; +/* 1601: 1 | 4 */ unsigned int unused : 23; +/* 1604 | 80 */ struct { +/* 0 | 4 */ struct in_addr addr; +/* 4 | 4 */ uint32_t mask; + } sort_list[10]; +/* XXX 4-byte hole */ +/* 1688 | 8 */ void *__glibc_unused_qhook; +/* 1696 | 8 */ void *__glibc_unused_rhook; +/* 1704 | 4 */ int res_h_errno; +/* 1708 | 4 */ int _vcsock; +/* 1712 | 4 */ unsigned int _flags; +/* XXX 4-byte hole */ +/* 1720 | 56 */ union { +/* 52 */ char pad[52]; +/* 56 */ struct { +/* 1720 | 2 */ uint16_t nscount; +/* 1722 | 6 */ uint16_t nsmap[3]; +/* 1728 | 12 */ int nssocks[3]; +/* 1740 | 2 */ uint16_t nscount6; +/* 1742 | 2 */ uint16_t nsinit; +/* 1744 | 24 */ struct sockaddr_in6 *nsaddrs[3]; +/* 1768 | 8 */ unsigned long long __glibc_extension_index; + + /* total size (bytes): 56 */ + } _ext; + + /* total size (bytes): 56 */ + } _u; + + /* total size (bytes): 568 */ + } res; +/* 1776 | 8 */ internal_sigset_t sigmask; +/* 1784 | 8 */ struct rtld_catch *rtld_catch; +/* 1792 | 1 */ _Bool c11; +/* 1793 | 1 */ _Bool exiting; +/* XXX 2-byte hole */ +/* 1796 | 4 */ int exit_lock; +/* 1800 | 16 */ struct tls_internal_t { +/* 1800 | 8 */ char *strsignal_buf; +/* 1808 | 8 */ char *strerror_l_buf; + + /* total size (bytes): 16 */ + } tls_state; +/* 1816 | 8 */ void *getrandom_buf; +/* 1824 | 32 */ union { +/* 24 */ struct { +/* 1824 | 4 */ uint32_t cpu_id_start; +/* 1828 | 4 */ uint32_t cpu_id; +/* 1832 | 8 */ uint64_t rseq_cs; +/* 1840 | 4 */ uint32_t flags; +/* XXX 4-byte padding */ + + /* total size (bytes): 24 */ + }; +/* 32 */ char pad[32]; + + /* total size (bytes): 32 */ + } rseq_area; + + /* total size (bytes): 1856 */ + } diff --git a/ld-so-abi-x86_64.baseline b/ld-so-abi-x86_64.baseline new file mode 100644 index 0000000..855abc6 --- /dev/null +++ b/ld-so-abi-x86_64.baseline @@ -0,0 +1,591 @@ +--- _rtld_global_ro --- +/* offset | size */ type = struct rtld_global_ro { +/* 0 | 4 */ int _dl_debug_mask; +/* XXX 4-byte hole */ +/* 8 | 8 */ const char *_dl_platform; +/* 16 | 8 */ size_t _dl_platformlen; +/* 24 | 8 */ size_t _dl_pagesize; +/* 32 | 8 */ size_t _dl_minsigstacksize; +/* 40 | 4 */ int _dl_inhibit_cache; +/* XXX 4-byte hole */ +/* 48 | 16 */ struct r_scope_elem { +/* 48 | 8 */ struct link_map **r_list; +/* 56 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } _dl_initial_searchlist; +/* 64 | 4 */ int _dl_clktck; +/* 68 | 4 */ int _dl_verbose; +/* 72 | 4 */ int _dl_debug_fd; +/* 76 | 4 */ int _dl_lazy; +/* 80 | 4 */ int _dl_bind_not; +/* 84 | 4 */ int _dl_dynamic_weak; +/* 88 | 2 */ fpu_control_t _dl_fpu_control; +/* XXX 6-byte hole */ +/* 96 | 8 */ uint64_t _dl_hwcap; +/* 104 | 8 */ Elf64_auxv_t *_dl_auxv; +/* 112 | 520 */ struct cpu_features { +/* 112 | 20 */ struct cpu_features_basic { +/* 112 | 4 */ enum cpu_features_kind kind; +/* 116 | 4 */ int max_cpuid; +/* 120 | 4 */ unsigned int family; +/* 124 | 4 */ unsigned int model; +/* 128 | 4 */ unsigned int stepping; + + /* total size (bytes): 20 */ + } basic; +/* 132 | 320 */ struct cpuid_feature_internal features[10]; +/* 452 | 4 */ unsigned int preferred[1]; +/* 456 | 4 */ unsigned int isa_1; +/* XXX 4-byte hole */ +/* 464 | 8 */ unsigned long xsave_state_size; +/* 472 | 4 */ unsigned int xsave_state_full_size; +/* XXX 4-byte hole */ +/* 480 | 8 */ unsigned long data_cache_size; +/* 488 | 8 */ unsigned long shared_cache_size; +/* 496 | 8 */ unsigned long non_temporal_threshold; +/* 504 | 8 */ unsigned long rep_movsb_threshold; +/* 512 | 8 */ unsigned long rep_movsb_stop_threshold; +/* 520 | 8 */ unsigned long rep_stosb_threshold; +/* 528 | 8 */ unsigned long level1_icache_size; +/* 536 | 8 */ unsigned long level1_icache_linesize; +/* 544 | 8 */ unsigned long level1_dcache_size; +/* 552 | 8 */ unsigned long level1_dcache_assoc; +/* 560 | 8 */ unsigned long level1_dcache_linesize; +/* 568 | 8 */ unsigned long level2_cache_size; +/* 576 | 8 */ unsigned long level2_cache_assoc; +/* 584 | 8 */ unsigned long level2_cache_linesize; +/* 592 | 8 */ unsigned long level3_cache_size; +/* 600 | 8 */ unsigned long level3_cache_assoc; +/* 608 | 8 */ unsigned long level3_cache_linesize; +/* 616 | 8 */ unsigned long level4_cache_size; +/* 624 | 8 */ unsigned long cachesize_non_temporal_divisor; + + /* total size (bytes): 520 */ + } _dl_x86_cpu_features; +/* 632 | 27 */ const char _dl_x86_hwcap_flags[3][9]; +/* 659 | 36 */ const char _dl_x86_platforms[4][9]; +/* XXX 1-byte hole */ +/* 696 | 8 */ void *_dl_x86_tlsdesc_dynamic; +/* 704 | 8 */ void *_dl_x86_64_runtime_resolve; +/* 712 | 8 */ const char *_dl_inhibit_rpath; +/* 720 | 8 */ const char *_dl_origin_path; +/* 728 | 8 */ size_t _dl_tls_static_size; +/* 736 | 8 */ size_t _dl_tls_static_align; +/* 744 | 8 */ size_t _dl_tls_static_surplus; +/* 752 | 8 */ const char *_dl_profile; +/* 760 | 8 */ const char *_dl_profile_output; +/* 768 | 8 */ struct r_search_path_elem *_dl_init_all_dirs; +/* 776 | 8 */ const Elf64_Ehdr *_dl_sysinfo_dso; +/* 784 | 8 */ struct link_map *_dl_sysinfo_map; +/* 792 | 8 */ int (*_dl_vdso_clock_gettime64)(clockid_t, struct timespec *); +/* 800 | 8 */ int (*_dl_vdso_gettimeofday)(struct timeval *, void *); +/* 808 | 8 */ time_t (*_dl_vdso_time)(time_t *); +/* 816 | 8 */ int (*_dl_vdso_getcpu)(unsigned int *, unsigned int *, void *); +/* 824 | 8 */ int (*_dl_vdso_clock_getres_time64)(clockid_t, struct timespec *); +/* 832 | 8 */ ssize_t (*_dl_vdso_getrandom)(void *, size_t, unsigned int, void *, size_t); +/* 840 | 8 */ uint64_t _dl_hwcap2; +/* 848 | 8 */ uint64_t _dl_hwcap3; +/* 856 | 8 */ uint64_t _dl_hwcap4; +/* 864 | 4 */ enum dso_sort_algorithm _dl_dso_sort_algo; +/* XXX 4-byte hole */ +/* 872 | 8 */ void (*_dl_debug_printf)(const char *, ...); +/* 880 | 8 */ void (*_dl_mcount)(Elf64_Addr, Elf64_Addr); +/* 888 | 8 */ lookup_t (*_dl_lookup_symbol_x)(const char *, struct link_map *, const Elf64_Sym **, struct r_scope_elem **, const struct r_found_version *, int, int, struct link_map *); +/* 896 | 8 */ void *(*_dl_open)(const char *, int, const void *, Lmid_t, int, char **, char **); +/* 904 | 8 */ void (*_dl_close)(void *); +/* 912 | 8 */ int (*_dl_catch_error)(const char **, const char **, _Bool *, void (*)(void *), void *); +/* 920 | 8 */ void (*_dl_error_free)(void *); +/* 928 | 8 */ void *(*_dl_tls_get_addr_soft)(struct link_map *); +/* 936 | 8 */ void (*_dl_libc_freeres)(void); +/* 944 | 8 */ int (*_dl_find_object)(void *, struct dl_find_object *); +/* 952 | 8 */ const struct dlfcn_hook *_dl_dlfcn_hook; +/* 960 | 8 */ struct audit_ifaces *_dl_audit; +/* 968 | 4 */ unsigned int _dl_naudit; +/* XXX 4-byte padding */ + + /* total size (bytes): 976 */ + } +--- _rtld_global --- +/* offset | size */ type = struct rtld_global { +/* 0 | 2560 */ struct link_namespaces _dl_ns[16]; +/* 2560 | 8 */ size_t _dl_nns; +/* 2568 | 40 */ __rtld_lock_recursive_t _dl_load_lock; +/* 2608 | 40 */ __rtld_lock_recursive_t _dl_load_write_lock; +/* 2648 | 40 */ __rtld_lock_recursive_t _dl_load_tls_lock; +/* 2688 | 8 */ unsigned long long _dl_load_adds; +/* 2696 | 8 */ struct link_map *_dl_initfirst; +/* 2704 | 8 */ struct link_map *_dl_profile_map; +/* 2712 | 8 */ unsigned long _dl_num_relocations; +/* 2720 | 8 */ unsigned long _dl_num_cache_relocations; +/* 2728 | 8 */ struct r_search_path_elem *_dl_all_dirs; +/* 2736 | 1208 */ struct link_map { +/* 2736 | 8 */ Elf64_Addr l_addr; +/* 2744 | 8 */ char *l_name; +/* 2752 | 8 */ Elf64_Dyn *l_ld; +/* 2760 | 8 */ struct link_map *l_next; +/* 2768 | 8 */ struct link_map *l_prev; +/* 2776 | 8 */ struct link_map *l_real; +/* 2784 | 8 */ Lmid_t l_ns; +/* 2792 | 8 */ struct libname_list *l_libname; +/* 2800 | 672 */ Elf64_Dyn *l_info[84]; +/* 3472 | 8 */ const Elf64_Phdr *l_phdr; +/* 3480 | 8 */ Elf64_Addr l_entry; +/* 3488 | 2 */ Elf64_Half l_phnum; +/* 3490 | 2 */ Elf64_Half l_ldnum; +/* XXX 4-byte hole */ +/* 3496 | 16 */ struct r_scope_elem { +/* 3496 | 8 */ struct link_map **r_list; +/* 3504 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_searchlist; +/* 3512 | 16 */ struct r_scope_elem { +/* 3512 | 8 */ struct link_map **r_list; +/* 3520 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_symbolic_searchlist; +/* 3528 | 8 */ struct link_map *l_loader; +/* 3536 | 8 */ struct r_found_version *l_versions; +/* 3544 | 4 */ unsigned int l_nversions; +/* 3548 | 4 */ Elf_Symndx l_nbuckets; +/* 3552 | 4 */ Elf32_Word l_gnu_bitmask_idxbits; +/* 3556 | 4 */ Elf32_Word l_gnu_shift; +/* 3560 | 8 */ const Elf64_Addr *l_gnu_bitmask; +/* 3568 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_buckets; +/* 8 */ const Elf_Symndx *l_chain; + + /* total size (bytes): 8 */ + }; +/* 3576 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_chain_zero; +/* 8 */ const Elf_Symndx *l_buckets; + + /* total size (bytes): 8 */ + }; +/* 3584 | 4 */ unsigned int l_direct_opencount; +/* 3588: 0 | 4 */ enum {lt_executable, lt_library, lt_loaded} l_type : 2; +/* 3588: 2 | 4 */ unsigned int l_dt_relr_ref : 1; +/* 3588: 3 | 4 */ unsigned int l_relocated : 1; +/* 3588: 4 | 4 */ unsigned int l_init_called : 1; +/* 3588: 5 | 4 */ unsigned int l_global : 1; +/* 3588: 6 | 4 */ unsigned int l_reserved : 2; +/* 3589: 0 | 4 */ unsigned int l_main_map : 1; +/* 3589: 1 | 4 */ unsigned int l_visited : 1; +/* 3589: 2 | 4 */ unsigned int l_map_used : 1; +/* 3589: 3 | 4 */ unsigned int l_map_done : 1; +/* 3589: 4 | 4 */ unsigned int l_phdr_allocated : 1; +/* 3589: 5 | 4 */ unsigned int l_soname_added : 1; +/* 3589: 6 | 4 */ unsigned int l_faked : 1; +/* 3589: 7 | 4 */ unsigned int l_need_tls_init : 1; +/* 3590: 0 | 4 */ unsigned int l_auditing : 1; +/* 3590: 1 | 4 */ unsigned int l_audit_any_plt : 1; +/* 3590: 2 | 4 */ unsigned int l_removed : 1; +/* 3590: 3 | 4 */ unsigned int l_contiguous : 1; +/* 3590: 4 | 4 */ unsigned int l_free_initfini : 1; +/* 3590: 5 | 4 */ unsigned int l_ld_readonly : 1; +/* 3590: 6 | 4 */ unsigned int l_find_object_processed : 1; +/* 3590: 7 | 4 */ unsigned int l_tls_in_slotinfo : 1; +/* 3591 | 1 */ _Bool l_nodelete_active; +/* 3592 | 1 */ _Bool l_nodelete_pending; +/* 3593 | 1 */ _Bool l_has_jump_slot_reloc; +/* 3594: 0 | 4 */ enum {lc_property_unknown, lc_property_none, lc_property_valid} l_property : 2; +/* XXX 6-bit hole */ +/* XXX 1-byte hole */ +/* 3596 | 4 */ unsigned int l_x86_feature_1_and; +/* 3600 | 4 */ unsigned int l_x86_isa_1_needed; +/* 3604 | 4 */ unsigned int l_1_needed; +/* 3608 | 16 */ struct r_search_path_struct { +/* 3608 | 8 */ struct r_search_path_elem **dirs; +/* 3616 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_rpath_dirs; +/* 3624 | 8 */ struct reloc_result *l_reloc_result; +/* 3632 | 8 */ Elf64_Versym *l_versyms; +/* 3640 | 8 */ const char *l_origin; +/* 3648 | 8 */ Elf64_Addr l_map_start; +/* 3656 | 8 */ Elf64_Addr l_map_end; +/* 3664 | 32 */ struct r_scope_elem *l_scope_mem[4]; +/* 3696 | 8 */ size_t l_scope_max; +/* 3704 | 8 */ struct r_scope_elem **l_scope; +/* 3712 | 16 */ struct r_scope_elem *l_local_scope[2]; +/* 3728 | 16 */ struct r_file_id { +/* 3728 | 8 */ dev_t dev; +/* 3736 | 8 */ ino64_t ino; + + /* total size (bytes): 16 */ + } l_file_id; +/* 3744 | 16 */ struct r_search_path_struct { +/* 3744 | 8 */ struct r_search_path_elem **dirs; +/* 3752 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_runpath_dirs; +/* 3760 | 8 */ struct link_map **l_initfini; +/* 3768 | 8 */ struct link_map_reldeps *l_reldeps; +/* 3776 | 4 */ unsigned int l_reldepsmax; +/* 3780 | 4 */ unsigned int l_used; +/* 3784 | 4 */ Elf64_Word l_feature_1; +/* 3788 | 4 */ Elf64_Word l_flags_1; +/* 3792 | 4 */ Elf64_Word l_flags; +/* 3796 | 4 */ int l_idx; +/* 3800 | 24 */ struct link_map_machine { +/* 3800 | 8 */ Elf64_Addr plt; +/* 3808 | 8 */ Elf64_Addr gotplt; +/* 3816 | 8 */ void *tlsdesc_table; + + /* total size (bytes): 24 */ + } l_mach; +/* 3824 | 32 */ struct { +/* 3824 | 8 */ const Elf64_Sym *sym; +/* 3832 | 4 */ int type_class; +/* XXX 4-byte hole */ +/* 3840 | 8 */ struct link_map *value; +/* 3848 | 8 */ const Elf64_Sym *ret; + + /* total size (bytes): 32 */ + } l_lookup_cache; +/* 3856 | 8 */ void *l_tls_initimage; +/* 3864 | 8 */ size_t l_tls_initimage_size; +/* 3872 | 8 */ size_t l_tls_blocksize; +/* 3880 | 8 */ size_t l_tls_align; +/* 3888 | 8 */ size_t l_tls_firstbyte_offset; +/* 3896 | 8 */ ptrdiff_t l_tls_offset; +/* 3904 | 8 */ size_t l_tls_modid; +/* 3912 | 8 */ size_t l_tls_dtor_count; +/* 3920 | 8 */ Elf64_Addr l_relro_addr; +/* 3928 | 8 */ size_t l_relro_size; +/* 3936 | 8 */ unsigned long long l_serial; + + /* total size (bytes): 1208 */ + } _dl_rtld_map; +/* 3944 | 256 */ struct auditstate _dl_rtld_auditstate[16]; +/* 4200 | 4 */ unsigned int _dl_x86_feature_1; +/* 4204 | 4 */ struct dl_x86_feature_control { +/* 4204: 0 | 4 */ enum dl_x86_cet_control ibt : 2; +/* 4204: 2 | 4 */ enum dl_x86_cet_control shstk : 2; +/* 4204: 4 | 4 */ enum dl_plt_rewrite_control plt_rewrite : 2; +/* XXX 2-bit padding */ +/* XXX 3-byte padding */ + + /* total size (bytes): 4 */ + } _dl_x86_feature_control; +/* 4208 | 4 */ Elf64_Word _dl_stack_flags; +/* 4212 | 1 */ _Bool _dl_tls_dtv_gaps; +/* XXX 3-byte hole */ +/* 4216 | 8 */ size_t _dl_tls_max_dtv_idx; +/* 4224 | 8 */ struct dtv_slotinfo_list *_dl_tls_dtv_slotinfo_list; +/* 4232 | 8 */ size_t _dl_tls_static_nelem; +/* 4240 | 8 */ size_t _dl_tls_static_used; +/* 4248 | 8 */ size_t _dl_tls_static_optional; +/* 4256 | 8 */ void *_dl_initial_dtv; +/* 4264 | 8 */ size_t _dl_tls_generation; +/* 4272 | 8 */ struct dl_scope_free_list *_dl_scope_free_list; +/* 4280 | 16 */ list_t _dl_stack_used; +/* 4296 | 16 */ list_t _dl_stack_user; +/* 4312 | 16 */ list_t _dl_stack_cache; +/* 4328 | 8 */ size_t _dl_stack_cache_actsize; +/* 4336 | 8 */ uintptr_t _dl_in_flight_stack; +/* 4344 | 4 */ int _dl_stack_cache_lock; +/* XXX 4-byte padding */ + + /* total size (bytes): 4352 */ + } +--- struct link_map --- +/* offset | size */ type = struct link_map { +/* 0 | 8 */ Elf64_Addr l_addr; +/* 8 | 8 */ char *l_name; +/* 16 | 8 */ Elf64_Dyn *l_ld; +/* 24 | 8 */ struct link_map *l_next; +/* 32 | 8 */ struct link_map *l_prev; +/* 40 | 8 */ struct link_map *l_real; +/* 48 | 8 */ Lmid_t l_ns; +/* 56 | 8 */ struct libname_list *l_libname; +/* 64 | 672 */ Elf64_Dyn *l_info[84]; +/* 736 | 8 */ const Elf64_Phdr *l_phdr; +/* 744 | 8 */ Elf64_Addr l_entry; +/* 752 | 2 */ Elf64_Half l_phnum; +/* 754 | 2 */ Elf64_Half l_ldnum; +/* XXX 4-byte hole */ +/* 760 | 16 */ struct r_scope_elem { +/* 760 | 8 */ struct link_map **r_list; +/* 768 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_searchlist; +/* 776 | 16 */ struct r_scope_elem { +/* 776 | 8 */ struct link_map **r_list; +/* 784 | 4 */ unsigned int r_nlist; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_symbolic_searchlist; +/* 792 | 8 */ struct link_map *l_loader; +/* 800 | 8 */ struct r_found_version *l_versions; +/* 808 | 4 */ unsigned int l_nversions; +/* 812 | 4 */ Elf_Symndx l_nbuckets; +/* 816 | 4 */ Elf32_Word l_gnu_bitmask_idxbits; +/* 820 | 4 */ Elf32_Word l_gnu_shift; +/* 824 | 8 */ const Elf64_Addr *l_gnu_bitmask; +/* 832 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_buckets; +/* 8 */ const Elf_Symndx *l_chain; + + /* total size (bytes): 8 */ + }; +/* 840 | 8 */ union { +/* 8 */ const Elf32_Word *l_gnu_chain_zero; +/* 8 */ const Elf_Symndx *l_buckets; + + /* total size (bytes): 8 */ + }; +/* 848 | 4 */ unsigned int l_direct_opencount; +/* 852: 0 | 4 */ enum {lt_executable, lt_library, lt_loaded} l_type : 2; +/* 852: 2 | 4 */ unsigned int l_dt_relr_ref : 1; +/* 852: 3 | 4 */ unsigned int l_relocated : 1; +/* 852: 4 | 4 */ unsigned int l_init_called : 1; +/* 852: 5 | 4 */ unsigned int l_global : 1; +/* 852: 6 | 4 */ unsigned int l_reserved : 2; +/* 853: 0 | 4 */ unsigned int l_main_map : 1; +/* 853: 1 | 4 */ unsigned int l_visited : 1; +/* 853: 2 | 4 */ unsigned int l_map_used : 1; +/* 853: 3 | 4 */ unsigned int l_map_done : 1; +/* 853: 4 | 4 */ unsigned int l_phdr_allocated : 1; +/* 853: 5 | 4 */ unsigned int l_soname_added : 1; +/* 853: 6 | 4 */ unsigned int l_faked : 1; +/* 853: 7 | 4 */ unsigned int l_need_tls_init : 1; +/* 854: 0 | 4 */ unsigned int l_auditing : 1; +/* 854: 1 | 4 */ unsigned int l_audit_any_plt : 1; +/* 854: 2 | 4 */ unsigned int l_removed : 1; +/* 854: 3 | 4 */ unsigned int l_contiguous : 1; +/* 854: 4 | 4 */ unsigned int l_free_initfini : 1; +/* 854: 5 | 4 */ unsigned int l_ld_readonly : 1; +/* 854: 6 | 4 */ unsigned int l_find_object_processed : 1; +/* 854: 7 | 4 */ unsigned int l_tls_in_slotinfo : 1; +/* 855 | 1 */ _Bool l_nodelete_active; +/* 856 | 1 */ _Bool l_nodelete_pending; +/* 857 | 1 */ _Bool l_has_jump_slot_reloc; +/* 858: 0 | 4 */ enum {lc_property_unknown, lc_property_none, lc_property_valid} l_property : 2; +/* XXX 6-bit hole */ +/* XXX 1-byte hole */ +/* 860 | 4 */ unsigned int l_x86_feature_1_and; +/* 864 | 4 */ unsigned int l_x86_isa_1_needed; +/* 868 | 4 */ unsigned int l_1_needed; +/* 872 | 16 */ struct r_search_path_struct { +/* 872 | 8 */ struct r_search_path_elem **dirs; +/* 880 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_rpath_dirs; +/* 888 | 8 */ struct reloc_result *l_reloc_result; +/* 896 | 8 */ Elf64_Versym *l_versyms; +/* 904 | 8 */ const char *l_origin; +/* 912 | 8 */ Elf64_Addr l_map_start; +/* 920 | 8 */ Elf64_Addr l_map_end; +/* 928 | 32 */ struct r_scope_elem *l_scope_mem[4]; +/* 960 | 8 */ size_t l_scope_max; +/* 968 | 8 */ struct r_scope_elem **l_scope; +/* 976 | 16 */ struct r_scope_elem *l_local_scope[2]; +/* 992 | 16 */ struct r_file_id { +/* 992 | 8 */ dev_t dev; +/* 1000 | 8 */ ino64_t ino; + + /* total size (bytes): 16 */ + } l_file_id; +/* 1008 | 16 */ struct r_search_path_struct { +/* 1008 | 8 */ struct r_search_path_elem **dirs; +/* 1016 | 4 */ int malloced; +/* XXX 4-byte padding */ + + /* total size (bytes): 16 */ + } l_runpath_dirs; +/* 1024 | 8 */ struct link_map **l_initfini; +/* 1032 | 8 */ struct link_map_reldeps *l_reldeps; +/* 1040 | 4 */ unsigned int l_reldepsmax; +/* 1044 | 4 */ unsigned int l_used; +/* 1048 | 4 */ Elf64_Word l_feature_1; +/* 1052 | 4 */ Elf64_Word l_flags_1; +/* 1056 | 4 */ Elf64_Word l_flags; +/* 1060 | 4 */ int l_idx; +/* 1064 | 24 */ struct link_map_machine { +/* 1064 | 8 */ Elf64_Addr plt; +/* 1072 | 8 */ Elf64_Addr gotplt; +/* 1080 | 8 */ void *tlsdesc_table; + + /* total size (bytes): 24 */ + } l_mach; +/* 1088 | 32 */ struct { +/* 1088 | 8 */ const Elf64_Sym *sym; +/* 1096 | 4 */ int type_class; +/* XXX 4-byte hole */ +/* 1104 | 8 */ struct link_map *value; +/* 1112 | 8 */ const Elf64_Sym *ret; + + /* total size (bytes): 32 */ + } l_lookup_cache; +/* 1120 | 8 */ void *l_tls_initimage; +/* 1128 | 8 */ size_t l_tls_initimage_size; +/* 1136 | 8 */ size_t l_tls_blocksize; +/* 1144 | 8 */ size_t l_tls_align; +/* 1152 | 8 */ size_t l_tls_firstbyte_offset; +/* 1160 | 8 */ ptrdiff_t l_tls_offset; +/* 1168 | 8 */ size_t l_tls_modid; +/* 1176 | 8 */ size_t l_tls_dtor_count; +/* 1184 | 8 */ Elf64_Addr l_relro_addr; +/* 1192 | 8 */ size_t l_relro_size; +/* 1200 | 8 */ unsigned long long l_serial; + + /* total size (bytes): 1208 */ + } +--- struct pthread --- +/* offset | size */ type = struct pthread { +/* 0 | 704 */ union { +/* 704 */ tcbhead_t header; +/* 192 */ void *__padding[24]; + + /* total size (bytes): 704 */ + }; +/* 704 | 16 */ list_t list; +/* 720 | 4 */ pid_t tid; +/* XXX 4-byte hole */ +/* 728 | 8 */ void *robust_prev; +/* 736 | 24 */ struct robust_list_head { +/* 736 | 8 */ void *list; +/* 744 | 8 */ long futex_offset; +/* 752 | 8 */ void *list_op_pending; + + /* total size (bytes): 24 */ + } robust_head; +/* 760 | 8 */ struct _pthread_cleanup_buffer *cleanup; +/* 768 | 8 */ struct pthread_unwind_buf *cleanup_jmp_buf; +/* 776 | 4 */ int cancelhandling; +/* 780 | 4 */ int flags; +/* 784 | 512 */ struct pthread_key_data specific_1stblock[32]; +/* 1296 | 256 */ struct pthread_key_data *specific[32]; +/* 1552 | 1 */ _Bool specific_used; +/* 1553 | 1 */ _Bool report_events; +/* 1554 | 1 */ _Bool user_stack; +/* 1555 | 1 */ _Bool stopped_start; +/* 1556 | 4 */ int setup_failed; +/* 1560 | 4 */ int lock; +/* 1564 | 4 */ unsigned int setxid_futex; +/* 1568 | 8 */ struct pthread *joinid; +/* 1576 | 8 */ void *result; +/* 1584 | 4 */ struct sched_param { +/* 1584 | 4 */ int sched_priority; + + /* total size (bytes): 4 */ + } schedparam; +/* 1588 | 4 */ int schedpolicy; +/* 1592 | 8 */ void *(*start_routine)(void *); +/* 1600 | 8 */ void *arg; +/* 1608 | 24 */ td_eventbuf_t eventbuf; +/* 1632 | 8 */ struct pthread *nextevent; +/* XXX 8-byte hole */ +/* 1648 | 32 */ struct _Unwind_Exception { +/* 1648 | 32 */ union { +/* 32 */ struct { +/* 1648 | 8 */ _Unwind_Exception_Class exception_class; +/* 1656 | 8 */ _Unwind_Exception_Cleanup_Fn exception_cleanup; +/* 1664 | 8 */ _Unwind_Word private_1; +/* 1672 | 8 */ _Unwind_Word private_2; + + /* total size (bytes): 32 */ + }; +/* 16 */ _Unwind_Word unwind_exception_align[2]; + + /* total size (bytes): 32 */ + }; + + /* total size (bytes): 32 */ + } exc; +/* 1680 | 8 */ void *stackblock; +/* 1688 | 8 */ size_t stackblock_size; +/* 1696 | 8 */ size_t guardsize; +/* 1704 | 8 */ size_t reported_guardsize; +/* 1712 | 8 */ struct priority_protection_data *tpp; +/* 1720 | 568 */ struct __res_state { +/* 1720 | 4 */ int retrans; +/* 1724 | 4 */ int retry; +/* 1728 | 8 */ unsigned long options; +/* 1736 | 4 */ int nscount; +/* 1740 | 48 */ struct sockaddr_in nsaddr_list[3]; +/* 1788 | 2 */ unsigned short id; +/* XXX 2-byte hole */ +/* 1792 | 56 */ char *dnsrch[7]; +/* 1848 | 256 */ char defdname[256]; +/* 2104 | 8 */ unsigned long pfcode; +/* 2112: 0 | 4 */ unsigned int ndots : 4; +/* 2112: 4 | 4 */ unsigned int nsort : 4; +/* 2113: 0 | 4 */ unsigned int ipv6_unavail : 1; +/* 2113: 1 | 4 */ unsigned int unused : 23; +/* 2116 | 80 */ struct { +/* 0 | 4 */ struct in_addr addr; +/* 4 | 4 */ uint32_t mask; + } sort_list[10]; +/* XXX 4-byte hole */ +/* 2200 | 8 */ void *__glibc_unused_qhook; +/* 2208 | 8 */ void *__glibc_unused_rhook; +/* 2216 | 4 */ int res_h_errno; +/* 2220 | 4 */ int _vcsock; +/* 2224 | 4 */ unsigned int _flags; +/* XXX 4-byte hole */ +/* 2232 | 56 */ union { +/* 52 */ char pad[52]; +/* 56 */ struct { +/* 2232 | 2 */ uint16_t nscount; +/* 2234 | 6 */ uint16_t nsmap[3]; +/* 2240 | 12 */ int nssocks[3]; +/* 2252 | 2 */ uint16_t nscount6; +/* 2254 | 2 */ uint16_t nsinit; +/* 2256 | 24 */ struct sockaddr_in6 *nsaddrs[3]; +/* 2280 | 8 */ unsigned long long __glibc_extension_index; + + /* total size (bytes): 56 */ + } _ext; + + /* total size (bytes): 56 */ + } _u; + + /* total size (bytes): 568 */ + } res; +/* 2288 | 8 */ internal_sigset_t sigmask; +/* 2296 | 8 */ struct rtld_catch *rtld_catch; +/* 2304 | 1 */ _Bool c11; +/* 2305 | 1 */ _Bool exiting; +/* XXX 2-byte hole */ +/* 2308 | 4 */ int exit_lock; +/* 2312 | 16 */ struct tls_internal_t { +/* 2312 | 8 */ char *strsignal_buf; +/* 2320 | 8 */ char *strerror_l_buf; + + /* total size (bytes): 16 */ + } tls_state; +/* 2328 | 8 */ void *getrandom_buf; +/* 2336 | 32 */ union { +/* 24 */ struct { +/* 2336 | 4 */ uint32_t cpu_id_start; +/* 2340 | 4 */ uint32_t cpu_id; +/* 2344 | 8 */ uint64_t rseq_cs; +/* 2352 | 4 */ uint32_t flags; +/* XXX 4-byte padding */ + + /* total size (bytes): 24 */ + }; +/* 32 */ char pad[32]; + + /* total size (bytes): 32 */ + } rseq_area; + + /* total size (bytes): 2368 */ + } diff --git a/verify-ld-so-abi.sh b/verify-ld-so-abi.sh new file mode 100644 index 0000000..066847e --- /dev/null +++ b/verify-ld-so-abi.sh @@ -0,0 +1,101 @@ +#!/bin/bash +# +# This script verifies the ABI of ld.so by comparing the layout of +# critical data structures against a known baseline for a given architecture. +# +# This is useful to prevent unintentional ABI breaks between releases. +# +# Usage: ./elf/verify-ld-so-abi.sh [--generate-baseline] + +set -euo pipefail + +if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then + echo "Usage: $0 [--generate-baseline]" + exit 1 +fi + +ARCH="$1" +LDSO_PATH="$2" +GENERATE_BASELINE=false +if [ "${3:-}" == "--generate-baseline" ]; then + GENERATE_BASELINE=true +fi + +# The script is expected to be in the 'elf' directory and run from the glibc root. +SCRIPT_DIR="$(dirname "$0")" +BASELINE_DIR="$SCRIPT_DIR" +BASELINE_FILE="$BASELINE_DIR/ld-so-abi-$ARCH.baseline" + +# List of structs and global variables to check in ld.so. +# These are critical for the dynamic linker's internal ABI. +SYMBOLS_TO_CHECK=( + "_rtld_global_ro" + "_rtld_global" + "struct link_map" + "struct pthread" +) + +# Check for dependencies. +if ! command -v gdb &> /dev/null; then + echo "Error: gdb is not installed. Please install it to continue." >&2 + exit 127 +fi + +if [ ! -f "$LDSO_PATH" ]; then + echo "Error: ld.so not found at '$LDSO_PATH'" >&2 + exit 1 +fi + +TEMP_FILE=$(mktemp) +# Ensure the temporary file is cleaned up on script exit. +trap 'rm -f "$TEMP_FILE"' EXIT + +echo "Generating current ABI layout for '$ARCH' from '$LDSO_PATH'..." + +for symbol in "${SYMBOLS_TO_CHECK[@]}"; do + echo "--- $symbol ---" >> "$TEMP_FILE" + # Use ptype/o to get the struct layout with offsets. + # If a symbol does not exist, GDB will exit with an error, which is + # caught by 'set -e'. + gdb -batch -ex "ptype/o $symbol" "$LDSO_PATH" >> "$TEMP_FILE" +done + +if [ "$GENERATE_BASELINE" = true ]; then + echo "Generating new baseline for '$ARCH'..." + mkdir -p "$BASELINE_DIR" + # Atomically move the new baseline into place. + mv "$TEMP_FILE" "$BASELINE_FILE" + echo "Baseline created at $BASELINE_FILE" + # The temp file has been moved, so disable the trap. + trap - EXIT + exit 0 +fi + +# --- Comparison Mode --- + +if [ ! -f "$BASELINE_FILE" ]; then + echo "Error: Baseline file for architecture '$ARCH' does not exist." >&2 + echo "Path: $BASELINE_FILE" >&2 + echo >&2 + echo "To generate a new baseline, run this command with the --generate-baseline flag:" >&2 + echo "$0 $ARCH '$LDSO_PATH' --generate-baseline" >&2 + exit 77 +fi + +echo "Comparing with baseline file: $BASELINE_FILE" + +# Compare the generated layout with the official baseline. +if ! diff -u "$BASELINE_FILE" "$TEMP_FILE"; then + echo >&2 + echo "Error: ABI layout mismatch for '$ARCH' has been detected." >&2 + echo "The layout of structs in '$LDSO_PATH' has changed." >&2 + echo >&2 + echo "If this change is intentional, update the baseline file by running:" >&2 + echo "$0 $ARCH '$LDSO_PATH' --generate-baseline" >&2 + echo "or apply the diff output using 'patch -R'" + exit 1 +else + echo "OK: ABI layout for '$ARCH' is consistent with the baseline." + exit 0 +fi +