summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/fpc-glibc-2.34-compat.patch
blob: 4d78d6e028a1d777ab1484a91eaee16ca8c8eb88 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
https://sources.debian.org/data/main/f/fpc/3.2.2%2Bdfsg-22/debian/patches/glibc2.34.patch

Description: Adjust startup code for glibc 2.34
 Based on the corresponding changes made in glibc:
 https://sourceware.org/git/?p=glibc.git;a=commit;h=035c012e32c11e84d64905efaf55e74f704d3668
Bug: https://gitlab.com/freepascal.org/fpc/source/-/issues/39295
Author: Graham Inggs <ginggs@debian.org>
Last-Update: 2022-08-12

--- a/fpcsrc/rtl/linux/powerpc64/cprt0.as
+++ b/fpcsrc/rtl/linux/powerpc64/cprt0.as
@@ -351,8 +351,8 @@
 start_addresses:
     .quad   0 /* was _SDA_BASE_  but not in 64-bit ABI*/
     .quad   main_stub
-    .quad   __libc_csu_init
-    .quad   __libc_csu_fini
+    .quad   0
+    .quad   0
     .size   start_adresses, .-start_addresses
 
 /*
--- a/fpcsrc/rtl/linux/powerpc64/gprt0.as
+++ b/fpcsrc/rtl/linux/powerpc64/gprt0.as
@@ -351,8 +351,8 @@
 start_addresses:
     .quad   0 /* was _SDA_BASE_  but not in 64-bit ABI*/
     .quad   main_stub
-    .quad   __libc_csu_init
-    .quad   __libc_csu_fini
+    .quad   0
+    .quad   0
     .size   start_adresses, .-start_addresses
 
 /*
--- a/fpcsrc/rtl/linux/aarch64/cprt0.as
+++ b/fpcsrc/rtl/linux/aarch64/cprt0.as
@@ -41,10 +41,8 @@
 	                     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]
+	mov	x3, #0
+	mov	x4, #0
 	bl	__libc_start_main
 
 	/* This should never happen */
--- a/fpcsrc/rtl/linux/i386/si_c21.inc
+++ b/fpcsrc/rtl/linux/i386/si_c21.inc
@@ -35,8 +35,6 @@
 
 {$asmmode att}
 
-procedure __libc_csu_init; cdecl; external;
-procedure __libc_csu_fini; cdecl; external;
 procedure libc_start_main; external name '__libc_start_main';
 procedure libc_exit(code: longint); cdecl; external name 'exit';
 
@@ -93,8 +91,8 @@
         pushl %esp   			{ stack_end }
         pushl %edx   			{ function to be registered with
                       			  atexit(), passed by loader }
-        pushl $__libc_csu_fini
-        pushl $__libc_csu_init
+        pushl $0
+        pushl $0
         pushl %esi                      { Push second argument: argv.  }
         pushl %ecx                      { Push first argument: argc.  }
 
--- a/fpcsrc/rtl/linux/x86_64/cprt0.as
+++ b/fpcsrc/rtl/linux/x86_64/cprt0.as
@@ -61,9 +61,8 @@
 	   which grow downwards).  */
 	pushq %rsp
 
-	/* Pass address of our own entry points to .fini and .init.  */
-	movq __libc_csu_init@GOTPCREL(%rip), %rcx
-	movq __libc_csu_fini@GOTPCREL(%rip), %r8
+	xorl %r8d, %r8d
+	xorl %ecx, %ecx
 
 	movq main_stub@GOTPCREL(%rip), %rdi
 
--- a/fpcsrc/rtl/linux/arm/cprt0.as
+++ b/fpcsrc/rtl/linux/arm/cprt0.as
@@ -82,10 +82,10 @@
 
         /* Set up the other arguments in registers */
         ldr a1, =PASCALMAIN
-        ldr a4, =_init
+        ldr a4, = #0
 
         /* Push fini */
-        str ip, [sp, #-4]!
+        str a4, [sp, #-4]!
 
         /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
 
--- a/fpcsrc/rtl/linux/powerpc64/si_g.inc
+++ b/fpcsrc/rtl/linux/powerpc64/si_g.inc
@@ -657,9 +657,6 @@
                           Process start/halt
  ******************************************************************************}
 
-procedure __libc_csu_init; cdecl; external;
-procedure __libc_csu_fini; cdecl; external;
-
 procedure __libc_start_main(r3,r4,r5,r6,r7,r8,r9: pointer); cdecl; external;
 
 type
@@ -745,8 +742,8 @@
   end
   = (sda_base: nil; {* was _SDA_BASE_  but not in 64-bit ABI }
      main: @main_stub;
-     libc_csu_init: @__libc_csu_init;
-     libc_csu_fini: @__libc_csu_fini
+     libc_csu_init: pointer(0);
+     libc_csu_fini: pointer(0)
     );
 
 procedure call_libc_start_main(r3,r4,r5,r6,r7,r8,r9: pointer); cdecl;
--- a/fpcsrc/rtl/linux/powerpc64/si_c.inc
+++ b/fpcsrc/rtl/linux/powerpc64/si_c.inc
@@ -657,9 +657,6 @@
                           Process start/halt
  ******************************************************************************}
 
-procedure __libc_csu_init; cdecl; external;
-procedure __libc_csu_fini; cdecl; external;
-
 procedure __libc_start_main(r3,r4,r5,r6,r7,r8,r9: pointer); cdecl; external;
 
 var
@@ -724,8 +721,8 @@
   end
   = (sda_base: nil; {* was _SDA_BASE_  but not in 64-bit ABI }
      main: @main_stub;
-     libc_csu_init: @__libc_csu_init;
-     libc_csu_fini: @__libc_csu_fini
+     libc_csu_init: pointer(0);
+     libc_csu_fini: pointer(0)
     );
 
 
--- a/fpcsrc/rtl/linux/powerpc/cprt0.as
+++ b/fpcsrc/rtl/linux/powerpc/cprt0.as
@@ -35,8 +35,8 @@
 start_addresses:
     .long     _SDA_BASE_
     .long     main_stub
-    .long     __libc_csu_init
-    .long     __libc_csu_fini
+    .long     0
+    .long     0
     .size   start_adresses, .-start_addresses
 
     .section ".text"
--- a/fpcsrc/rtl/linux/mips/cprt0.as
+++ b/fpcsrc/rtl/linux/mips/cprt0.as
@@ -113,10 +113,9 @@
  and $29, -2 * 4
  subu $29, 32
 
- lw $7,%got(__libc_csu_init)($gp) /* init */
- lw $8,%got(__libc_csu_fini)($gp) /* fini */
+ move $7, $0
 
- sw $8, 16($29)				/* fini */
+ sw $0, 16($29)
  sw $2, 20($29)				/* rtld_fini */
  sw $29, 24($29)			/* stack_end */
 
--- a/fpcsrc/rtl/linux/m68k/cprt0.as
+++ b/fpcsrc/rtl/linux/m68k/cprt0.as
@@ -41,8 +41,10 @@
 
         pea      (%sp)         /* highest available stack address */
         pea      (%a1)         /* termination function provided by kernel */
-        pea      __libc_csu_fini
-        pea      __libc_csu_init
+
+        clr.l    -(%sp)
+        clr.l    -(%sp)
+
         pea      (%a0)         /* argv */
         move.l   %d0,-(%sp)    /* argc */
         pea      PASCALMAIN