[fpc-pascal] Building trunk

C Western l at c-m-w.me.uk
Sun Nov 25 12:20:02 CET 2018


On 24/11/2018 22:21, Florian Klämpfl wrote:
> Am 24.11.2018 um 10:08 schrieb C Western:
>> On 23/11/2018 09:50, Sven Barth via fpc-pascal wrote:
>>> Am Fr., 23. Nov. 2018, 10:26 hat C Western <l at c-m-w.me.uk <mailto:l at c-m-w.me.uk>> geschrieben:
>>>
>>>      I haven't been able to build trunk i386 fpc for a couple of weeks. Is
>>>      this supposed to be working, or have I misconfigured something? (I
>>>      don't
>>>      think I have changed anything.) The output is below. I don't think
>>>      it is
>>>      significant, but I am building on a 64 bit system, but with a 32 bit
>>>      starting compiler. (The 64 bit build with the 64 bit starting
>>>      compiler
>>>      works fine.)
>>>
>>>
>>> We have i386 trunk building on at least one x86_64-linux machine, so it can't be a principal problem. :/
>>> Could you check whether it's FPC itself that segfaults or something else and if the former try to retrieve a
>>> stacktrace, please?
>>>
>>> Regards,
>>> Sven
>>>
>>> _______________________________________________
>>> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>> Looks like the ppc1 compiler crashes during setup:
>>
>> gdb) run
>> Starting program: /home/me/fpc/trunk/fpcsrc/compiler/ppc1
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x08068760 in INITTLS () at system.pp:543
>> 543            case phdr^.p_type of
>> (gdb) bt
>> #0  0x08068760 in INITTLS () at system.pp:543
>> #1  0x082a63fb in _FPC_PROC_START () at ./i386/si_prc.inc:105
>> (gdb) p phdr
>> $1 = (PPHDR) 0x8048034
>> (gdb) p phdr^
>> Cannot access memory at address 0x8048034
> Can you please check what value phdr has at the crash location after applying the following patch?
>
> diff --git a/rtl/linux/system.pp b/rtl/linux/system.pp
> index 0d7ed2b152..74b4592ace 100644
> --- a/rtl/linux/system.pp
> +++ b/rtl/linux/system.pp
> @@ -525,6 +525,8 @@ procedure InitTLS; [public,alias:'FPC_INITTLS'];
>       while assigned(auxp^) do
>         inc(auxp);
>       inc(auxp);
> +    phdr:=nil;
> +    phnum:=0;
>       { now we are at the auxillary vector }
>       while assigned(auxp^) do
>         begin
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

That gives the same value as shown above, even after applying the patch. 
Single stepping the code indicates that both variables are assigned: 
(Some lines deleted).

Breakpoint 1, INITTLS () at system.pp:523
523        auxp:=ppointer(envp);
(gdb) n
525        while assigned(auxp^) do
(gdb) n
533            case plongint(auxp)^ of
(gdb) n
535                phdr:=pphdr(ppointer(auxp+1)^);
(gdb) n
539            inc(auxp,2);
(gdb) p phdr
$3 = (PPHDR) 0x8048034
(gdb) p phdr^
Cannot access memory at address 0x8048034
(gdb) n
533            case plongint(auxp)^ of
(gdb) n
539            inc(auxp,2);
(gdb) n
533            case plongint(auxp)^ of
(gdb) n
537                phnum:=pdword(auxp+1)^;
(gdb) n
539            inc(auxp,2);
(gdb) p phnum
$4 = 4
(gdb)
543        for i:=1 to phnum do
(gdb) n
545            case phdr^.p_type of
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x0806ef01 in INITTLS () at system.pp:545
545            case phdr^.p_type of
(gdb) p phdr
$5 = (PPHDR) 0x8048034
(gdb)

Colin




More information about the fpc-pascal mailing list