[FFmpeg-trac] #7878(build system:new): x86 builds silently generate text-relocations in the binary.

FFmpeg trac at avcodec.org
Wed May 1 23:48:29 EEST 2019


#7878: x86 builds silently generate text-relocations in the binary.
-------------------------------------+-------------------------------------
               Reporter:             |                  Owner:
  dalecurtis                         |
                   Type:  defect     |                 Status:  new
               Priority:  wish       |              Component:  build
                Version:  git-       |  system
  master                             |               Keywords:
             Blocked By:             |               Blocking:
Reproduced by developer:  0          |  Analyzed by developer:  0
-------------------------------------+-------------------------------------
 Due to this line in x86inc.asm:

 {{{
 %elif ARCH_X86_64 == 0
 ; x86_32 doesn't require PIC.
 ; Some distros prefer shared objects to be PIC, but nothing breaks if
 ; the code contains a few textrels, so we'll skip that complexity.
     %undef PIC
 %endif
 }}}

 When linking with lld instead of ld.bfd or gold, you'll end up with errors
 like this:
 ld.lld: error: can't create dynamic relocation R_386_32 against local
 symbol in readonly segment; recompile object files with -fPIC or pass
 '-Wl,-z,notext' to allow text relocations in the output

 This is because ld.bfd and gold will silently disable warning about text
 relocations, from https://crbug.com/911658#c19:
   If ld.bfd and gold find text relocations required, they'll silently
 produce modules with text relocations (DT_TEXTREL or DF_TEXTREL), as if -z
 notext is specified by the user. lld doesn't have such ondemand semantics
 - it'll just reject text relocations outright unless -z notext is on the
 command line.

 Removing text relocations improves security and reduces load times:
 https://android.googlesource.com/platform/bionic/+/master/android-changes-
 for-ndk-developers.md#Text-Relocations-Enforced-for-API-level-23

 So it'd be nice to fix this at some point. Just removing the lines from
 x86inc.asm will break large swaths of the assembly code unfortunately, so
 folks with more knowledge of the code will have to take a look.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7878>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list