Linux: dev: glibc: GL 定义
2023-12-29 15:42:38
今天找到了这个GL的定义,记录一下,费了一些劲才找到的。(没有想到的是#和define之间还有空格,导致一直搜不到想要的结果。)是在sysdeps/generic/ldsodefs.h文件中。依赖于SHARED和rtld的定义。
#ifndef SHARED
# define EXTERN extern
# define GL(name) _##name
#else
# define EXTERN
# if IS_IN (rtld)
# define GL(name) _rtld_local._##name
# else
# define GL(name) _rtld_global._##name
# endif
从当前RHEL8上的dump,可用看到如下的定义:
(gdb) ptype _rtld_local
type = struct rtld_global {
struct link_namespaces _dl_ns[16];
size_t _dl_nns;
__rtld_lock_recursive_t _dl_load_lock;
__rtld_lock_recursive_t _dl_load_write_lock;
__rtld_lock_recursive_t _dl_load_tls_lock;
unsigned long long _dl_load_adds;
struct link_map *_dl_initfirst;
struct link_map *_dl_profile_map;
unsigned long _dl_num_relocations;
unsigned long _dl_num_cache_relocations;
struct r_search_path_elem *_dl_all_dirs;
struct link_map _dl_rtld_map;
struct auditstate audit_data[16];
void (*_dl_rtld_lock_recursive)(void *);
void (*_dl_rtld_unlock_recursive)(void *);
unsigned int _dl_x86_feature_1;
struct dl_x86_feature_control _dl_x86_feature_control;
int (*_dl_make_stack_executable_hook)(void **);
Elf64_Word _dl_stack_flags;
_Bool _dl_tls_dtv_gaps;
size_t _dl_tls_max_dtv_idx;
struct dtv_slotinfo_list *_dl_tls_dtv_slotinfo_list;
size_t _dl_tls_static_nelem;
size_t _dl_tls_static_size;
size_t _dl_tls_static_used;
size_t _dl_tls_static_align;
size_t _dl_tls_static_optional;
void *_dl_initial_dtv;
size_t _dl_tls_generation;
void (*_dl_init_static_tls)(struct link_map *);
void (*_dl_wait_lookup_done)(void);
struct dl_scope_free_list *_dl_scope_free_list;
}
(gdb) ptyp _rtld_local._dl_rtld_map.l_info
type = struct {
Elf64_Sxword d_tag;
union {
Elf64_Xword d_val;
Elf64_Addr d_ptr;
} d_un;
} *[77]
(gdb) p _rtld_local
$4 = {
_dl_ns = {{
_ns_loaded = 0x0,
_ns_nloaded = 0,
_ns_main_searchlist = 0x0,
GL(dl_load_lock);所以这个的定义就是一个全局结构体里的一个成员。
文章来源:https://blog.csdn.net/qq_36428903/article/details/135289451
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!