[fpc-devel] Support for FreeBSD PowerPC

Curtis Hamilton clhamilto at gmail.com
Thu Oct 22 14:45:23 CEST 2020


Attached it the crt1.s created using gcc -S that was used in the prt0.as 
in my earlier email.

-regards

On 10/21/20 10:51 AM, Curtis Hamilton wrote:
> Attached is the prt0.as <http://prt0.as> I created using the one used 
> for linux/powerpc64.  I've also attached the dump of crt1.s from the 
> target.
>
> Thanks!
>
> On Wed, Oct 21, 2020 at 10:04 AM Jonas Maebe via fpc-devel 
> <fpc-devel at lists.freepascal.org 
> <mailto:fpc-devel at lists.freepascal.org>> wrote:
>
>     On 20/10/2020 02:32, Curtis Hamilton via fpc-devel wrote:
>     > 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?
>
>     What does the prt0.as <http://prt0.as> file that you created look
>     like?
>
>
>     Jonas
>     _______________________________________________
>     fpc-devel maillist  - fpc-devel at lists.freepascal.org
>     <mailto:fpc-devel at lists.freepascal.org>
>     https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20201022/9fa1dcd6/attachment.htm>
-------------- next part --------------
	.file	"crt1.c"
	.section	".got","aw"
	.section	".text"
#APP
	.ident	"$FreeBSD: releng/12.1/lib/csu/powerpc64/crt1.c 326219 2017-11-26 02:00:33Z pfg $"
	.ident	"$FreeBSD: releng/12.1/lib/csu/common/crtbrand.c 354233 2019-11-01 00:00:17Z gjb $"
	.ident	"$FreeBSD: releng/12.1/lib/csu/common/ignore_init.c 339351 2018-10-13 23:52:55Z kib $"
#NO_APP
	.section	".got","aw"
.LC2:
	.tc environ[TC],environ
.LC3:
	.tc .LANCHOR0[TC],.LANCHOR0
.LC4:
	.tc __ps_strings[TC],__ps_strings
.LC5:
	.tc _DYNAMIC[TC],_DYNAMIC
.LC6:
	.tc atexit[TC],atexit
.LC7:
	.tc _init_tls[TC],_init_tls
.LC8:
	.tc finalizer[TC],finalizer
.LC9:
	.tc __preinit_array_end[TC],__preinit_array_end
.LC10:
	.tc __preinit_array_start[TC],__preinit_array_start
.LC11:
	.tc _init[TC],_init
.LC12:
	.tc __init_array_end[TC],__init_array_end
.LC13:
	.tc __init_array_start[TC],__init_array_start
.LC14:
	.tc main[TC],main
.LC15:
	.tc exit[TC],exit
	.section	".text"
	.align 2
	.globl _start
	.section	".opd","aw"
	.align 3
_start:
	.quad	.L._start,.TOC. at tocbase,0
	.previous
	.type	_start, @function
.L._start:
	mflr 0
	std 28,-32(1)
	mr 28,5
	std 30,-16(1)
	mr 30,4
	std 31,-8(1)
	mr 31,3
	std 0,16(1)
	mr 3,7
	std 26,-48(1)
	std 27,-40(1)
	std 29,-24(1)
	ld 9,.LC2 at toc(2)
	stdu 1,-160(1)
	ld 0,0(9)
	cmpdi 7,0,0
	beq- 7,.L31
.L2:
	cmpwi 7,31,0
	ble- 7,.L4
	ld 9,0(30)
	cmpdi 7,9,0
	beq- 7,.L4
	ld 11,.LC3 at toc(2)
	std 9,0(11)
	lbz 0,0(9)
	cmpdi 7,0,0
	beq- 7,.L4
	addi 9,9,1
	b .L8
.L11:
	lbz 0,0(9)
	addi 9,9,1
	cmpdi 7,0,0
	beq- 7,.L4
.L8:
	cmpwi 7,0,47
	bne+ 7,.L11
	std 9,0(11)
	lbz 0,0(9)
	addi 9,9,1
	cmpdi 7,0,0
	bne+ 7,.L8
.L4:
	cmpdi 7,8,0
	beq- 7,.L12
	ld 9,.LC4 at toc(2)
	std 8,0(9)
.L12:
	ld 0,.LC5 at toc(2)
	cmpdi 7,0,0
	beq- 7,.L14
	ld 9,.LC6 at toc(2)
	std 2,40(1)
	ld 0,0(9)
	ld 11,16(9)
	mtctr 0
	ld 2,8(9)
	bctrl
	ld 2,40(1)
.L16:
	ld 9,.LC14 at toc(2)
	mr 3,31
	std 2,40(1)
	mr 4,30
	mr 5,28
	ld 0,0(9)
	ld 11,16(9)
	mtctr 0
	ld 2,8(9)
	bctrl
	ld 2,40(1)
	ld 9,.LC15 at toc(2)
	ld 0,0(9)
	ld 11,16(9)
	mtctr 0
	ld 2,8(9)
	bctrl
	ld 2,40(1)
.L31:
	std 5,0(9)
	b .L2
.L14:
	ld 9,.LC7 at toc(2)
	std 2,40(1)
	ld 0,0(9)
	ld 11,16(9)
	mtctr 0
	ld 2,8(9)
	bctrl
	ld 2,40(1)
	ld 9,.LC6 at toc(2)
	ld 3,.LC8 at toc(2)
	ld 0,0(9)
	ld 11,16(9)
	mtctr 0
	ld 2,8(9)
	bctrl
	ld 2,40(1)
	ld 0,.LC9 at toc(2)
	ld 26,.LC10 at toc(2)
	subf 0,26,0
	sradi. 27,0,3
	beq- 0,.L17
	li 29,0
	b .L19
.L20:
	addi 29,29,1
	cmpd 7,27,29
	beq- 7,.L17
.L19:
	sldi 0,29,3
	ldx 9,26,0
	cmpldi 7,9,1
	ble+ 7,.L20
	ld 0,0(9)
	mr 3,31
	std 2,40(1)
	mr 4,30
	mtctr 0
	mr 5,28
	ld 11,16(9)
	ld 2,8(9)
	bctrl
	ld 2,40(1)
	b .L20
.L17:
	ld 9,.LC11 at toc(2)
	std 2,40(1)
	ld 0,0(9)
	ld 11,16(9)
	mtctr 0
	ld 2,8(9)
	bctrl
	ld 2,40(1)
	ld 0,.LC12 at toc(2)
	ld 26,.LC13 at toc(2)
	subf 0,26,0
	sradi. 27,0,3
	beq- 0,.L16
	li 29,0
	b .L23
.L24:
	addi 29,29,1
	cmpd 7,27,29
	beq- 7,.L16
.L23:
	sldi 0,29,3
	ldx 9,26,0
	cmpldi 7,9,1
	ble+ 7,.L24
	ld 0,0(9)
	mr 3,31
	std 2,40(1)
	mr 4,30
	mtctr 0
	mr 5,28
	ld 11,16(9)
	ld 2,8(9)
	bctrl
	ld 2,40(1)
	b .L24
	.long 0
	.byte 0,0,0,1,128,6,0,0
	.size	_start,.-.L._start
	.section	".got","aw"
.LC16:
	.tc __fini_array_end[TC],__fini_array_end
.LC17:
	.tc __fini_array_start[TC],__fini_array_start
.LC18:
	.tc _fini[TC],_fini
	.section	".text"
	.align 2
	.section	".opd","aw"
	.align 3
finalizer:
	.quad	.L.finalizer,.TOC. at tocbase,0
	.previous
	.type	finalizer, @function
.L.finalizer:
	mflr 0
	ld 11,.LC17 at toc(2)
	std 0,16(1)
	ld 0,.LC16 at toc(2)
	std 30,-16(1)
	subf 0,11,0
	std 31,-8(1)
	sradi. 0,0,3
	stdu 1,-128(1)
	beq- 0,.L33
	sldi 9,0,3
	addi 9,9,-8
	add 30,9,11
	mr 31,0
	b .L35
.L36:
	cmpdi 7,31,0
	beq- 7,.L33
.L35:
	ld 9,0(30)
	addi 31,31,-1
	addi 30,30,-8
	cmpldi 7,9,1
	ble+ 7,.L36
	ld 0,0(9)
	std 2,40(1)
	mtctr 0
	ld 11,16(9)
	ld 2,8(9)
	bctrl
	ld 2,40(1)
	cmpdi 7,31,0
	bne+ 7,.L35
.L33:
	std 2,40(1)
	ld 9,.LC18 at toc(2)
	ld 0,0(9)
	ld 11,16(9)
	mtctr 0
	ld 2,8(9)
	bctrl
	ld 2,40(1)
	addi 1,1,128
	ld 0,16(1)
	ld 30,-16(1)
	mtlr 0
	ld 31,-8(1)
	blr
	.long 0
	.byte 0,0,0,1,128,2,0,0
	.size	finalizer,.-.L.finalizer
	.globl __progname
	.comm	environ,8,8
	.comm	__ps_strings,8,8
	.section	".data"
	.align 3
	.set	.LANCHOR0,. + 0
	.type	__progname, @object
	.size	__progname, 8
__progname:
	.quad	.LC19
	.section	.note.tag,"a", at progbits
	.align 2
	.type	crt_noinit_tag, @object
	.size	crt_noinit_tag, 24
crt_noinit_tag:
	.long	8
	.long	4
	.long	2
	.string	"FreeBSD"
	.long	0
	.type	abitag, @object
	.size	abitag, 24
abitag:
	.long	8
	.long	4
	.long	1
	.string	"FreeBSD"
	.long	1201000
	.section	.rodata.str1.8,"aMS", at progbits,1
	.align 3
.LC19:
	.string	""
	.weak	_DYNAMIC
	.hidden	__fini_array_start
	.hidden	__fini_array_end
	.hidden	__init_array_start
	.hidden	__init_array_end
	.hidden	__preinit_array_start
	.hidden	__preinit_array_end
	.hidden	_init
	.hidden	_fini
	.ident	"GCC: (GNU) 4.2.1 20070831 patched [FreeBSD]"
	.section	.note.GNU-stack,"", at progbits


More information about the fpc-devel mailing list