[Libav-user] ld: warning: PIE disabled.

Tim Rodgers trodgers at mac.com
Mon Mar 30 20:47:10 CEST 2015


On Mar 30, 2015, at 1:25 PM, Tim Rodgers <trodgers at mac.com> wrote:
> 
> On Mar 30, 2015, at 6:16 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>> 
>> Tim1961 <trodgers at ...> writes:
>> 
>>> Can anyone shed light on this warning?
>> 
>> I am unable to reproduce this, what is 
>> your configure line?

This is not a problem in libavcodec. The fix is to add

	-read_only_relocs suppress

to the application linker flags of _my_ application when the arch is i386.

The warning generated by clang-600.0.57 was "ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in _ff_h264_decode_mb_cabac from libavcodec.a(h264_cabac.o)". Other compilers generate the similar warning "ld: illegal text-relocoation (direct reference) to (global,weak) _ff_h264_cabac_tables in ...(cabac.o) from _ff_h264_decode_mb_cabac in ...(h264_cabac.o) for architecture i386". There have been many discussions over the years re: "illegal text-relocation" and the most frequently referenced explanation I found is

	http://lists.apple.com/archives/unix-porting/2008/Jan/msg00027.html

In a nutshell, libavcodec/h264_cabac.c includes libavcodec/x86/h264_i386.h when compiling for i386 and h264_i386.h defines two functions implemented in assembler. I believe the compiler is warning us that data referenced by the assembler might exist in some other linkage unit (library?) and so loading at runtime could fail.

H.264 CABAC encoding/decoding works on i386 so it's safe to ignore the warning and add "-read_only_relocs suppress" to the linker flags for arch i386.

Corrections are welcome!

_Many_ thanks,
Tim



More information about the Libav-user mailing list