[fpc-pascal] Executable stack in shared library
Matthias Klumpp
matthias at nlinux.org
Fri May 21 20:13:55 CEST 2010
Hi!
Thank you for the information! I use FPC 2.4.0 but get this warning...
Here's the output of readelf -l on the shared library:
----------------------------
Elf file type is DYN (Shared object file)
Entry point 0xf3db0
There are 4 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000358c9c 0x0000000000358c9c R E 200000
LOAD 0x0000000000359000 0x0000000000559000 0x0000000000559000
0x00000000000f11b0 0x0000000000108380 RW 200000
DYNAMIC 0x0000000000359028 0x0000000000559028 0x0000000000559028
0x0000000000000210 0x0000000000000210 RW 8
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RWE 8
Section to Segment mapping:
Segment Sections...
00 .hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn
.rela.plt .init .plt .text .fini .eh_frame
01 .ctors .dtors .jcr .dynamic .got .got.plt .data fpc.resources
.bss fpc.reshandles
02 .dynamic
03
---------------------------
It seems like the E flag is set.
I compile the library with this compiler parameters:
-MObjFPC -Scgi -O1 -gl -vewnhi -l
-Fu/usr/share/fpcsrc/2.4.0/packages/dbus/src/
-Fu/usr/lib/lazarus/0.9.29/lcl/units/x86_64-linux/
-Fu/usr/lib/lazarus/0.9.29/lcl/units/x86_64-linux/nogui/ -Fu. -vm5024 -fPIC
(I removed some of the -FU includes)
Regards
Matthias
On Fri, 21 May 2010 19:53:04 +0200, Jonas Maebe <jonas.maebe at elis.ugent.be>
wrote:
> On 21 May 2010, at 18:50, Matthias Klumpp wrote:
>
>> I package a Freepascal project for Debian which uses a shared library.
If
>> I
>> run the quality analysis on those packages, I get a warning, that the
>> shared library has an executable stack.
>
> Which version of FPC are you using? We have been adding the "do not
create
> an executable stack" section to ELF files since FPC 2.2.4 already.
>
>> Why does it have one, if it is
>> not necessary?
>
> The default of the GNU binutils is "create an executable stack". The
object
> files have to contain a special section for it to be disabled.
>
>> How can I disable this in FPC?
>
> Update your FPC version. There's also a linker parameter that you can
use,
> but that's not the recommended approach.
>
>
> Jonas_______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list