[fpc-devel] Support for FreeBSD PowerPC

Curtis Hamilton clhamilto at gmail.com
Tue Oct 20 02:32:04 CEST 2020


Op 2020-10-18 om 23:03 schreef Jonas Maebe via fpc-devel:
>>//>>>/I’ve been able to create a cross compiler using the guidance and some />>>/additional information.  But I’ve been unable to create the proper FPC />>>/startup code (prt0.as) needed. />>>//>>>/Any help would be appreciated. />>/I believe these files are generally created by disassembling the />>/system's crt1.o (objdump -d) and then changing the call(s) to the libc />>/intialisation code with calls to the FPC RTL intialisation code. />Afaik mostly gcc -S.  Trunk SVN also contains an untested and incomplete 
>attempt at translating the C startup files to pascal.

Thanks!

I think I maybe in over my head on this. I've taken a look and now I'm not sure what the issue is.  The
segfault occurs in the FPC RTL initiazation code (see backtrace below).

Any ideas?


root at blackbird:/usr/ports/tmp/fpc-powerpc64/lib/fpc/3.2.0 # gdb ./ppcppc64 ppcppc64.core
GNU gdb (GDB) 8.3 [GDB v8.3 for FreeBSD]
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc64-portbld-freebsd12.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
     <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./ppcppc64...

warning: core file may not match specified executable file.
[New LWP 100454]
Core was generated by `./ppcppc64'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x7c0802a6fbe1fff8 in ?? ()
(gdb) backtrace
#0  0x7c0802a6fbe1fff8 in ?? ()
#1  0x000000001001fed8 in $fpc_initializeunits () at ../inc/system.inc:969
#2  0x0000000010000720 in $main () at pp.pas:256
(gdb) disass
No function contains program counter for selected frame.
(gdb) frame 1
#1  0x000000001001fed8 in $fpc_initializeunits () at ../inc/system.inc:969
969	         Procs[i].InitProc();
(gdb) disass
Dump of assembler code for function $fpc_initializeunits:
    0x000000001001fe60 <+0>:	mflr    r0
    0x000000001001fe64 <+4>:	std     r31,-8(r1)
    0x000000001001fe68 <+8>:	std     r30,-16(r1)
    0x000000001001fe6c <+12>:	std     r29,-24(r1)
    0x000000001001fe70 <+16>:	std     r28,-32(r1)
    0x000000001001fe74 <+20>:	std     r0,16(r1)
    0x000000001001fe78 <+24>:	stdu    r1,-128(r1)
    0x000000001001fe7c <+28>:	bl      0x10002768 <fpc_cpuinit>
    0x000000001001fe80 <+32>:	nop
    0x000000001001fe84 <+36>:	addi    r3,r2,15080
    0x000000001001fe88 <+40>:	ld      r28,0(r3)
    0x000000001001fe8c <+44>:	cmpldi  r28,1
    0x000000001001fe90 <+48>:	blt     0x1001feec <$fpc_initializeunits+140>
    0x000000001001fe94 <+52>:	li      r31,0
    0x000000001001fe98 <+56>:	addi    r3,r31,1
    0x000000001001fe9c <+60>:	mr      r31,r3
    0x000000001001fea0 <+64>:	rldicr  r4,r31,4,59
    0x000000001001fea4 <+68>:	addi    r3,r2,15080
    0x000000001001fea8 <+72>:	ldx     r3,r4,r3
    0x000000001001feac <+76>:	cmpldi  r3,0
    0x000000001001feb0 <+80>:	beq     0x1001fedc <$fpc_initializeunits+124>
    0x000000001001feb4 <+84>:	rldicr  r4,r31,4,59
    0x000000001001feb8 <+88>:	addi    r3,r2,15080
    0x000000001001febc <+92>:	ldx     r29,r4,r3
    0x000000001001fec0 <+96>:	ld      r30,0(r29)
    0x000000001001fec4 <+100>:	std     r2,40(r1)
    0x000000001001fec8 <+104>:	mtctr   r30
    0x000000001001fecc <+108>:	ld      r2,8(r29)
    0x000000001001fed0 <+112>:	ld      r11,16(r29)
    0x000000001001fed4 <+116>:	bctrl
=> 0x000000001001fed8 <+120>:	ld      r2,40(r1)
    0x000000001001fedc <+124>:	addi    r3,r2,15080
    0x000000001001fee0 <+128>:	std     r31,8(r3)
    0x000000001001fee4 <+132>:	cmpld   r31,r28
    0x000000001001fee8 <+136>:	blt     0x1001fe98 <$fpc_initializeunits+56>
    0x000000001001feec <+140>:	addi    r3,r2,18272
    0x000000001001fef0 <+144>:	ld      r3,0(r3)
    0x000000001001fef4 <+148>:	cmpldi  r3,0
    0x000000001001fef8 <+152>:	beq     0x1001ff20 <$fpc_initializeunits+192>
    0x000000001001fefc <+156>:	addi    r3,r2,18272
    0x000000001001ff00 <+160>:	ld      r31,0(r3)
    0x000000001001ff04 <+164>:	ld      r30,0(r31)
    0x000000001001ff08 <+168>:	std     r2,40(r1)
    0x000000001001ff0c <+172>:	mtctr   r30
    0x000000001001ff10 <+176>:	ld      r2,8(r31)
    0x000000001001ff14 <+180>:	ld      r11,16(r31)
    0x000000001001ff18 <+184>:	bctrl
    0x000000001001ff1c <+188>:	ld      r2,40(r1)
    0x000000001001ff20 <+192>:	addi    r1,r1,128
    0x000000001001ff24 <+196>:	ld      r31,-8(r1)
    0x000000001001ff28 <+200>:	ld      r30,-16(r1)
    0x000000001001ff2c <+204>:	ld      r29,-24(r1)
    0x000000001001ff30 <+208>:	ld      r28,-32(r1)
    0x000000001001ff34 <+212>:	ld      r0,16(r1)
    0x000000001001ff38 <+216>:	mtlr    r0
    0x000000001001ff3c <+220>:	blr
End of assembler dump.

------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20201019/d233b884/attachment.htm>


More information about the fpc-devel mailing list