]> git.kaiwu.me - haproxy.git/commitdiff
OPTIM: sym: skip the embedded table when the file provided the symbols
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 15 Sep 2026 15:51:03 +0000 (17:51 +0200)
committerOlivier Houchard <cognet@ci0.org>
Thu, 1 Oct 2026 15:06:31 +0000 (17:06 +0200)
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.

src/sym.c

index 2681a905776caed3023dbf223ff56e482fc2cd96..41f034a2612a181280197788a491ab7824299cc0 100644 (file)
--- 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)