// https://python3-cookbook.readthedocs.io/zh_CN/latest/c15/p02_write_simple_c_extension_module.html
// http://book.pythontips.com/en/latest/python_c_extension.html
// https://github.com/python/cpython/blob/master/Modules/_testimportmultiple.c
 
// https://python3-cookbook.readthedocs.io/zh_CN/latest/c15/p02_write_simple_c_extension_module.html
// http://book.pythontips.com/en/latest/python_c_extension.html
// https://github.com/python/cpython/blob/master/Modules/_testimportmultiple.c // Python.h has all the required function definitions to manipulate the Python objects #include <Python.h>
//This is the function that is called from your python code
static PyObject *add(PyObject *self, PyObject *args)
{ PyObject *listObj; //The input arguments come as a tuple, we parse the args to get the various variables
//In this case it's only one list variable, which will now be referenced by listObj
if (!PyArg_ParseTuple(args, "O", &listObj))
return NULL; //length of the list
long length = PyList_Size(listObj); //iterate over all the elements
long i, sum = 0;
for (i = 0; i < length; i++)
{
//get an element out of the list - the element is also a python objects
PyObject *temp = PyList_GetItem(listObj, i);
//we know that object represents an integer - so convert it into C long
long elem = PyLong_AsLong(temp);
sum += elem;
} //value returned back to python code - another python object
//build value here converts the C long to a python integer
return Py_BuildValue("i", sum);
} /* This table contains the relavent info mapping -
<function-name in python module>, <actual-function>,
<type-of-args the function expects>, <docstring associated with the function>
*/
/* Module method table */
static PyMethodDef AddListMethods[] = {{"add", add, METH_VARARGS, "Greatest add"}, {NULL, NULL, 0, NULL}}; static struct PyModuleDef addListmodule = {PyModuleDef_HEAD_INIT, "addList", "A addList module", -1, AddListMethods}; /*
addList is the module name, and this is the initialization block of the module.
<desired module name>, <the-info-table>, <module's-docstring>
*/
PyMODINIT_FUNC PyInit_addList(void)
{
return PyModule_Create(&addListmodule);
}

  

from distutils.core import setup, Extension
# https://docs.python.org/3/extending/building.html#building
modulel1 = Extension('addList', ['adder.c'])
setup(name='addList', version='1.0',
description='This is a demo package',
author='Martin v. Loewis',
author_email='martin@v.loewis.de',
url='https://docs.python.org/extending/building',
long_description='''
This is really just a demo package.
''', ext_modules=[modulel1])

  

[cpy@localhost extendingCpy]$ sudo py380 setup.py install
running install
running build
running build_ext
building 'addList' extension
creating build
creating build/temp.linux-x86_64-3.8
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.8 -c adder.c -o build/temp.linux-x86_64-3.8/adder.o
creating build/lib.linux-x86_64-3.8
gcc -pthread -shared build/temp.linux-x86_64-3.8/adder.o -o build/lib.linux-x86_64-3.8/addList.cpython-38-x86_64-linux-gnu.so
running install_lib
copying build/lib.linux-x86_64-3.8/addList.cpython-38-x86_64-linux-gnu.so -> /usr/local/lib/python3.8/site-packages
running install_egg_info
Removing /usr/local/lib/python3.8/site-packages/addList-1.0-py3.8.egg-info
Writing /usr/local/lib/python3.8/site-packages/addList-1.0-py3.8.egg-info
[cpy@localhost extendingCpy]$ py380 t.add.py
Sum of List - [1, 2, 3, 4, 5] 15
[cpy@localhost extendingCpy]$ cat /usr/local/lib/python3.8/site-packages/addList-1.0-py3.8.egg-info
Metadata-Version: 1.0
Name: addList
Version: 1.0
Summary: This is a demo package
Home-page: https://docs.python.org/extending/building
Author: Martin v. Loewis
Author-email: martin@v.loewis.de
License: UNKNOWN
Description:
This is really just a demo package. Platform: UNKNOWN
[cpy@localhost extendingCpy]$

  

import addList
l = [1, 2, 3, 4, 5]
print("Sum of List - ", l, addList.add(l))

  

[cpy@localhost extendingCpy]$ ll -as /usr/local/lib/python3.8/site-packages/
总用量 48
0 drwxr-xr-x 8 root root 259 11月 25 14:43 .
12 drwxr-xr-x 35 root root 8192 11月 25 13:17 ..
4 -rw-r--r-- 1 root root 295 11月 25 14:43 addList-1.0-py3.8.egg-info
20 -rwxr-xr-x 1 root root 18496 11月 25 14:43 addList.cpython-38-x86_64-linux-g nu.so
4 -rw-r--r-- 1 root root 126 11月 25 12:30 easy_install.py
0 drwxr-xr-x 5 root root 95 11月 25 12:30 pip
0 drwxr-xr-x 2 root root 130 11月 25 12:30 pip-19.2.3.dist-info
0 drwxr-xr-x 5 root root 94 11月 25 12:30 pkg_resources
0 drwxr-xr-x 2 root root 123 11月 25 13:18 __pycache__
4 -rw-r--r-- 1 root root 119 11月 25 13:17 README.txt
4 drwxr-xr-x 6 root root 4096 11月 25 12:30 setuptools
0 drwxr-xr-x 2 root root 170 11月 25 12:30 setuptools-41.2.0.dist-info
[cpy@localhost extendingCpy]$ tree build/
build/
├── lib.linux-x86_64-3.8
│   └── addList.cpython-38-x86_64-linux-gnu.so
└── temp.linux-x86_64-3.8
└── adder.o 2 directories, 2 files
[cpy@localhost extendingCpy]$ readelf -a build/temp.linux-x86_64-3.8/adder.o
ELF 头:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
类别: ELF64
数据: 2 补码,小端序 (little endian)
版本: 1 (current)
OS/ABI: UNIX - System V
ABI 版本: 0
类型: REL (可重定位文件)
系统架构: Advanced Micro Devices X86-64
版本: 0x1
入口点地址: 0x0
程序头起点: 0 (bytes into file)
Start of section headers: 18600 (bytes into file)
标志: 0x0
本头的大小: 64 (字节)
程序头大小: 0 (字节)
Number of program headers: 0
节头大小: 64 (字节)
节头数量: 25
字符串表索引节头: 24 节头:
[号] 名称 类型 地址 偏移量
大小 全体大小 旗标 链接 信息 对齐
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .text PROGBITS 0000000000000000 00000040
0000000000000091 0000000000000000 AX 0 0 16
[ 2] .rela.text RELA 0000000000000000 000029f0
00000000000000d8 0000000000000018 I 22 1 8
[ 3] .data PROGBITS 0000000000000000 000000d1
0000000000000000 0000000000000000 WA 0 0 1
[ 4] .bss NOBITS 0000000000000000 000000d1
0000000000000000 0000000000000000 WA 0 0 1
[ 5] .rodata.str1.1 PROGBITS 0000000000000000 000000d1
000000000000002e 0000000000000001 AMS 0 0 1
[ 6] .data.rel.local PROGBITS 0000000000000000 00000100
00000000000000c0 0000000000000000 WA 0 0 32
[ 7] .rela.data.rel.lo RELA 0000000000000000 00002ac8
0000000000000090 0000000000000018 I 22 6 8
[ 8] .debug_info PROGBITS 0000000000000000 000001c0
00000000000011eb 0000000000000000 0 0 1
[ 9] .rela.debug_info RELA 0000000000000000 00002b58
0000000000001bf0 0000000000000018 I 22 8 8
[10] .debug_abbrev PROGBITS 0000000000000000 000013ab
0000000000000214 0000000000000000 0 0 1
[11] .debug_loc PROGBITS 0000000000000000 000015bf
00000000000001aa 0000000000000000 0 0 1
[12] .debug_aranges PROGBITS 0000000000000000 00001769
0000000000000030 0000000000000000 0 0 1
[13] .rela.debug_arang RELA 0000000000000000 00004748
0000000000000030 0000000000000018 I 22 12 8
[14] .debug_ranges PROGBITS 0000000000000000 00001799
0000000000000030 0000000000000000 0 0 1
[15] .debug_line PROGBITS 0000000000000000 000017c9
00000000000001c1 0000000000000000 0 0 1
[16] .rela.debug_line RELA 0000000000000000 00004778
0000000000000018 0000000000000018 I 22 15 8
[17] .debug_str PROGBITS 0000000000000000 0000198a
0000000000000c4f 0000000000000001 MS 0 0 1
[18] .comment PROGBITS 0000000000000000 000025d9
000000000000002e 0000000000000001 MS 0 0 1
[19] .note.GNU-stack PROGBITS 0000000000000000 00002607
0000000000000000 0000000000000000 0 0 1
[20] .eh_frame PROGBITS 0000000000000000 00002608
0000000000000060 0000000000000000 A 0 0 8
[21] .rela.eh_frame RELA 0000000000000000 00004790
0000000000000030 0000000000000018 I 22 20 8
[22] .symtab SYMTAB 0000000000000000 00002668
00000000000002d0 0000000000000018 23 22 8
[23] .strtab STRTAB 0000000000000000 00002938
00000000000000b2 0000000000000000 0 0 1
[24] .shstrtab STRTAB 0000000000000000 000047c0
00000000000000e5 0000000000000000 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
l (large), p (processor specific) There are no section groups in this file. 本文件中没有程序头。 重定位节 '.rela.text' 位于偏移量 0x29f0 含有 9 个条目:
偏移量 信息 类型 符号值 符号名称 + 加数
000000000008 001300000002 R_X86_64_PC32 0000000000000000 .LC0 - 4
000000000018 001700000004 R_X86_64_PLT32 0000000000000000 PyArg_ParseTuple - 4
00000000002b 001800000004 R_X86_64_PLT32 0000000000000000 PyList_Size - 4
00000000004c 001900000004 R_X86_64_PLT32 0000000000000000 PyList_GetItem - 4
000000000054 001a00000004 R_X86_64_PLT32 0000000000000000 PyLong_AsLong - 4
000000000063 001400000002 R_X86_64_PC32 0000000000000002 .LC1 - 4
00000000006d 001b00000004 R_X86_64_PLT32 0000000000000000 Py_BuildValue - 4
000000000083 000800000002 R_X86_64_PC32 0000000000000000 .data.rel.local - 4
00000000008d 001d00000004 R_X86_64_PLT32 0000000000000000 PyModule_Create2 - 4 重定位节 '.rela.data.rel.local' 位于偏移量 0x2ac8 含有 6 个条目:
偏移量 信息 类型 符号值 符号名称 + 加数
000000000028 000500000001 R_X86_64_64 0000000000000000 .rodata.str1.1 + 4
000000000030 000500000001 R_X86_64_64 0000000000000000 .rodata.str1.1 + c
000000000040 000800000001 R_X86_64_64 0000000000000000 .data.rel.local + 80
000000000080 000500000001 R_X86_64_64 0000000000000000 .rodata.str1.1 + 1d
000000000088 000200000001 R_X86_64_64 0000000000000000 .text + 0
000000000098 000500000001 R_X86_64_64 0000000000000000 .rodata.str1.1 + 21 重定位节 '.rela.debug_info' 位于偏移量 0x2b58 含有 298 个条目:
偏移量 信息 类型 符号值 符号名称 + 加数
000000000006 000b0000000a R_X86_64_32 0000000000000000 .debug_abbrev + 0
00000000000c 00100000000a R_X86_64_32 0000000000000000 .debug_str + a3c
000000000011 00100000000a R_X86_64_32 0000000000000000 .debug_str + 261
000000000015 00100000000a R_X86_64_32 0000000000000000 .debug_str + 54c
000000000019 000200000001 R_X86_64_64 0000000000000000 .text + 0
000000000029 000f0000000a R_X86_64_32 0000000000000000 .debug_line + 0
00000000002e 00100000000a R_X86_64_32 0000000000000000 .debug_str + 0
00000000003b 00100000000a R_X86_64_32 0000000000000000 .debug_str + 4cc
000000000042 00100000000a R_X86_64_32 0000000000000000 .debug_str + 28c
000000000049 00100000000a R_X86_64_32 0000000000000000 .debug_str + bbc
000000000050 00100000000a R_X86_64_32 0000000000000000 .debug_str + 6ee
000000000057 00100000000a R_X86_64_32 0000000000000000 .debug_str + 73
00000000005e 00100000000a R_X86_64_32 0000000000000000 .debug_str + a1f
00000000006c 00100000000a R_X86_64_32 0000000000000000 .debug_str + 1ed
000000000071 00100000000a R_X86_64_32 0000000000000000 .debug_str + 8a0
00000000007c 00100000000a R_X86_64_32 0000000000000000 .debug_str + 983
000000000089 00100000000a R_X86_64_32 0000000000000000 .debug_str + 7
000000000090 00100000000a R_X86_64_32 0000000000000000 .debug_str + 48
0000000000a3 00100000000a R_X86_64_32 0000000000000000 .debug_str + 33e
0000000000a8 00100000000a R_X86_64_32 0000000000000000 .debug_str + 829
0000000000b3 00100000000a R_X86_64_32 0000000000000000 .debug_str + 269
0000000000bf 00100000000a R_X86_64_32 0000000000000000 .debug_str + 78e
0000000000cb 00100000000a R_X86_64_32 0000000000000000 .debug_str + 36e
0000000000d7 00100000000a R_X86_64_32 0000000000000000 .debug_str + b64
0000000000e3 00100000000a R_X86_64_32 0000000000000000 .debug_str + 509
0000000000ef 00100000000a R_X86_64_32 0000000000000000 .debug_str + d3
0000000000fb 00100000000a R_X86_64_32 0000000000000000 .debug_str + bef
000000000108 00100000000a R_X86_64_32 0000000000000000 .debug_str + 653
000000000115 00100000000a R_X86_64_32 0000000000000000 .debug_str + 6e1
000000000122 00100000000a R_X86_64_32 0000000000000000 .debug_str + 9e6
00000000012f 00100000000a R_X86_64_32 0000000000000000 .debug_str + 136
00000000013c 00100000000a R_X86_64_32 0000000000000000 .debug_str + 92e
000000000149 00100000000a R_X86_64_32 0000000000000000 .debug_str + 7f
000000000156 00100000000a R_X86_64_32 0000000000000000 .debug_str + 39f
000000000163 00100000000a R_X86_64_32 0000000000000000 .debug_str + 14c
000000000170 00100000000a R_X86_64_32 0000000000000000 .debug_str + b94
00000000017d 00100000000a R_X86_64_32 0000000000000000 .debug_str + 4f5
00000000018a 00100000000a R_X86_64_32 0000000000000000 .debug_str + 589
000000000197 00100000000a R_X86_64_32 0000000000000000 .debug_str + 15b
0000000001a4 00100000000a R_X86_64_32 0000000000000000 .debug_str + aac
0000000001b1 00100000000a R_X86_64_32 0000000000000000 .debug_str + 93e
0000000001be 00100000000a R_X86_64_32 0000000000000000 .debug_str + e2
0000000001cb 00100000000a R_X86_64_32 0000000000000000 .debug_str + 445
0000000001d8 00100000000a R_X86_64_32 0000000000000000 .debug_str + 715
0000000001e5 00100000000a R_X86_64_32 0000000000000000 .debug_str + 71c
0000000001f2 00100000000a R_X86_64_32 0000000000000000 .debug_str + 723
0000000001ff 00100000000a R_X86_64_32 0000000000000000 .debug_str + 72a
00000000020c 00100000000a R_X86_64_32 0000000000000000 .debug_str + 731
000000000219 00100000000a R_X86_64_32 0000000000000000 .debug_str + 795
000000000226 00100000000a R_X86_64_32 0000000000000000 .debug_str + 521
000000000234 00100000000a R_X86_64_32 0000000000000000 .debug_str + 35b
00000000023b 00100000000a R_X86_64_32 0000000000000000 .debug_str + 216
000000000247 00100000000a R_X86_64_32 0000000000000000 .debug_str + 97d
000000000253 00100000000a R_X86_64_32 0000000000000000 .debug_str + 745
00000000025f 00100000000a R_X86_64_32 0000000000000000 .debug_str + 37b
0000000002a9 00100000000a R_X86_64_32 0000000000000000 .debug_str + 153
0000000002b6 00100000000a R_X86_64_32 0000000000000000 .debug_str + 5da
0000000002bd 00100000000a R_X86_64_32 0000000000000000 .debug_str + 86e
0000000002c2 00100000000a R_X86_64_32 0000000000000000 .debug_str + 88c
0000000002cd 00100000000a R_X86_64_32 0000000000000000 .debug_str + 1e3
0000000002da 00100000000a R_X86_64_32 0000000000000000 .debug_str + 6b6
0000000002e1 00100000000a R_X86_64_32 0000000000000000 .debug_str + 63b
0000000002ee 00100000000a R_X86_64_32 0000000000000000 .debug_str + 845
0000000002f4 00100000000a R_X86_64_32 0000000000000000 .debug_str + bb
0000000002fa 00100000000a R_X86_64_32 0000000000000000 .debug_str + 672
000000000301 00100000000a R_X86_64_32 0000000000000000 .debug_str + a96
00000000030d 00100000000a R_X86_64_32 0000000000000000 .debug_str + 20a
000000000319 00100000000a R_X86_64_32 0000000000000000 .debug_str + 578
000000000325 00100000000a R_X86_64_32 0000000000000000 .debug_str + 4de
000000000331 00100000000a R_X86_64_32 0000000000000000 .debug_str + 8d8
00000000033e 00100000000a R_X86_64_32 0000000000000000 .debug_str + 196
00000000034a 00100000000a R_X86_64_32 0000000000000000 .debug_str + 1d9
000000000356 00100000000a R_X86_64_32 0000000000000000 .debug_str + bad
000000000363 00100000000a R_X86_64_32 0000000000000000 .debug_str + 56c
000000000370 00100000000a R_X86_64_32 0000000000000000 .debug_str + b81
00000000037c 00100000000a R_X86_64_32 0000000000000000 .debug_str + 18e
000000000388 00100000000a R_X86_64_32 0000000000000000 .debug_str + 9fb
000000000394 00100000000a R_X86_64_32 0000000000000000 .debug_str + a30
0000000003a0 00100000000a R_X86_64_32 0000000000000000 .debug_str + 68
0000000003ac 00100000000a R_X86_64_32 0000000000000000 .debug_str + 310
0000000003b8 00100000000a R_X86_64_32 0000000000000000 .debug_str + 9db
0000000003c4 00100000000a R_X86_64_32 0000000000000000 .debug_str + 46f
0000000003d0 00100000000a R_X86_64_32 0000000000000000 .debug_str + 8a8
0000000003dc 00100000000a R_X86_64_32 0000000000000000 .debug_str + 9b
0000000003e8 00100000000a R_X86_64_32 0000000000000000 .debug_str + aea
0000000003f4 00100000000a R_X86_64_32 0000000000000000 .debug_str + 8c
000000000400 00100000000a R_X86_64_32 0000000000000000 .debug_str + 44d
00000000040c 00100000000a R_X86_64_32 0000000000000000 .debug_str + 366
000000000418 00100000000a R_X86_64_32 0000000000000000 .debug_str + 6ae
000000000424 00100000000a R_X86_64_32 0000000000000000 .debug_str + 4c5
000000000430 00100000000a R_X86_64_32 0000000000000000 .debug_str + 393
00000000043c 00100000000a R_X86_64_32 0000000000000000 .debug_str + 7c3
000000000448 00100000000a R_X86_64_32 0000000000000000 .debug_str + 948
000000000454 00100000000a R_X86_64_32 0000000000000000 .debug_str + 580
000000000460 00100000000a R_X86_64_32 0000000000000000 .debug_str + 285
00000000046c 00100000000a R_X86_64_32 0000000000000000 .debug_str + 416
000000000478 00100000000a R_X86_64_32 0000000000000000 .debug_str + 6a5
000000000484 00100000000a R_X86_64_32 0000000000000000 .debug_str + 52
000000000490 00100000000a R_X86_64_32 0000000000000000 .debug_str + 167
00000000049c 00100000000a R_X86_64_32 0000000000000000 .debug_str + 221
0000000004a8 00100000000a R_X86_64_32 0000000000000000 .debug_str + 699
0000000004b4 00100000000a R_X86_64_32 0000000000000000 .debug_str + 12b
0000000004c0 00100000000a R_X86_64_32 0000000000000000 .debug_str + 765
0000000004cc 00100000000a R_X86_64_32 0000000000000000 .debug_str + 918
0000000004d8 00100000000a R_X86_64_32 0000000000000000 .debug_str + 2f1
0000000004e5 00100000000a R_X86_64_32 0000000000000000 .debug_str + 3e7
0000000004f2 00100000000a R_X86_64_32 0000000000000000 .debug_str + bd6
0000000004ff 00100000000a R_X86_64_32 0000000000000000 .debug_str + 3bd
00000000050c 00100000000a R_X86_64_32 0000000000000000 .debug_str + c41
000000000519 00100000000a R_X86_64_32 0000000000000000 .debug_str + 144
000000000526 00100000000a R_X86_64_32 0000000000000000 .debug_str + 8bd
000000000533 00100000000a R_X86_64_32 0000000000000000 .debug_str + b9c
000000000540 00100000000a R_X86_64_32 0000000000000000 .debug_str + 2ba
00000000054d 00100000000a R_X86_64_32 0000000000000000 .debug_str + 179
00000000055a 00100000000a R_X86_64_32 0000000000000000 .debug_str + 122
000000000567 00100000000a R_X86_64_32 0000000000000000 .debug_str + 1a5
000000000574 00100000000a R_X86_64_32 0000000000000000 .debug_str + 9f2
000000000581 00100000000a R_X86_64_32 0000000000000000 .debug_str + c2b
00000000058e 00100000000a R_X86_64_32 0000000000000000 .debug_str + 922
00000000059b 00100000000a R_X86_64_32 0000000000000000 .debug_str + b7a
0000000005a8 00100000000a R_X86_64_32 0000000000000000 .debug_str + 9cc
0000000005b5 00100000000a R_X86_64_32 0000000000000000 .debug_str + b39
0000000005c3 00100000000a R_X86_64_32 0000000000000000 .debug_str + 955
0000000005d1 00100000000a R_X86_64_32 0000000000000000 .debug_str + 9c3
0000000005e6 00100000000a R_X86_64_32 0000000000000000 .debug_str + 690
0000000005f9 00100000000a R_X86_64_32 0000000000000000 .debug_str + b81
000000000605 00100000000a R_X86_64_32 0000000000000000 .debug_str + 688
000000000612 00100000000a R_X86_64_32 0000000000000000 .debug_str + 3a8
00000000061d 00100000000a R_X86_64_32 0000000000000000 .debug_str + 40c
000000000643 00100000000a R_X86_64_32 0000000000000000 .debug_str + a14
000000000668 00100000000a R_X86_64_32 0000000000000000 .debug_str + 1bc
000000000692 00100000000a R_X86_64_32 0000000000000000 .debug_str + 6d9
0000000006b2 00100000000a R_X86_64_32 0000000000000000 .debug_str + 3ca
0000000006d2 00100000000a R_X86_64_32 0000000000000000 .debug_str + 5b9
0000000006f7 00100000000a R_X86_64_32 0000000000000000 .debug_str + a3
000000000721 00100000000a R_X86_64_32 0000000000000000 .debug_str + 963
00000000074b 00100000000a R_X86_64_32 0000000000000000 .debug_str + 10
000000000770 00100000000a R_X86_64_32 0000000000000000 .debug_str + 83b
000000000795 00100000000a R_X86_64_32 0000000000000000 .debug_str + 489
0000000007bf 00100000000a R_X86_64_32 0000000000000000 .debug_str + 8fb
0000000007db 00100000000a R_X86_64_32 0000000000000000 .debug_str + b89
0000000007f7 00100000000a R_X86_64_32 0000000000000000 .debug_str + b1c
00000000081c 00100000000a R_X86_64_32 0000000000000000 .debug_str + 386
000000000827 00100000000a R_X86_64_32 0000000000000000 .debug_str + 770
000000000851 00100000000a R_X86_64_32 0000000000000000 .debug_str + b0f
00000000085c 00100000000a R_X86_64_32 0000000000000000 .debug_str + 3b4
000000000867 00100000000a R_X86_64_32 0000000000000000 .debug_str + 785
000000000887 00100000000a R_X86_64_32 0000000000000000 .debug_str + 98d
0000000008b1 00100000000a R_X86_64_32 0000000000000000 .debug_str + 4fd
0000000008bc 00100000000a R_X86_64_32 0000000000000000 .debug_str + 7f3
0000000008c7 00100000000a R_X86_64_32 0000000000000000 .debug_str + 82e
0000000008d2 00100000000a R_X86_64_32 0000000000000000 .debug_str + 738
0000000008dd 00100000000a R_X86_64_32 0000000000000000 .debug_str + 897
0000000008e8 00100000000a R_X86_64_32 0000000000000000 .debug_str + 43d
000000000912 00100000000a R_X86_64_32 0000000000000000 .debug_str + 23e
000000000937 00100000000a R_X86_64_32 0000000000000000 .debug_str + b28
000000000967 00100000000a R_X86_64_32 0000000000000000 .debug_str + 3de
000000000973 00100000000a R_X86_64_32 0000000000000000 .debug_str + 5b0
00000000097f 00100000000a R_X86_64_32 0000000000000000 .debug_str + 356
00000000098b 00100000000a R_X86_64_32 0000000000000000 .debug_str + 4e9
000000000997 00100000000a R_X86_64_32 0000000000000000 .debug_str + b57
0000000009a3 00100000000a R_X86_64_32 0000000000000000 .debug_str + b3
0000000009af 00100000000a R_X86_64_32 0000000000000000 .debug_str + 6fb
0000000009bb 00100000000a R_X86_64_32 0000000000000000 .debug_str + 642
0000000009ce 00100000000a R_X86_64_32 0000000000000000 .debug_str + 2d6
0000000009d9 00100000000a R_X86_64_32 0000000000000000 .debug_str + e8
000000000a09 00100000000a R_X86_64_32 0000000000000000 .debug_str + 109
000000000a2a 00100000000a R_X86_64_32 0000000000000000 .debug_str + 609
000000000a6d 00100000000a R_X86_64_32 0000000000000000 .debug_str + f6
000000000a79 00100000000a R_X86_64_32 0000000000000000 .debug_str + fd
000000000a85 00100000000a R_X86_64_32 0000000000000000 .debug_str + ade
000000000a91 00100000000a R_X86_64_32 0000000000000000 .debug_str + 325
000000000a9d 00100000000a R_X86_64_32 0000000000000000 .debug_str + 248
000000000aa9 00100000000a R_X86_64_32 0000000000000000 .debug_str + bfd
000000000ab5 00100000000a R_X86_64_32 0000000000000000 .debug_str + 3ef
000000000ac1 00100000000a R_X86_64_32 0000000000000000 .debug_str + 759
000000000acd 00100000000a R_X86_64_32 0000000000000000 .debug_str + 182
000000000ad9 00100000000a R_X86_64_32 0000000000000000 .debug_str + 910
000000000ae5 00100000000a R_X86_64_32 0000000000000000 .debug_str + 7e1
000000000af1 00100000000a R_X86_64_32 0000000000000000 .debug_str + 402
000000000afd 00100000000a R_X86_64_32 0000000000000000 .debug_str + 8ce
000000000b09 00100000000a R_X86_64_32 0000000000000000 .debug_str + 4be
000000000b15 00100000000a R_X86_64_32 0000000000000000 .debug_str + 11b
000000000b21 00100000000a R_X86_64_32 0000000000000000 .debug_str + b33
000000000b2d 00100000000a R_X86_64_32 0000000000000000 .debug_str + 61
000000000b39 00100000000a R_X86_64_32 0000000000000000 .debug_str + 30
000000000b45 00100000000a R_X86_64_32 0000000000000000 .debug_str + 2b1
000000000b51 00100000000a R_X86_64_32 0000000000000000 .debug_str + 47a
000000000b5d 00100000000a R_X86_64_32 0000000000000000 .debug_str + 45b
000000000b69 00100000000a R_X86_64_32 0000000000000000 .debug_str + 1f6
000000000b75 00100000000a R_X86_64_32 0000000000000000 .debug_str + 1b
000000000b81 00100000000a R_X86_64_32 0000000000000000 .debug_str + 2ff
000000000b8d 00100000000a R_X86_64_32 0000000000000000 .debug_str + 5e8
000000000b99 00100000000a R_X86_64_32 0000000000000000 .debug_str + acc
000000000ba5 00100000000a R_X86_64_32 0000000000000000 .debug_str + 8e3
000000000bb1 00100000000a R_X86_64_32 0000000000000000 .debug_str + 496
000000000bbd 00100000000a R_X86_64_32 0000000000000000 .debug_str + 229
000000000bc9 00100000000a R_X86_64_32 0000000000000000 .debug_str + 1ac
000000000bd5 00100000000a R_X86_64_32 0000000000000000 .debug_str + 252
000000000be1 00100000000a R_X86_64_32 0000000000000000 .debug_str + af7
000000000bed 00100000000a R_X86_64_32 0000000000000000 .debug_str + 29a
000000000bfa 00100000000a R_X86_64_32 0000000000000000 .debug_str + 8b4
000000000c07 00100000000a R_X86_64_32 0000000000000000 .debug_str + 343
000000000c14 00100000000a R_X86_64_32 0000000000000000 .debug_str + 422
000000000c22 00100000000a R_X86_64_32 0000000000000000 .debug_str + 52a
000000000c35 00100000000a R_X86_64_32 0000000000000000 .debug_str + ba3
000000000c41 00100000000a R_X86_64_32 0000000000000000 .debug_str + 517
000000000c4d 00100000000a R_X86_64_32 0000000000000000 .debug_str + 2c2
000000000c59 00100000000a R_X86_64_32 0000000000000000 .debug_str + 7bb
000000000c65 00100000000a R_X86_64_32 0000000000000000 .debug_str + c0b
000000000c71 00100000000a R_X86_64_32 0000000000000000 .debug_str + 971
000000000c7d 00100000000a R_X86_64_32 0000000000000000 .debug_str + 7aa
000000000c89 00100000000a R_X86_64_32 0000000000000000 .debug_str + 904
000000000c95 00100000000a R_X86_64_32 0000000000000000 .debug_str + 7cf
000000000ca1 00100000000a R_X86_64_32 0000000000000000 .debug_str + 53a
000000000cae 00100000000a R_X86_64_32 0000000000000000 .debug_str + b45
000000000cc1 00100000000a R_X86_64_32 0000000000000000 .debug_str + 2cc
000000000ccd 00100000000a R_X86_64_32 0000000000000000 .debug_str + 861
000000000cd9 00100000000a R_X86_64_32 0000000000000000 .debug_str + 1c8
000000000ce6 00100000000a R_X86_64_32 0000000000000000 .debug_str + 2e0
000000000cf9 00100000000a R_X86_64_32 0000000000000000 .debug_str + c22
000000000d05 00100000000a R_X86_64_32 0000000000000000 .debug_str + 77c
000000000d11 00100000000a R_X86_64_32 0000000000000000 .debug_str + 8f2
000000000d1e 00100000000a R_X86_64_32 0000000000000000 .debug_str + 79b
000000000d31 00100000000a R_X86_64_32 0000000000000000 .debug_str + 811
000000000d3d 00100000000a R_X86_64_32 0000000000000000 .debug_str + 6bc
000000000d4a 00100000000a R_X86_64_32 0000000000000000 .debug_str + 272
000000000d73 00100000000a R_X86_64_32 0000000000000000 .debug_str + 3c
000000000d7f 00100000000a R_X86_64_32 0000000000000000 .debug_str + c39
000000000d8b 00100000000a R_X86_64_32 0000000000000000 .debug_str + 64b
000000000d97 00100000000a R_X86_64_32 0000000000000000 .debug_str + b71
000000000da3 00100000000a R_X86_64_32 0000000000000000 .debug_str + b5d
000000000db6 00100000000a R_X86_64_32 0000000000000000 .debug_str + 332
000000000dc1 00100000000a R_X86_64_32 0000000000000000 .debug_str + 999
000000000dcd 00100000000a R_X86_64_32 0000000000000000 .debug_str + a08
000000000dfd 00100000000a R_X86_64_32 0000000000000000 .debug_str + 4b6
000000000e35 00100000000a R_X86_64_32 0000000000000000 .debug_str + 6cd
000000000e40 00100000000a R_X86_64_32 0000000000000000 .debug_str + 3c
000000000e51 00100000000a R_X86_64_32 0000000000000000 .debug_str + abb
000000000e5d 00100000000a R_X86_64_32 0000000000000000 .debug_str + b81
000000000e69 00100000000a R_X86_64_32 0000000000000000 .debug_str + 9bc
000000000e75 00100000000a R_X86_64_32 0000000000000000 .debug_str + 5c6
000000000e81 00100000000a R_X86_64_32 0000000000000000 .debug_str + 237
000000000e99 00100000000a R_X86_64_32 0000000000000000 .debug_str + abb
000000000ea4 00100000000a R_X86_64_32 0000000000000000 .debug_str + 661
000000000eb0 00100000000a R_X86_64_32 0000000000000000 .debug_str + be3
000000000ebc 00100000000a R_X86_64_32 0000000000000000 .debug_str + 2f9
000000000ec9 00100000000a R_X86_64_32 0000000000000000 .debug_str + 5ce
000000000ed5 00100000000a R_X86_64_32 0000000000000000 .debug_str + be8
000000000ee1 00100000000a R_X86_64_32 0000000000000000 .debug_str + a0d
000000000eed 00100000000a R_X86_64_32 0000000000000000 .debug_str + 618
000000000ef9 00100000000a R_X86_64_32 0000000000000000 .debug_str + 3fb
000000000f05 00100000000a R_X86_64_32 0000000000000000 .debug_str + c18
000000000f11 00100000000a R_X86_64_32 0000000000000000 .debug_str + 7eb
000000000f1d 00100000000a R_X86_64_32 0000000000000000 .debug_str + 81e
000000000f29 00100000000a R_X86_64_32 0000000000000000 .debug_str + 5a8
000000000f35 00100000000a R_X86_64_32 0000000000000000 .debug_str + bb5
000000000f62 00100000000a R_X86_64_32 0000000000000000 .debug_str + 19e
000000000f6d 00100000000a R_X86_64_32 0000000000000000 .debug_str + a29
000000000fa1 000200000001 R_X86_64_64 0000000000000000 .text + 0
000000000fb8 00100000000a R_X86_64_32 0000000000000000 .debug_str + 4f0
000000000fc2 000c0000000a R_X86_64_32 0000000000000000 .debug_loc + 0
000000000fc7 00100000000a R_X86_64_32 0000000000000000 .debug_str + 5a3
000000000fd1 000c0000000a R_X86_64_32 0000000000000000 .debug_loc + 39
000000000fd6 00100000000a R_X86_64_32 0000000000000000 .debug_str + 8c6
000000000fe4 00100000000a R_X86_64_32 0000000000000000 .debug_str + 885
000000000fee 000c0000000a R_X86_64_32 0000000000000000 .debug_loc + 85
000000000ffb 000c0000000a R_X86_64_32 0000000000000000 .debug_loc + bb
00000000100a 000c0000000a R_X86_64_32 0000000000000000 .debug_loc + 12d
00000000100f 000e0000000a R_X86_64_32 0000000000000000 .debug_ranges + 0
000000001018 00100000000a R_X86_64_32 0000000000000000 .debug_str + c06
000000001022 000c0000000a R_X86_64_32 0000000000000000 .debug_loc + 164
000000001027 00100000000a R_X86_64_32 0000000000000000 .debug_str + 280
000000001031 000c0000000a R_X86_64_32 0000000000000000 .debug_loc + 187
000000001036 000200000001 R_X86_64_64 0000000000000000 .text + 50
00000000104e 000200000001 R_X86_64_64 0000000000000000 .text + 58
00000000105c 000200000001 R_X86_64_64 0000000000000000 .text + 1c
000000001078 000500000001 R_X86_64_64 0000000000000000 .rodata.str1.1 + 0
000000001088 000200000001 R_X86_64_64 0000000000000000 .text + 2f
000000001095 000200000001 R_X86_64_64 0000000000000000 .text + 71
0000000010a6 000500000001 R_X86_64_64 0000000000000000 .rodata.str1.1 + 2
0000000010b7 00100000000a R_X86_64_32 0000000000000000 .debug_str + 61e
0000000010c1 000200000001 R_X86_64_64 0000000000000000 .text + 80
0000000010d8 000200000001 R_X86_64_64 0000000000000000 .text + 91
0000000010e9 000800000001 R_X86_64_64 0000000000000000 .data.rel.local + 0
00000000110b 00100000000a R_X86_64_32 0000000000000000 .debug_str + 5fa
000000001117 000800000001 R_X86_64_64 0000000000000000 .data.rel.local + 80
000000001120 00100000000a R_X86_64_32 0000000000000000 .debug_str + 74b
00000000112c 000800000001 R_X86_64_64 0000000000000000 .data.rel.local + 0
000000001135 00100000000a R_X86_64_32 0000000000000000 .debug_str + 380
000000001140 00100000000a R_X86_64_32 0000000000000000 .debug_str + bcf
00000000114b 00100000000a R_X86_64_32 0000000000000000 .debug_str + 9a5
000000001156 00100000000a R_X86_64_32 0000000000000000 .debug_str + 706
000000001170 00100000000a R_X86_64_32 0000000000000000 .debug_str + 62d
000000001185 00100000000a R_X86_64_32 0000000000000000 .debug_str + 800
0000000011a0 00100000000a R_X86_64_32 0000000000000000 .debug_str + 3d2
0000000011b5 00100000000a R_X86_64_32 0000000000000000 .debug_str + 595
0000000011cb 00100000000a R_X86_64_32 0000000000000000 .debug_str + 4a5 重定位节 '.rela.debug_aranges' 位于偏移量 0x4748 含有 2 个条目:
偏移量 信息 类型 符号值 符号名称 + 加数
000000000006 000a0000000a R_X86_64_32 0000000000000000 .debug_info + 0
000000000010 000200000001 R_X86_64_64 0000000000000000 .text + 0 重定位节 '.rela.debug_line' 位于偏移量 0x4778 含有 1 个条目:
偏移量 信息 类型 符号值 符号名称 + 加数
00000000017c 000200000001 R_X86_64_64 0000000000000000 .text + 0 重定位节 '.rela.eh_frame' 位于偏移量 0x4790 含有 2 个条目:
偏移量 信息 类型 符号值 符号名称 + 加数
000000000020 000200000002 R_X86_64_PC32 0000000000000000 .text + 0
000000000050 000200000002 R_X86_64_PC32 0000000000000000 .text + 80 The decoding of unwind sections for machine type Advanced Micro Devices X86-64 is not currently supported. Symbol table '.symtab' contains 30 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS adder.c
2: 0000000000000000 0 SECTION LOCAL DEFAULT 1
3: 0000000000000000 0 SECTION LOCAL DEFAULT 3
4: 0000000000000000 0 SECTION LOCAL DEFAULT 4
5: 0000000000000000 0 SECTION LOCAL DEFAULT 5
6: 0000000000000000 122 FUNC LOCAL DEFAULT 1 add
7: 0000000000000000 104 OBJECT LOCAL DEFAULT 6 addListmodule
8: 0000000000000000 0 SECTION LOCAL DEFAULT 6
9: 0000000000000080 64 OBJECT LOCAL DEFAULT 6 AddListMethods
10: 0000000000000000 0 SECTION LOCAL DEFAULT 8
11: 0000000000000000 0 SECTION LOCAL DEFAULT 10
12: 0000000000000000 0 SECTION LOCAL DEFAULT 11
13: 0000000000000000 0 SECTION LOCAL DEFAULT 12
14: 0000000000000000 0 SECTION LOCAL DEFAULT 14
15: 0000000000000000 0 SECTION LOCAL DEFAULT 15
16: 0000000000000000 0 SECTION LOCAL DEFAULT 17
17: 0000000000000000 0 SECTION LOCAL DEFAULT 19
18: 0000000000000000 0 SECTION LOCAL DEFAULT 20
19: 0000000000000000 0 NOTYPE LOCAL DEFAULT 5 .LC0
20: 0000000000000002 0 NOTYPE LOCAL DEFAULT 5 .LC1
21: 0000000000000000 0 SECTION LOCAL DEFAULT 18
22: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _GLOBAL_OFFSET_TABLE_
23: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyArg_ParseTuple
24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyList_Size
25: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyList_GetItem
26: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyLong_AsLong
27: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND Py_BuildValue
28: 0000000000000080 17 FUNC GLOBAL DEFAULT 1 PyInit_addList
29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyModule_Create2 No version information found in this file.
[cpy@localhost extendingCpy]$ readelf -a build/lib.linux-x86_64-3.8/addList.cpython-38-x86_64-linux-gnu.so
ELF 头:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
类别: ELF64
数据: 2 补码,小端序 (little endian)
版本: 1 (current)
OS/ABI: UNIX - System V
ABI 版本: 0
类型: DYN (共享目标文件)
系统架构: Advanced Micro Devices X86-64
版本: 0x1
入口点地址: 0x800
程序头起点: 64 (bytes into file)
Start of section headers: 16192 (bytes into file)
标志: 0x0
本头的大小: 64 (字节)
程序头大小: 56 (字节)
Number of program headers: 7
节头大小: 64 (字节)
节头数量: 36
字符串表索引节头: 35 节头:
[号] 名称 类型 地址 偏移量
大小 全体大小 旗标 链接 信息 对齐
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .note.gnu.build-i NOTE 00000000000001c8 000001c8
0000000000000024 0000000000000000 A 0 0 4
[ 2] .gnu.hash GNU_HASH 00000000000001f0 000001f0
000000000000003c 0000000000000000 A 3 0 8
[ 3] .dynsym DYNSYM 0000000000000230 00000230
00000000000001b0 0000000000000018 A 4 1 8
[ 4] .dynstr STRTAB 00000000000003e0 000003e0
000000000000011b 0000000000000000 A 0 0 1
[ 5] .gnu.version VERSYM 00000000000004fc 000004fc
0000000000000024 0000000000000002 A 3 0 2
[ 6] .gnu.version_r VERNEED 0000000000000520 00000520
0000000000000020 0000000000000000 A 4 1 8
[ 7] .rela.dyn RELA 0000000000000540 00000540
0000000000000150 0000000000000018 A 3 0 8
[ 8] .rela.plt RELA 0000000000000690 00000690
00000000000000c0 0000000000000018 AI 3 22 8
[ 9] .init PROGBITS 0000000000000750 00000750
000000000000001a 0000000000000000 AX 0 0 4
[10] .plt PROGBITS 0000000000000770 00000770
0000000000000090 0000000000000010 AX 0 0 16
[11] .text PROGBITS 0000000000000800 00000800
0000000000000181 0000000000000000 AX 0 0 16
[12] .fini PROGBITS 0000000000000984 00000984
0000000000000009 0000000000000000 AX 0 0 4
[13] .rodata PROGBITS 000000000000098d 0000098d
000000000000002a 0000000000000001 AMS 0 0 1
[14] .eh_frame_hdr PROGBITS 00000000000009b8 000009b8
0000000000000024 0000000000000000 A 0 0 4
[15] .eh_frame PROGBITS 00000000000009e0 000009e0
000000000000008c 0000000000000000 A 0 0 8
[16] .init_array INIT_ARRAY 0000000000200de8 00000de8
0000000000000008 0000000000000008 WA 0 0 8
[17] .fini_array FINI_ARRAY 0000000000200df0 00000df0
0000000000000008 0000000000000008 WA 0 0 8
[18] .jcr PROGBITS 0000000000200df8 00000df8
0000000000000008 0000000000000000 WA 0 0 8
[19] .data.rel.ro PROGBITS 0000000000200e00 00000e00
0000000000000008 0000000000000000 WA 0 0 8
[20] .dynamic DYNAMIC 0000000000200e08 00000e08
00000000000001d0 0000000000000010 WA 4 0 8
[21] .got PROGBITS 0000000000200fd8 00000fd8
0000000000000028 0000000000000008 WA 0 0 8
[22] .got.plt PROGBITS 0000000000201000 00001000
0000000000000058 0000000000000008 WA 0 0 8
[23] .data PROGBITS 0000000000201060 00001060
00000000000000c0 0000000000000000 WA 0 0 32
[24] .bss NOBITS 0000000000201120 00001120
0000000000000008 0000000000000000 WA 0 0 1
[25] .comment PROGBITS 0000000000000000 00001120
000000000000002d 0000000000000001 MS 0 0 1
[26] .debug_aranges PROGBITS 0000000000000000 0000114d
0000000000000030 0000000000000000 0 0 1
[27] .debug_info PROGBITS 0000000000000000 0000117d
00000000000011eb 0000000000000000 0 0 1
[28] .debug_abbrev PROGBITS 0000000000000000 00002368
0000000000000214 0000000000000000 0 0 1
[29] .debug_line PROGBITS 0000000000000000 0000257c
00000000000001c1 0000000000000000 0 0 1
[30] .debug_str PROGBITS 0000000000000000 0000273d
0000000000000bd8 0000000000000001 MS 0 0 1
[31] .debug_loc PROGBITS 0000000000000000 00003315
00000000000001aa 0000000000000000 0 0 1
[32] .debug_ranges PROGBITS 0000000000000000 000034bf
0000000000000030 0000000000000000 0 0 1
[33] .symtab SYMTAB 0000000000000000 000034f0
00000000000006c0 0000000000000018 34 55 8
[34] .strtab STRTAB 0000000000000000 00003bb0
0000000000000234 0000000000000000 0 0 1
[35] .shstrtab STRTAB 0000000000000000 00003de4
0000000000000158 0000000000000000 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
l (large), p (processor specific) There are no section groups in this file. 程序头:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000a6c 0x0000000000000a6c R E 200000
LOAD 0x0000000000000de8 0x0000000000200de8 0x0000000000200de8
0x0000000000000338 0x0000000000000340 RW 200000
DYNAMIC 0x0000000000000e08 0x0000000000200e08 0x0000000000200e08
0x00000000000001d0 0x00000000000001d0 RW 8
NOTE 0x00000000000001c8 0x00000000000001c8 0x00000000000001c8
0x0000000000000024 0x0000000000000024 R 4
GNU_EH_FRAME 0x00000000000009b8 0x00000000000009b8 0x00000000000009b8
0x0000000000000024 0x0000000000000024 R 4
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RW 10
GNU_RELRO 0x0000000000000de8 0x0000000000200de8 0x0000000000200de8
0x0000000000000218 0x0000000000000218 R 1 Section to Segment mapping:
段节...
00 .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame
01 .init_array .fini_array .jcr .data.rel.ro .dynamic .got .got.plt .data .bss
02 .dynamic
03 .note.gnu.build-id
04 .eh_frame_hdr
05
06 .init_array .fini_array .jcr .data.rel.ro .dynamic .got Dynamic section at offset 0xe08 contains 25 entries:
标记 类型 名称/值
0x0000000000000001 (NEEDED) 共享库:[libpthread.so.0]
0x0000000000000001 (NEEDED) 共享库:[libc.so.6]
0x000000000000000c (INIT) 0x750
0x000000000000000d (FINI) 0x984
0x0000000000000019 (INIT_ARRAY) 0x200de8
0x000000000000001b (INIT_ARRAYSZ) 8 (bytes)
0x000000000000001a (FINI_ARRAY) 0x200df0
0x000000000000001c (FINI_ARRAYSZ) 8 (bytes)
0x000000006ffffef5 (GNU_HASH) 0x1f0
0x0000000000000005 (STRTAB) 0x3e0
0x0000000000000006 (SYMTAB) 0x230
0x000000000000000a (STRSZ) 283 (bytes)
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000003 (PLTGOT) 0x201000
0x0000000000000002 (PLTRELSZ) 192 (bytes)
0x0000000000000014 (PLTREL) RELA
0x0000000000000017 (JMPREL) 0x690
0x0000000000000007 (RELA) 0x540
0x0000000000000008 (RELASZ) 336 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000006ffffffe (VERNEED) 0x520
0x000000006fffffff (VERNEEDNUM) 1
0x000000006ffffff0 (VERSYM) 0x4fc
0x000000006ffffff9 (RELACOUNT) 9
0x0000000000000000 (NULL) 0x0 重定位节 '.rela.dyn' 位于偏移量 0x540 含有 14 个条目:
偏移量 信息 类型 符号值 符号名称 + 加数
000000200de8 000000000008 R_X86_64_RELATIVE 8b0
000000200df0 000000000008 R_X86_64_RELATIVE 870
000000200e00 000000000008 R_X86_64_RELATIVE 200e00
000000201088 000000000008 R_X86_64_RELATIVE 991
000000201090 000000000008 R_X86_64_RELATIVE 999
0000002010a0 000000000008 R_X86_64_RELATIVE 2010e0
0000002010e0 000000000008 R_X86_64_RELATIVE 9b3
0000002010e8 000000000008 R_X86_64_RELATIVE 8f0
0000002010f8 000000000008 R_X86_64_RELATIVE 9aa
000000200fd8 000100000006 R_X86_64_GLOB_DAT 0000000000000000 _ITM_deregisterTMClone + 0
000000200fe0 000200000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ + 0
000000200fe8 000800000006 R_X86_64_GLOB_DAT 0000000000000000 _Jv_RegisterClasses + 0
000000200ff0 000900000006 R_X86_64_GLOB_DAT 0000000000000000 _ITM_registerTMCloneTa + 0
000000200ff8 000b00000006 R_X86_64_GLOB_DAT 0000000000000000 __cxa_finalize@GLIBC_2.2.5 + 0 重定位节 '.rela.plt' 位于偏移量 0x690 含有 8 个条目:
偏移量 信息 类型 符号值 符号名称 + 加数
000000201018 000200000007 R_X86_64_JUMP_SLO 0000000000000000 __gmon_start__ + 0
000000201020 000300000007 R_X86_64_JUMP_SLO 0000000000000000 Py_BuildValue + 0
000000201028 000400000007 R_X86_64_JUMP_SLO 0000000000000000 PyModule_Create2 + 0
000000201030 000500000007 R_X86_64_JUMP_SLO 0000000000000000 PyLong_AsLong + 0
000000201038 000600000007 R_X86_64_JUMP_SLO 0000000000000000 PyArg_ParseTuple + 0
000000201040 000700000007 R_X86_64_JUMP_SLO 0000000000000000 PyList_Size + 0
000000201048 000a00000007 R_X86_64_JUMP_SLO 0000000000000000 PyList_GetItem + 0
000000201050 000b00000007 R_X86_64_JUMP_SLO 0000000000000000 __cxa_finalize@GLIBC_2.2.5 + 0 The decoding of unwind sections for machine type Advanced Micro Devices X86-64 is not currently supported. Symbol table '.dynsym' contains 18 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTab
2: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
3: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND Py_BuildValue
4: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyModule_Create2
5: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyLong_AsLong
6: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyArg_ParseTuple
7: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyList_Size
8: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
9: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
10: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyList_GetItem
11: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.2.5 (2)
12: 0000000000201120 0 NOTYPE GLOBAL DEFAULT 23 _edata
13: 0000000000000970 17 FUNC GLOBAL DEFAULT 11 PyInit_addList
14: 0000000000201128 0 NOTYPE GLOBAL DEFAULT 24 _end
15: 0000000000201120 0 NOTYPE GLOBAL DEFAULT 24 __bss_start
16: 0000000000000750 0 FUNC GLOBAL DEFAULT 9 _init
17: 0000000000000984 0 FUNC GLOBAL DEFAULT 12 _fini Symbol table '.symtab' contains 72 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000000001c8 0 SECTION LOCAL DEFAULT 1
2: 00000000000001f0 0 SECTION LOCAL DEFAULT 2
3: 0000000000000230 0 SECTION LOCAL DEFAULT 3
4: 00000000000003e0 0 SECTION LOCAL DEFAULT 4
5: 00000000000004fc 0 SECTION LOCAL DEFAULT 5
6: 0000000000000520 0 SECTION LOCAL DEFAULT 6
7: 0000000000000540 0 SECTION LOCAL DEFAULT 7
8: 0000000000000690 0 SECTION LOCAL DEFAULT 8
9: 0000000000000750 0 SECTION LOCAL DEFAULT 9
10: 0000000000000770 0 SECTION LOCAL DEFAULT 10
11: 0000000000000800 0 SECTION LOCAL DEFAULT 11
12: 0000000000000984 0 SECTION LOCAL DEFAULT 12
13: 000000000000098d 0 SECTION LOCAL DEFAULT 13
14: 00000000000009b8 0 SECTION LOCAL DEFAULT 14
15: 00000000000009e0 0 SECTION LOCAL DEFAULT 15
16: 0000000000200de8 0 SECTION LOCAL DEFAULT 16
17: 0000000000200df0 0 SECTION LOCAL DEFAULT 17
18: 0000000000200df8 0 SECTION LOCAL DEFAULT 18
19: 0000000000200e00 0 SECTION LOCAL DEFAULT 19
20: 0000000000200e08 0 SECTION LOCAL DEFAULT 20
21: 0000000000200fd8 0 SECTION LOCAL DEFAULT 21
22: 0000000000201000 0 SECTION LOCAL DEFAULT 22
23: 0000000000201060 0 SECTION LOCAL DEFAULT 23
24: 0000000000201120 0 SECTION LOCAL DEFAULT 24
25: 0000000000000000 0 SECTION LOCAL DEFAULT 25
26: 0000000000000000 0 SECTION LOCAL DEFAULT 26
27: 0000000000000000 0 SECTION LOCAL DEFAULT 27
28: 0000000000000000 0 SECTION LOCAL DEFAULT 28
29: 0000000000000000 0 SECTION LOCAL DEFAULT 29
30: 0000000000000000 0 SECTION LOCAL DEFAULT 30
31: 0000000000000000 0 SECTION LOCAL DEFAULT 31
32: 0000000000000000 0 SECTION LOCAL DEFAULT 32
33: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
34: 0000000000200df8 0 OBJECT LOCAL DEFAULT 18 __JCR_LIST__
35: 0000000000000800 0 FUNC LOCAL DEFAULT 11 deregister_tm_clones
36: 0000000000000830 0 FUNC LOCAL DEFAULT 11 register_tm_clones
37: 0000000000000870 0 FUNC LOCAL DEFAULT 11 __do_global_dtors_aux
38: 0000000000201120 1 OBJECT LOCAL DEFAULT 24 completed.6355
39: 0000000000200df0 0 OBJECT LOCAL DEFAULT 17 __do_global_dtors_aux_fin
40: 00000000000008b0 0 FUNC LOCAL DEFAULT 11 frame_dummy
41: 0000000000200de8 0 OBJECT LOCAL DEFAULT 16 __frame_dummy_init_array_
42: 0000000000000000 0 FILE LOCAL DEFAULT ABS adder.c
43: 00000000000008f0 122 FUNC LOCAL DEFAULT 11 add
44: 0000000000201060 104 OBJECT LOCAL DEFAULT 23 addListmodule
45: 00000000002010e0 64 OBJECT LOCAL DEFAULT 23 AddListMethods
46: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
47: 0000000000000a68 0 OBJECT LOCAL DEFAULT 15 __FRAME_END__
48: 0000000000200df8 0 OBJECT LOCAL DEFAULT 18 __JCR_END__
49: 0000000000000000 0 FILE LOCAL DEFAULT ABS
50: 0000000000200e00 0 OBJECT LOCAL DEFAULT 19 __dso_handle
51: 0000000000200e08 0 OBJECT LOCAL DEFAULT 20 _DYNAMIC
52: 00000000000009b8 0 NOTYPE LOCAL DEFAULT 14 __GNU_EH_FRAME_HDR
53: 0000000000201120 0 OBJECT LOCAL DEFAULT 23 __TMC_END__
54: 0000000000201000 0 OBJECT LOCAL DEFAULT 22 _GLOBAL_OFFSET_TABLE_
55: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTab
56: 0000000000201120 0 NOTYPE GLOBAL DEFAULT 23 _edata
57: 0000000000000984 0 FUNC GLOBAL DEFAULT 12 _fini
58: 0000000000000970 17 FUNC GLOBAL DEFAULT 11 PyInit_addList
59: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
60: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND Py_BuildValue
61: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyModule_Create2
62: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyLong_AsLong
63: 0000000000201128 0 NOTYPE GLOBAL DEFAULT 24 _end
64: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyArg_ParseTuple
65: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyList_Size
66: 0000000000201120 0 NOTYPE GLOBAL DEFAULT 24 __bss_start
67: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
68: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
69: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND PyList_GetItem
70: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@@GLIBC_2.2
71: 0000000000000750 0 FUNC GLOBAL DEFAULT 9 _init Histogram for `.gnu.hash' bucket list length (total of 3 buckets):
Length Number % of total Coverage
0 0 ( 0.0%)
1 1 ( 33.3%) 16.7%
2 1 ( 33.3%) 50.0%
3 1 ( 33.3%) 100.0% Version symbols section '.gnu.version' contains 18 entries:
地址:00000000000004fc Offset: 0x0004fc Link: 3 (.dynsym)
000: 0 (*本地*) 0 (*本地*) 0 (*本地*) 0 (*本地*)
004: 0 (*本地*) 0 (*本地*) 0 (*本地*) 0 (*本地*)
008: 0 (*本地*) 0 (*本地*) 0 (*本地*) 2 (GLIBC_2.2.5)
00c: 1 (*全局*) 1 (*全局*) 1 (*全局*) 1 (*全局*)
010: 1 (*全局*) 1 (*全局*) Version needs section '.gnu.version_r' contains 1 entries:
地址:0x0000000000000520 Offset: 0x000520 Link: 4 (.dynstr)
000000: 版本: 1 文件:libc.so.6 计数:1
0x0010:名称:GLIBC_2.2.5 标志:无 版本:2 Displaying notes found at file offset 0x000001c8 with length 0x00000024:
所有者 Data size Description
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)
Build ID: 36151486d3559504ee1d3314183ed1afbd4154e8
[cpy@localhost extendingCpy]$

  

https://github.com/flier/pyfasthash/blob/master/setup.py

扩展和嵌入 Python 解释器 用 C 或 C++ 编写模块以使用新模块来扩展 Python 解释器的功能 定义新的函数\对象类型\方法。 将 Python 解释器嵌入到另一个应用程序中的更多相关文章

  1. JavaScript中判断对象类型方法大全1

    我们知道,JavaScript中检测对象类型的运算符有:typeof.instanceof,还有对象的constructor属性: 1) typeof 运算符 typeof 是一元运算符,返回结果是一 ...

  2. JS对象 indexOf() 方法可返回某个指定的字符串值在字符串中首次出现的位置。

    返回指定的字符串首次出现的位置 indexOf() 方法可返回某个指定的字符串值在字符串中首次出现的位置. 语法 stringObject.indexOf(substring, startpos) 参 ...

  3. JavaScript中判断对象类型方法大全2

    在JavaScript中,有5种基本数据类型和1种复杂数据类型,基本数据类型有:Undefined, Null, Boolean, Number和String:复杂数据类型是Object,Object ...

  4. 【C语言】03-第一个C程序代码分析

    前面我们已经创建了一个C程序,接下来分析一下里面的代码. 项目结构如下: 一.代码分析 打开项目中的main.c文件(C程序的源文件拓展名为.c),可以发现它是第一个C程序中的唯一一个源文件,代码如下 ...

  5. python中的类,对象,方法,属性等介绍

    注:这篇文章写得很好.加底纹的是我自己的理解 python中一切皆为对象,所谓对象:我自己就是一个对象,我玩的电脑就是对象,坐着的椅子就是对象,家里养的小狗也是一个对象...... 我们通过描述属性( ...

  6. 【C语言】01-第一个c程序代码分析

    创建了一个C程序,接下来分析一下里面的代码. 项目结构如下: 一.代码分析 打开项目中的main.c文件(C程序的源文件拓展名为.c),可以发现它是第一个C程序中的唯一一个源文件,代码如下: 1 #i ...

  7. Fastreport使用经验(转)在Delphi程序中访问报表对象

    Fastreport使用经验(转) 在Delphi程序中访问报表对象 最基本的方法就是frxReport1.FindObject. 然后把返回的对象强制转换成它的类型,当然,在报表中必须真的有这么个东 ...

  8. 第一个PHP程序

    <html> <head> <title><?php echo"这是第一个php程序"?></title> <st ...

  9. hadoop-初学者写map-reduce程序中容易出现的问题 3

    1.写hadoop的map-reduce程序之前所必须知道的基础知识: 1)hadoop map-reduce的自带的数据类型: Hadoop提供了如下内容的数据类型,这些数据类型都实现了Writab ...

随机推荐

  1. 解决Centos7安装python3后pip工具无法使用

    问题描述: Centos7安装python3,正常流程全部配置完成,python3,pip3的软链接也建立了 但是python3可以正常使用,而pip3报错,无法找到文件或目录 解决方法: which ...

  2. CentOS7清理老旧内核

    CentOS7如果是一步步内核升级上来的将会面临一个问题(一般安装了图形化界面的系统常见),由于内核增多/boot/的容量减少,导致启动变慢.这时就需要清理老旧内核,释放/boot/空间. 使用una ...

  3. java加密算法-DES

    public class DESUtil { private static String strdefaultkey = "13456789abcd";//默认的key priva ...

  4. SpringDataRedis的简单入门

    Jedis Jedis是Redis官方推出的一款面向java的客户端,提供了很多接口供java语言调用,可以在Redis官网下载,当然还有一些开源爱好者提供的客户端,如Jredis SRP等,推荐使用 ...

  5. 安装 uwsgi报错解决

    背景: 安装 uwsgi时报错如下,查阅相关资料说是 python-devel的问题,于是安装之后python-devel后问题解决 报错如下: (venv) [xxxxxxx]# pip insta ...

  6. Exec Maven插件

    1.为什么使用exec? 现在的工程往往依赖 众多的jar包,不像war包工程,对于那些打包成jar包形式的本地java应用来说,通过java命令启动将会是一件极为繁琐的事情,原因很简单,太 多的依赖 ...

  7. Mybatis 使用PageHelper封装通用Dao分页方法

    参考: PageHelper官网:https://pagehelper.github.io/docs/howtouse/#3-%E5%A6%82%E4%BD%95%E5%9C%A8%E4%BB%A3% ...

  8. NOIP 2017 PJ

    T1:水 T2:水 T3:水 T4:水,二分+DP检测+单调队列优化,然而优化写炸了,还没暴力分高 所以爆炸 (民间)100 + 100 + 100 + 10 = 310 GAME OVER

  9. 用LinkedList和ArrayList实现自定义栈的异同

    //ArrayList已连续的空间进行存储数据  //LinkedList已链表的结构存储数据    //栈  MyStark ms=new MyStark();//new 一个实现栈的类  //压栈 ...

  10. Restful API 指南

    作为软件开发人员,我们大多数人在日常生活中使用或构建 REST api.API 是系统之间的默认通信方式.亚马逊是如何有效地使用 api 进行通信的最佳例子. 在这篇文章中,我将讨论如何更好地设计 R ...