Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#303 Text relocation on ia32

open-accepted
Josh Coalson
libFLAC (57)
8
2009-01-01
2007-09-12
Bastien Nocera
No

From https://bugzilla.redhat.com/show_bug.cgi?id=285961

--8<--
libFLAC.so.8.1.0 on i386 is DT_TEXTREL, please avoid that.
The bad relocations are:
0004c653 0001c901 R_386_32 00054940 FLAC__crc16_table
0004c6f0 0001c901 R_386_32 00054940 FLAC__crc16_table
0004c84d 0001c901 R_386_32 00054940 FLAC__crc16_table
0004c78c 00017202 R_386_PC32 00009f20 bitreader_read_from_client_
0004c7e1 00017202 R_386_PC32 00009f20 bitreader_read_from_client_

%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE
mov edi, _FLAC__crc16_table
%else
mov edi, FLAC__crc16_table
%endif
or
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE
call _bitreader_read_from_client_
%else
call bitreader_read_from_client_
%endif
is not correct PIC code.
The latter is more easily fixable, assuming bitreader_read_from_client_
is not part of the exported ABI, making it hidden within the library is all
that is needed. simple_ogg_page__set_at and simple_ogg_page__init,
simple_ogg_page__get_at probably should be made hidden as well.
Just add __attribute__((__visibility__("hidden"))) to those 4 prototypes
or function definitions.
The 3 movl $FLAC__crc16_table_, %edi instructions really need to be rewritten
as PIC sequences, but I haven't studied if they are used in loops or not.
If not and you have one spare register, you can have:
.Lget_pc_thunk:
movl (%esp), %ecx
ret
somewhere and
call .Lget_pc_thunk
addl $_GLOBAL_OFFSET_TABLE_, %ecx
movl FLAC__crc16_table_(%ecx), %edi
to load the address. Unfortunately flac uses nasm, not sure how this can
be written in that.
--8<--

Discussion

  • Josh Coalson
    Josh Coalson
    2007-09-13

    • priority: 5 --> 6
    • assigned_to: nobody --> jcoalson
    • status: open --> open-accepted
     
  • Josh Coalson
    Josh Coalson
    2009-01-01

    • priority: 6 --> 8