FS#74281 - [fpc] cprt0.o not compatible with new glibc on aarch64 (and others?)

Attached to Project: Community Packages
Opened by Philip Christian (dieselnutjob) - Wednesday, 30 March 2022, 16:52 GMT
Last edited by Antonio Rojas (arojas) - Wednesday, 30 March 2022, 16:54 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: cannot compile a lazarus program using fpc version 3.2.2-3 on Manjaro aarch64 (Pinebook pro).

Additional info:
* package version(s) 3.2.2-3
* config and/or log files etc.
Compile Project, Target: project1: Exit code 1, Errors: 6, Warnings: 2
project1.lpr(26,0) Warning: "crtbegin.o" not found, this will probably cause a linking failure
project1.lpr(26,0) Warning: "crtend.o" not found, this will probably cause a linking failure
Error: /bin/ld: /usr/lib/fpc/3.2.2/units/aarch64-linux/rtl/cprt0.o: in function `_start':
Error: (.text+0x54): undefined reference to `__libc_csu_init'
Error: /bin/ld: (.text+0x58): undefined reference to `__libc_csu_init'
Error: /bin/ld: (.text+0x5c): undefined reference to `__libc_csu_fini'
Error: /bin/ld: (.text+0x60): undefined reference to `__libc_csu_fini'
project1.lpr(26,0) Error: Error while linking
* link to upstream bug report, if any

Steps to reproduce:
Install lazarus and try to compile something.

The solution as specified here https://forum.lazarus.freepascal.org/index.php/topic,58877.msg438842.html#msg438842 works.

Specifically in /usr/lib/fpc/src/rtl/linux/aarch64/cprt0.as change

/* __libc_start_main(main, argc, argv,
init, fini, rtld_fini, stack_end) */
adrp x0,:got:PASCALMAIN
ldr x0,[x0,#:got_lo12:PASCALMAIN]
adrp x3,:got:__libc_csu_init
ldr x3,[x3,#:got_lo12:__libc_csu_init]
adrp x4,:got:__libc_csu_fini
ldr x4,[x4,#:got_lo12:__libc_csu_fini]
bl __libc_start_main

to

/* __libc_start_main(main, argc, argv,
init, fini, rtld_fini, stack_end) */
adrp x0,:got:PASCALMAIN
ldr x0,[x0,#:got_lo12:PASCALMAIN]
mov x3,xzr
mov x4,xzr
bl __libc_start_main

recompile and replace /usr/lib/fpc/3.2.2/units/aarch64-linux/rtl/cprt0.o

I am on Manjaro so I cannot comment on anything newer in arch
This task depends upon

Closed by  Antonio Rojas (arojas)
Wednesday, 30 March 2022, 16:54 GMT
Reason for closing:  Not a bug
Additional comments about closing:  This is not the Manjaro bug tracker

Loading...