From: Olivier Houchard Date: Tue, 15 Sep 2026 15:51:03 +0000 (+0200) Subject: OPTIM: sym: skip the embedded table when the file provided the symbols X-Git-Tag: v3.5-dev9~231 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=c5d909b5c44a0b48028d413d0b3a4992d3651bc0;p=haproxy.git OPTIM: sym: skip the embedded table when the file provided the symbols The embedded compressed table and the file's .symtab describe the same local functions, the latter being a superset, so decompressing it when the file is readable is pure loss, which is the common case. Only decompress it when the file gave us nothing, i.e. once stripped or unreachable. This is what the table is for and saves inflating about 1.5 MB per object at every start. --- diff --git a/src/sym.c b/src/sym.c index 2681a9057..41f034a26 100644 --- a/src/sym.c +++ b/src/sym.c @@ -1145,7 +1145,10 @@ static int phdr_cb(struct dl_phdr_info *info, size_t size, void *data) b->debugdata_size = end - (unsigned long)b->debugdata; } - if (b->debugdata && b->debugdata_size) + /* the file's symbol table, when we could read it, is a superset of the + * embedded one, so only pay for the decompression when we have nothing. + */ + if (b->debugdata && b->debugdata_size && ret <= 0) collect_debugdata(b, obj, b->debugdata, b->debugdata_size); if (is_exe)