Gentoo Archives: gentoo-commits

From: "Harald van Dijk (truedfx)" <truedfx@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/fpc/files: fpc-2.2.4-execstack.patch
Date: Thu, 23 Apr 2009 21:05:14
Message-Id: E1Lx66S-0001sO-Lu@stork.gentoo.org
1 truedfx 09/04/23 21:05:04
2
3 Added: fpc-2.2.4-execstack.patch
4 Log:
5 Add fpc 2.2.4 (#266988)
6 (Portage version: 2.2_rc31/cvs/Linux i686)
7
8 Revision Changes Path
9 1.1 dev-lang/fpc/files/fpc-2.2.4-execstack.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/fpc/files/fpc-2.2.4-execstack.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/fpc/files/fpc-2.2.4-execstack.patch?rev=1.1&content-type=text/plain
13
14 Index: fpc-2.2.4-execstack.patch
15 ===================================================================
16
17 http://bugs.gentoo.org/show_bug.cgi?id=228867
18 http://mantis.freepascal.org/view.php?id=11563
19
20 --- fpcbuild-2.2.2/fpcsrc/compiler/aggas.pas
21 +++ fpcbuild-2.2.2/fpcsrc/compiler/aggas.pas
22 @@ -1074,6 +1074,13 @@
23 (target_info.system in systems_darwin) then
24 AsmWriteLn(#9'.subsections_via_symbols');
25
26 + { "no executable stack" marker for Linux }
27 + if (target_info.system in system_linux) and
28 + not(cs_executable_stack in current_settings.moduleswitches) then
29 + begin
30 + AsmWriteLn('.section .note.GNU-stack,"",%progbits');
31 + end;
32 +
33 AsmLn;
34 {$ifdef EXTDEBUG}
35 if assigned(current_module.mainsource) then
36 --- fpcbuild-2.2.2/fpcsrc/compiler/globtype.pas
37 +++ fpcbuild-2.2.2/fpcsrc/compiler/globtype.pas
38 @@ -109,7 +109,9 @@
39 { linking }
40 cs_create_smart,cs_create_dynamic,cs_create_pic,
41 { browser switches are back }
42 - cs_browser,cs_local_browser
43 + cs_browser,cs_local_browser,
44 + { target specific }
45 + cs_executable_stack
46 );
47 tmoduleswitches = set of tmoduleswitch;
48
49 --- fpcbuild-2.2.2/fpcsrc/compiler/msg/errore.msg
50 +++ fpcbuild-2.2.2/fpcsrc/compiler/msg/errore.msg
51 @@ -2704,6 +2704,7 @@
52 3*1W<x>_Target-specific options (targets)
53 A*1W<x>_Target-specific options (targets)
54 P*1W<x>_Target-specific options (targets)
55 +p*1W<x>_Target-specific options (targets)
56 3*2Wb_Create a bundle instead of a library (Darwin)
57 P*2Wb_Create a bundle instead of a library (Darwin)
58 p*2Wb_Create a bundle instead of a library (Darwin)
59 @@ -2723,6 +2724,10 @@
60 3*2WR_Generate relocation code (Windows)
61 A*2WR_Generate relocation code (Windows)
62 P*2WT_Specify MPW tool type application (Classic Mac OS)
63 +3*2WX_Enable executable stack (Linux)
64 +A*2WX_Enable executable stack (Linux)
65 +p*2WX_Enable executable stack (Linux)
66 +P*2WX_Enable executable stack (Linux)
67 **1X_Executable options:
68 **2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Linux)
69 **2Xd_Do not use standard library search path (needed for cross compile)
70 --- fpcbuild-2.2.2/fpcsrc/compiler/msgidx.inc
71 +++ fpcbuild-2.2.2/fpcsrc/compiler/msgidx.inc
72 @@ -740,7 +740,7 @@
73 option_info=11024;
74 option_help_pages=11025;
75
76 - MsgTxtSize = 46171;
77 + MsgTxtSize = 46365;
78
79 MsgIdxMax : array[1..20] of longint=(
80 24,87,250,84,63,50,108,22,135,61,
81 --- fpcbuild-2.2.2/fpcsrc/compiler/msgtxt.inc
82 +++ fpcbuild-2.2.2/fpcsrc/compiler/msgtxt.inc
83 @@ -1,7 +1,7 @@
84 {$ifdef Delphi}
85 -const msgtxt : array[0..000192] of string[240]=(
86 +const msgtxt : array[0..000193] of string[240]=(
87 {$else Delphi}
88 -const msgtxt : array[0..000192,1..240] of char=(
89 +const msgtxt : array[0..000193,1..240] of char=(
90 {$endif Delphi}
91 '01000_T_Compiler: $1'#000+
92 '01001_D_Compiler OS: $1'#000+
93 @@ -1055,48 +1055,53 @@
94 '3*1W<x>_Target-specific options (targets)'#010+
95 'A*1W<x>_Target-specific options (targets)'#010+
96 'P*1W<x>_Target-specific options (targets)'#010+
97 - '3*2Wb_Create a bundle instead of a ','library (Darwin)'#010+
98 + 'p*1W<x>_Target-specific options (ta','rgets)'#010+
99 + '3*2Wb_Create a bundle instead of a library (Darwin)'#010+
100 'P*2Wb_Create a bundle instead of a library (Darwin)'#010+
101 'p*2Wb_Create a bundle instead of a library (Darwin)'#010+
102 '3*2WB_Create a relocatable image (Windows)'#010+
103 - 'A*2WB_Create a relocatable image (Windows, Symbian)'#010+
104 - '3*2WC_Specify console ty','pe application (EMX, OS/2, Windows)'#010+
105 + 'A*2WB_Create a relocatable image (','Windows, Symbian)'#010+
106 + '3*2WC_Specify console type application (EMX, OS/2, Windows)'#010+
107 'A*2WC_Specify console type application (Windows)'#010+
108 'P*2WC_Specify console type application (Classic Mac OS)'#010+
109 - '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
110 - 'A*2WD_Use DEFFILE to export functions',' of DLL or EXE (Windows)'#010+
111 + '3*2WD_Use DEFFILE to export functions of DLL or EXE (Wind','ows)'#010+
112 + 'A*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
113 '3*2WF_Specify full-screen type application (EMX, OS/2)'#010+
114 '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
115 'A*2WG_Specify graphic type application (Windows)'#010+
116 - 'P*2WG_Specify graphic type application (Classic Mac',' OS)'#010+
117 + 'P*2WG_Spe','cify graphic type application (Classic Mac OS)'#010+
118 '3*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
119 'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
120 '3*2WR_Generate relocation code (Windows)'#010+
121 - 'A*2WR_Generate relocation code (Windows)'#010+
122 - 'P*2WT_Specify',' MPW tool type application (Classic Mac OS)'#010+
123 - '**1X_Executable options:'#010+
124 + 'A*2WR_Genera','te relocation code (Windows)'#010+
125 + 'P*2WT_Specify MPW tool type application (Classic Mac OS)'#010+
126 + '3*2WX_Enable executable stack (Linux)'#010+
127 + 'A*2WX_Enable executable stack (Linux)'#010+
128 + 'p*2WX_Enable executable stack (Linux)'#010+
129 + 'P*2WX_Enable executable stack (Linux)'#010+
130 + '**','1X_Executable options:'#010+
131 '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+
132 'ux)'#010+
133 '**2Xd_Do not use standard library search path (needed for cross compil'+
134 'e)'#010+
135 - '**2Xe_Use external linke','r'#010+
136 - '**2Xg_Create debuginfo in a separate file and add a debuglink section '+
137 - 'to executable'#010+
138 + '**2Xe_Use external linker'#010+
139 + '**2Xg_Create debuginfo in a separate file an','d add a debuglink sectio'+
140 + 'n to executable'#010+
141 '**2XD_Try to link units dynamically (defines FPC_LINK_DYNAMIC)'#010+
142 '**2Xi_Use internal linker'#010+
143 '**2Xm_Generate link map'#010+
144 - '**2XM<x>_Set the name of the '#039'main'#039' ','program routine (default'+
145 - ' is '#039'main'#039')'#010+
146 - '**2XP<x>_Prepend the binutils names with the prefix <x>'#010+
147 + '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+
148 + 's '#039'main'#039')'#010+
149 + '**2XP<x>_P','repend the binutils names with the prefix <x>'#010+
150 '**2Xr<x>_Set library search path to <x> (needed for cross compile) (Be'+
151 'OS, Linux)'#010+
152 - '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, Free','B'+
153 - 'SD, Linux, Mac OS, Solaris)'#010+
154 - '**2Xs_Strip all symbols from executable'#010+
155 + '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD'+
156 + ', Linux, Mac OS, Solaris)'#010+
157 + '**2Xs_Strip all s','ymbols from executable'#010+
158 '**2XS_Try to link units statically (default, defines FPC_LINK_STATIC)'#010+
159 '**2Xt_Link with static libraries (-static is passed to linker)'#010+
160 - '**2XX_Try to smartlink units ',' (defines FPC_LINK_SMART)'#010+
161 + '**2XX_Try to smartlink units (defines FPC_LINK_SMART)'#010+
162 '**1*_'#010+
163 - '**1?_Show this help'#010+
164 + '**1?_Show th','is help'#010+
165 '**1h_Shows this help without waiting'#000
166 );
167 --- fpcbuild-2.2.2/fpcsrc/compiler/ogelf.pas
168 +++ fpcbuild-2.2.2/fpcsrc/compiler/ogelf.pas
169 @@ -1021,6 +1021,10 @@
170 symtabsect:=TElfObjSection.create_ext(ObjSectionList,'.symtab',SHT_SYMTAB,0,0,0,4,sizeof(telfsymbol));
171 strtabsect:=TElfObjSection.create_ext(ObjSectionList,'.strtab',SHT_STRTAB,0,0,0,1,0);
172 shstrtabsect:=TElfObjSection.create_ext(ObjSectionList,'.shstrtab',SHT_STRTAB,0,0,0,1,0);
173 + { "no executable stack" marker for Linux }
174 + if (target_info.system in system_linux) and
175 + not(cs_executable_stack in current_settings.moduleswitches) then
176 + TElfObjSection.create_ext(ObjSectionList,'.note.GNU-stack',SHT_PROGBITS,0,0,0,1,0);
177 { insert the empty and filename as first in strtab }
178 strtabsect.writestr(#0);
179 strtabsect.writestr(ExtractFileName(current_module.mainsource^)+#0);
180 --- fpcbuild-2.2.2/fpcsrc/compiler/options.pas
181 +++ fpcbuild-2.2.2/fpcsrc/compiler/options.pas
182 @@ -1357,6 +1357,18 @@
183 else
184 apptype:=app_tool;
185 end;
186 + 'X':
187 + begin
188 + if (target_info.system in system_linux) then
189 + begin
190 + if UnsetBool(More, j) then
191 + exclude(init_settings.moduleswitches,cs_executable_stack)
192 + else
193 + include(init_settings.moduleswitches,cs_executable_stack)
194 + end
195 + else
196 + IllegalPara(opt);
197 + end
198 else
199 IllegalPara(opt);
200 end;
201 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/arm/cprt0.as
202 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/arm/cprt0.as
203 @@ -135,3 +135,5 @@
204 2: .long 0
205 .long 2,0,0
206 3: .align 4
207 +
208 +.section .note.GNU-stack,"",%progbits
209 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/arm/gprt0.as
210 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/arm/gprt0.as
211 @@ -90,3 +90,4 @@
212 .long 2,0,0
213 3: .align 4
214
215 +.section .note.GNU-stack,"",%progbits
216 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/arm/prt0.as
217 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/arm/prt0.as
218 @@ -108,3 +108,5 @@
219 2: .long 0
220 .long 2,0,0
221 3: .align 4
222 +
223 +.section .note.GNU-stack,"",%progbits
224 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/arm/ucprt0.as
225 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/arm/ucprt0.as
226 @@ -178,3 +178,5 @@
227 2: .long 0
228 .long 2,0,0
229 3: .align 4
230 +
231 +.section .note.GNU-stack,"",%progbits
232 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/i386/cprt0.as
233 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/i386/cprt0.as
234 @@ -105,3 +105,5 @@
235 .set operatingsystem_parameter_envp,operatingsystem_parameters+0
236 .set operatingsystem_parameter_argc,operatingsystem_parameters+4
237 .set operatingsystem_parameter_argv,operatingsystem_parameters+8
238 +
239 +.section .note.GNU-stack,"",%progbits
240 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/i386/cprt21.as
241 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/i386/cprt21.as
242 @@ -122,3 +122,5 @@
243 .set operatingsystem_parameter_envp,operatingsystem_parameters+0
244 .set operatingsystem_parameter_argc,operatingsystem_parameters+4
245 .set operatingsystem_parameter_argv,operatingsystem_parameters+8
246 +
247 +.section .note.GNU-stack,"",%progbits
248 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/i386/dllprt0.as
249 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/i386/dllprt0.as
250 @@ -72,3 +72,4 @@
251 .set operatingsystem_parameter_argc,operatingsystem_parameters+4
252 .set operatingsystem_parameter_argv,operatingsystem_parameters+8
253
254 +.section .note.GNU-stack,"",%progbits
255 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/i386/gprt0.as
256 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/i386/gprt0.as
257 @@ -87,3 +87,5 @@
258 .set operatingsystem_parameter_envp,operatingsystem_parameters+0
259 .set operatingsystem_parameter_argc,operatingsystem_parameters+4
260 .set operatingsystem_parameter_argv,operatingsystem_parameters+8
261 +
262 +.section .note.GNU-stack,"",%progbits
263 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/i386/gprt21.as
264 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/i386/gprt21.as
265 @@ -136,3 +136,4 @@
266 .set operatingsystem_parameter_argc,operatingsystem_parameters+4
267 .set operatingsystem_parameter_argv,operatingsystem_parameters+8
268
269 +.section .note.GNU-stack,"",%progbits
270 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/i386/prt0.as
271 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/i386/prt0.as
272 @@ -109,3 +109,4 @@
273
274 //.section .threadvar,"aw",@nobits
275 .comm ___fpc_threadvar_offset,4
276 +.section .note.GNU-stack,"",%progbits
277 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/powerpc/cprt0.as
278 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/powerpc/cprt0.as
279 @@ -117,3 +117,4 @@
280 .comm operatingsystem_parameter_argc, 4
281 .comm operatingsystem_parameter_argv, 4
282
283 +.section .note.GNU-stack,"",%progbits
284 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/powerpc/prt0.as
285 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/powerpc/prt0.as
286 @@ -67,3 +67,5 @@
287 .comm operatingsystem_parameter_envp,4
288 .comm operatingsystem_parameter_argc,4
289 .comm operatingsystem_parameter_argv,4
290 +
291 +.section .note.GNU-stack,"",%progbits
292 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/powerpc64/cprt0.as
293 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/powerpc64/cprt0.as
294 @@ -433,3 +433,5 @@
295 .comm operatingsystem_parameter_argc, 4
296 .comm operatingsystem_parameter_argv, 8
297 .comm operatingsystem_parameter_envp, 8
298 +
299 +.section .note.GNU-stack,"",%progbits
300 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/powerpc64/gprt0.as
301 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/powerpc64/gprt0.as
302 @@ -439,3 +439,5 @@
303 .comm operatingsystem_parameter_argc, 4
304 .comm operatingsystem_parameter_argv, 8
305 .comm operatingsystem_parameter_envp, 8
306 +
307 +.section .note.GNU-stack,"",%progbits
308 --- fpcbuild-2.2.2/fpcsrc/rtl/linux/powerpc64/prt0.as
309 +++ fpcbuild-2.2.2/fpcsrc/rtl/linux/powerpc64/prt0.as
310 @@ -376,3 +376,4 @@
311 .comm operatingsystem_parameter_argv, 8
312 .comm operatingsystem_parameter_envp, 8
313
314 +.section .note.GNU-stack,"",%progbits
315 --- /dev/null
316 +++ fpcbuild-2.2.2/fpcsrc/tests/webtbs/tw11563.pp
317 @@ -0,0 +1,40 @@
318 +{ %target=linux}
319 +{ %result=216 }
320 +
321 +program ExecStack;
322 + procedure DoIt;
323 + type
324 + proc = procedure;
325 + var
326 +{$if defined(cpupowerpc) or defined(cpupowerpc64)}
327 + ret: longint;
328 +{$endif}
329 +{$if defined(cpui386) or defined(cpux86_64)}
330 + ret: Byte;
331 +{$endif}
332 +{$ifdef cpuarm}
333 + 'add arm code to test stack execution'
334 +{$endif}
335 + DoNothing: proc;
336 +
337 + begin
338 +{$if defined(cpupowerpc) or defined(cpupowerpc64)}
339 + { can't use proc(@ret) because linux/ppc64 always expects some kind of
340 + trampoline
341 + }
342 + ret := ($4e shl 24) or ($80 shl 16) or ($00 shl 8) or $20;
343 + asm
344 + la r0, ret
345 + mtctr r0
346 + bctrl
347 + end;
348 +{$endif}
349 +{$if defined(cpui386) or defined(cpux86_64)}
350 + ret := $C3;
351 + DoNothing := proc(@ret);
352 + DoNothing;
353 +{$endif}
354 + end;
355 +begin
356 + DoIt;
357 +end.