From 80b8e010adac82c13193a426c69745fcc2fb23b1 Mon Sep 17 00:00:00 2001 From: kichik Date: Sat, 21 Feb 2009 18:25:56 +0000 Subject: [PATCH] fixed bug #2593369 - global labels in unused functions can't be used git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5937 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/build.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Source/build.cpp b/Source/build.cpp index 2df3e3df..2d10c54c 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -1275,6 +1275,25 @@ int CEXEBuild::resolve_jump_int(const char *fn, int *a, int offs, int start, int { *a = s->code+1; // jumps are to the absolute position, +1 (to differentiate between no jump, and jumping to offset 0) s->flags++; + if (*lname == '.') + { + // bug #2593369 - mark functions with used global labels as used + // XXX this puts another hole in function reference counting + // a recursive function, for example, will never be optimized + int nf=cur_functions->getlen()/sizeof(section); + section *func=(section *)cur_functions->get(); + while (nf-- > 0) + { + int fstart = func->code; + int fend = func->code + func->code_size; + if (s->code >= fstart && s->code <= fend) + { + func->flags++; + break; + } + func++; + } + } return 0; } s++;