女篮世界杯分组

glibc库版本查看和动态库增加可执行属性

文章目录

glibc库版本查看和动态库增加可执行属性

1.查看当前glibc版本

2. 动态库增加版本信息

3. 源码下载

1.查看当前glibc版本

查看当前系统的glibc版本:

#/lib/libc.so.6

#/lib/x86-64-linux/libc.so.6

➜ ~ /lib64/libc.so.6

GNU C Library (GNU libc) stable release version 2.17, by Roland McGrath et al.

Copyright (C) 2012 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.

Compiled by GNU CC version 4.8.5 20150623 (Red Hat 4.8.5-44).

Compiled on a Linux 3.10.0 system on 2021-02-08.

Available extensions:

The C stubs add-on version 2.1.2.

crypt add-on version 2.1 by Michael Glad and others

GNU Libidn by Simon Josefsson

Native POSIX Threads Library by Ulrich Drepper et al

BIND-8.2.3-T5B

RT using linux kernel aio

libc ABIs: UNIQUE IFUNC

For bug reporting instructions, please see:

.

# 因为ldd命令也是glibc提供的,所以也能查看

➜ ~ ldd --version

ldd (GNU libc) 2.17

Copyright (C) 2012 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Written by Roland McGrath and Ulrich Drepper.

为什么这个库可以直接run呢? 原来在libc的代码中有一点小手脚:

Makerules:708:

# Give libc.so an entry point and make it directly runnable itself.

LDFLAGS-c.so += -e __libc_main

查看__libc_main函数的实现

/* Copyright (C) 1992-2018 Free Software Foundation, Inc.

This file is part of the GNU C Library.

The GNU C Library is free software; you can redistribute it and/or

modify it under the terms of the GNU Lesser General Public

License as published by the Free Software Foundation; either

version 2.1 of the License, or (at your option) any later version.

The GNU C Library is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU

Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public

License along with the GNU C Library; if not, see

. */

#include "version.h"