[FFmpeg-devel] [PATCH 1/3] configure: Force mingw's ld to keep the reloc section

Michael Niedermayer michael at niedermayer.cc
Fri Mar 18 13:52:28 CET 2016


On Fri, Mar 18, 2016 at 11:56:37AM +0100, Hendrik Leppkes wrote:
> On Sat, Mar 12, 2016 at 3:09 AM, Michael Niedermayer
> <michael at niedermayer.cc> wrote:
> > On Thu, Mar 10, 2016 at 07:57:53PM +0100, Hendrik Leppkes wrote:
> >> On Mon, Sep 21, 2015 at 6:41 AM, Alex Smith <alex.smith at warpsharp.info> wrote:
> >> > From: Alex Smith <alex.smith at warpsharp.info>
> >> >
> >> > Binutils will always strip the relocation information from executable
> >> > files even if it needs it (dynamicbase/ASLR).  We can work around this
> >> > by using the pic-executable flag combined with setting the correct entry
> >> > point since apparently ld forgets what that should be.  This problem
> >> > affects both 32 and 64-bit mingw-w64.
> >> >
> >> > We can combine the nxcompat/dynamicbase check because they were added to
> >> > binutils at the same time.
> >> >
> >> > Signed-off-by: Alex Smith <alex.smith at warpsharp.info>
> >> >
> >> > Conflicts:
> >> >         configure
> >> > ---
> >> >  configure | 13 +++++++++++--
> >> >  1 file changed, 11 insertions(+), 2 deletions(-)
> >> >
> >> > diff --git a/configure b/configure
> >> > index d2a25bb..d6ab35a 100755
> >> > --- a/configure
> >> > +++ b/configure
> >> > @@ -4367,8 +4367,6 @@ case $target_os in
> >> >              LIBTARGET=arm-wince
> >> >          fi
> >> >          enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
> >> > -        check_ldflags -Wl,--nxcompat
> >> > -        check_ldflags -Wl,--dynamicbase
> >> >          enabled x86_32 && check_ldflags -Wl,--large-address-aware
> >> >          shlibdir_default="$bindir_default"
> >> >          SLIBPREF=""
> >> > @@ -4392,6 +4390,17 @@ case $target_os in
> >> >          objformat="win32"
> >> >          ranlib=:
> >> >          enable dos_paths
> >> > +        check_ldflags -Wl,--nxcompat,--dynamicbase
> >> > +        # Lets work around some stupidity in binutils.
> >> > +        # ld will strip relocations from executables even though we need them
> >> > +        # for dynamicbase (ASLR).  Using -pie does retain the reloc section
> >> > +        # however ld then forgets what the entry point should be (oops) so we
> >> > +        # have to manually (re)set it.
> >> > +        if enabled x86_32; then
> >> > +            add_ldexeflags -Wl,--pic-executable,-e,_mainCRTStartup
> >> > +        elif enabled x86_64; then
> >> > +            add_ldexeflags -Wl,--pic-executable,-e,mainCRTStartup
> >> > +        fi
> >> >          ;;
> >> >      win32|win64)
> >> >          disable symver
> >>
> >> This patch (the relocations part) broke debugging mingw-w64 ffmpeg
> >> builds with gdb, you can't set breakpoints anymore when its applied.
> >> It should either be reverted or made dependent on
> >> --enable/disable-debug (I would favor the first, honestly, since its a
> >> rather ugly hack in itself).
> >
> > as i was the one applying it IIRC, i should probably comment ...
> > iam not against this being partially or fully revered/mode conditional
> > if it causes more problems than it does good.
> >
> >
> 
> I was hoping Alex would comment, but not being able to debug using GDB
> is a serious issue which people have reported ever since it was
> commited, we just never knew the cause of it.

CCing alex (again)


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160318/d1f4fafc/attachment.sig>


More information about the ffmpeg-devel mailing list