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
This commit is contained in:
kichik 2009-02-21 18:25:56 +00:00
parent f4a282b8eb
commit 80b8e010ad

View file

@ -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++;