Shankar Iyer <sh22i...@yahoo.co.in> writes:

>   I have compiled and generated a C++ shared library with the "-fPIC" option. 
> But this shared library requires text relocation during runtime and is not 
> usable on seLinux which disables writeable text segments. The text relocation 
> is due to use of exceptions inside the shared library. There is a segment 
> ".gcc_except_table" created in the shared library and it contains symbols 
> suffixed with "$$LSDA" :-
>
> 0013df38 <_ZN6comref4runt11userdef20releasebackEPS1_$$LSDA>:
>   13df38:       ff 00                   incl   (%eax)
>   13df3a:       18 01                   sbb    %al,(%ecx)
>   13df3c:       0c 1c                   or     $0x1c,%al
>   13df3e:       03 2f                   add    (%edi),%ebp
>   13df40:       01 52 0a                add    %edx,0xa(%edx)
>   13df43:       6d                      insl   (%dx),%es:(%edi)
>   13df44:       00 66 1a                add    %ah,0x1a(%esi)
>   13df47:       00 00                   add    %al,(%eax)
>   13df49:       02 00                   add    (%eax),%al
>         ...
>    13df4b: R_386_32        _ZTIN6comref4runt12genExceptionE
>
>
>   Can someone please help in understand the issue and how to work around?

This question as stated is not appropriate for the gcc@gcc.gnu.org
mailing list.  It would be appropriate for gcc-h...@gcc.gnu.org.
Please take any followups to gcc-help.  Thanks.

You neglected to mention which version of gcc you are using.

Normally when compiling with -fPIC the compiler will make the
.gcc_except_table section writable if necessary.  So the first step is
to use readelf -S or objdump -h to see if the section is writable.  If
it is, it should not be in the text segment.

If the section is read-only, then tell us what relocations appear in
the section, by using readelf -r.  Also tell us the version of the GNU
binutils that you are using, and whether it is the same version that
was used when gcc was configured and built.  The build process will
test the binutils at build time to see what capabilities they have.

Ian

Reply via email to