Le vendredi 25 janvier 2013 19:37:38, grischka a écrit :
> Thomas Preud'homme wrote:
> >> I just started but the
> >> good news is that it's limited to the -run function. There is no problem
> >> when compiling the example.
> > 
> > Ok got it. Fix attached.
> > 
> > diff --git a/tccelf.c b/tccelf.c
> > index da81d03..76a8002 100644
> > --- a/tccelf.c
> > +++ b/tccelf.c
> > @@ -1633,7 +1633,7 @@ static int elf_output_file(TCCState *s1, const char
> > *filename)
> 
> Without knowing any details, I just notice that the proposed fix doesn't
> match the analysis of the problem:  A change within elf_output_file()
> has no effect for tcc -run.

That's because the bug is not in tcc -run but manifest here. The bug is when 
compiling a program with a call to ifunc function followed by dlsym with the 
same function (ex strcpy() followed by (dlsym(RTLD_DEFAULT, "strcpy")).

Here the bug manifested in tcc -run because tcc was compiled with tcc. Since 
the code doing the relocation in -run was using dlsym and the input program 
contained a strcpy, it was trying to dlsym strcpy which was already executed 
by tcc itself. Exactly the same pattern. So there is no bug in tcc -run 
functions, only a bug in the linker. :)

> 
> --- grischka

Thomas

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to