Skip to content

Commit a305a68

Browse files
committed
Merge bitcoin/bitcoin#22244: devtools: Correctly extract symbol versions in symbol-check
e8cd370 devtools: Integrate ARCH_MIN_GLIBC_VER table into MAX_VERSIONS in symbol-check.py (W. J. van der Laan) a33381a devtools: Add xkb version to symbol-check (W. J. van der Laan) 19e598b devtools: Fix verneed section parsing in pixie (W. J. van der Laan) Pull request description: I misunderstood the ELF specification for version symbols (verneed): The `vn_aux` pointer is relative to the main verneed record, not the start of the section. This caused many symbols to not be versioned properly in the return value of `elf.dyn_symbols`. This was discovered in #21454. Fix it by correcting the offset computation. - xkb versions symbols (using the prefix `V`), as this library is used by bitcoin-qt, add it to the valid versions in `symbol-check.py` This unfortunately brings to light some symbols that have been introduced since and weren't caught (from a gitian compile of master): ``` bitcoin-cli: symbol getrandom from unsupported version GLIBC_2.25 bitcoin-cli: failed IMPORTED_SYMBOLS bitcoind: symbol getrandom from unsupported version GLIBC_2.25 bitcoind: symbol log from unsupported version GLIBC_2.29 bitcoind: symbol fcntl64 from unsupported version GLIBC_2.28 bitcoind: symbol pow from unsupported version GLIBC_2.29 bitcoind: symbol exp from unsupported version GLIBC_2.29 bitcoind: failed IMPORTED_SYMBOLS bitcoin-qt: symbol exp from unsupported version GLIBC_2.29 bitcoin-qt: symbol fcntl64 from unsupported version GLIBC_2.28 bitcoin-qt: symbol log from unsupported version GLIBC_2.29 bitcoin-qt: symbol pow from unsupported version GLIBC_2.29 bitcoin-qt: symbol statx from unsupported version GLIBC_2.28 bitcoin-qt: symbol getrandom from unsupported version GLIBC_2.25 bitcoin-qt: symbol renameat2 from unsupported version GLIBC_2.28 bitcoin-qt: symbol getentropy from unsupported version GLIBC_2.25 bitcoin-qt: failed IMPORTED_SYMBOLS bitcoin-wallet: symbol exp from unsupported version GLIBC_2.29 bitcoin-wallet: symbol log from unsupported version GLIBC_2.29 bitcoin-wallet: symbol fcntl64 from unsupported version GLIBC_2.28 bitcoin-wallet: failed IMPORTED_SYMBOLS test_bitcoin: symbol getrandom from unsupported version GLIBC_2.25 test_bitcoin: symbol log from unsupported version GLIBC_2.29 test_bitcoin: symbol fcntl64 from unsupported version GLIBC_2.28 test_bitcoin: symbol pow from unsupported version GLIBC_2.29 test_bitcoin: symbol exp from unsupported version GLIBC_2.29 test_bitcoin: failed IMPORTED_SYMBOLS ``` ACKs for top commit: hebasto: ACK e8cd370 Tree-SHA512: 8c15e3478eb642f01a1ddaadef03f80583f088f9fa8e3bf171ce16b0ec05ffb4675ec147d7ffc6a4360637ed47fca517c6ca2bac7bb30d794c03783cfb964b79
2 parents 965e937 + e8cd370 commit a305a68

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

contrib/devtools/pixie.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def _parse_verneed(section: Section, strings: bytes, eh: ELFHeader) -> Dict[int,
217217
result = {}
218218
while True:
219219
verneed = Verneed(data, ofs, eh)
220-
aofs = verneed.vn_aux
220+
aofs = ofs + verneed.vn_aux
221221
while True:
222222
vernaux = Vernaux(data, aofs, eh, strings)
223223
result[vernaux.vna_other] = vernaux.name

contrib/devtools/symbol-check.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,16 @@
4141
#
4242
MAX_VERSIONS = {
4343
'GCC': (4,8,0),
44-
'GLIBC': (2,17),
45-
'LIBATOMIC': (1,0)
44+
'GLIBC': {
45+
pixie.EM_386: (2,17),
46+
pixie.EM_X86_64: (2,17),
47+
pixie.EM_ARM: (2,17),
48+
pixie.EM_AARCH64:(2,17),
49+
pixie.EM_PPC64: (2,17),
50+
pixie.EM_RISCV: (2,27),
51+
},
52+
'LIBATOMIC': (1,0),
53+
'V': (0,5,0), # xkb (bitcoin-qt only)
4654
}
4755
# See here for a description of _IO_stdin_used:
4856
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=634261#109
@@ -78,14 +86,6 @@
7886
'libfreetype.so.6', # font parsing
7987
'libdl.so.2' # programming interface to dynamic linker
8088
}
81-
ARCH_MIN_GLIBC_VER = {
82-
pixie.EM_386: (2,1),
83-
pixie.EM_X86_64: (2,2,5),
84-
pixie.EM_ARM: (2,4),
85-
pixie.EM_AARCH64:(2,17),
86-
pixie.EM_PPC64: (2,17),
87-
pixie.EM_RISCV: (2,27)
88-
}
8989

9090
MACHO_ALLOWED_LIBRARIES = {
9191
# bitcoind and bitcoin-qt
@@ -161,7 +161,10 @@ def check_version(max_versions, version, arch) -> bool:
161161
ver = tuple([int(x) for x in ver.split('.')])
162162
if not lib in max_versions:
163163
return False
164-
return ver <= max_versions[lib] or lib == 'GLIBC' and ver <= ARCH_MIN_GLIBC_VER[arch]
164+
if isinstance(max_versions[lib], tuple):
165+
return ver <= max_versions[lib]
166+
else:
167+
return ver <= max_versions[lib][arch]
165168

166169
def check_imported_symbols(filename) -> bool:
167170
elf = pixie.load(filename)

0 commit comments

Comments
 (0)