Jonas:
> Anyway, you're right, the startup code for Linux/x86-64 does not
> pass the libc init/fini routines and hence is broken. And that's
> indeed not something to still change right before the release.
But perhaps you'll want to consider fpc-x86_64-cprt0.patch (attached)
for the trunk. I can confirm that it doesn't break Debian's build.
Perhaps someone else can test it in some other way.
And here's an improved patch for AArch64: fpc-aarch64-cprt0.patch.
AArch64 seems to need a corresponding version of the change that was
needed for i386, so I've included both changes here. (So if you've
already applied the patch from Debian bug #800811 there will be a
conflict.) Apart from the i386 part, this patch could perhaps go into
fixes_3_0_ios as it clearly (I hope) only affects AArch64-Linux so
can't break anything that used to work.
Edmund
--- a/rtl/linux/x86_64/cprt0.as
+++ b/rtl/linux/x86_64/cprt0.as
@@ -63,8 +63,8 @@
pushq %rsp
/* Pass address of our own entry points to .fini and .init. */
- movq _init_dummy@GOTPCREL(%rip), %rcx
- movq _fini_dummy@GOTPCREL(%rip), %r8
+ movq __libc_csu_init@GOTPCREL(%rip), %rcx
+ movq __libc_csu_fini@GOTPCREL(%rip), %r8
movq main_stub@GOTPCREL(%rip), %rdi
@@ -116,18 +116,6 @@
ret
.size _haltproc,.-_haltproc
- .globl _init_dummy
- .type _init_dummy, @function
-_init_dummy:
- ret
- .size _init_dummy,.-_init_dummy
-
- .globl _fini_dummy
- .type _fini_dummy, @function
-_fini_dummy:
- ret
- .size _fini_dummy,.-_fini_dummy
-
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
--- a/fpcsrc/compiler/systems/t_linux.pas
+++ b/fpcsrc/compiler/systems/t_linux.pas
@@ -149,6 +149,14 @@
if not Dontlinkstdlibpath Then
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/x86_64-linux-gnu',true);
{$endif x86_64}
+{$ifdef i386}
+ if not Dontlinkstdlibpath Then
+ LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/i386-linux-gnu',true);
+{$endif i386}
+{$ifdef aarch64}
+ if not Dontlinkstdlibpath Then
+ LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/aarch64-linux-gnu',true);
+{$endif aarch64}
end;
{$ifdef m68k}
--- a/fpcsrc/rtl/linux/aarch64/cprt0.as
+++ b/fpcsrc/rtl/linux/aarch64/cprt0.as
@@ -50,16 +50,6 @@
/* This should never happen */
b abort
- .globl _init
- .type _init,#function
-_init:
- ret
-
- .globl _fini
- .type _fini,#function
-_fini:
- ret
-
.globl _haltproc
.type _haltproc,#function
_haltproc:
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel