Message ID | 20161214154756.22116-1-robUx4@gmail.com |
---|---|
State | New |
Headers | show |
2016-12-14 16:47 GMT+01:00 Steve Lhomme <robux4@gmail.com>: > From: Steve Lhomme <robux4@gmail.com> > > Without any optimization flags, MSVC does no dead code elimination (DCE) at > all, even for the most trivial cases. DCE is a prerequisite for building ffmpeg > correctly, otherwise there are undefined references to functions for other > architectures and disabled components. > > -Os -Og is the minimal optimization flags for MSVC that does include DCE. The patch looks good to me if -Og alone doesn't help, thank you for the improved commit message. Carl Eugen
On 16 December 2016 at 11:20, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote: > 2016-12-14 16:47 GMT+01:00 Steve Lhomme <robux4@gmail.com>: > > From: Steve Lhomme <robux4@gmail.com> > > > > Without any optimization flags, MSVC does no dead code elimination (DCE) > at > > all, even for the most trivial cases. DCE is a prerequisite for building > ffmpeg > > correctly, otherwise there are undefined references to functions for > other > > architectures and disabled components. > > > > -Os -Og is the minimal optimization flags for MSVC that does include DCE. > > The patch looks good to me if -Og alone doesn't help, > thank you for the improved commit message. Im not sure this is a good idea. It doesnt seem right to me that if the user selects to disable optimizations that configure still performs some anyway. As far as I see it if the user selects to have no optimizations then there should be no optimizations. This seems like a slightly incorrect hack to get around ffmpeg using DCE as opposed to tackling the broader issue of DCE breaking builds, and not just with msvc and not just with no optimizations enabled. As a slightly more appropriate (although still hacky fix) you can instead add /FORCE:UNRESOLVED to the linker command which will still result in a large number off errors being generated however they will be ignored and an output binary will still be generated. As the errors all relate to functions that never get called the output binary is still perfectly functional and i think importantly doesnt contain optimizations just as the user requested. Also this fixes debug builds aswell. I still think the best solution would be to apply a broader ranging fix to the use of DCE but until a consensus is made on that then the above may be of some help.
On Fri, Dec 16, 2016 at 1:34 AM, Matt Oliver <protogonoi@gmail.com> wrote: > On 16 December 2016 at 11:20, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote: > >> 2016-12-14 16:47 GMT+01:00 Steve Lhomme <robux4@gmail.com>: >> > From: Steve Lhomme <robux4@gmail.com> >> > >> > Without any optimization flags, MSVC does no dead code elimination (DCE) >> at >> > all, even for the most trivial cases. DCE is a prerequisite for building >> ffmpeg >> > correctly, otherwise there are undefined references to functions for >> other >> > architectures and disabled components. >> > >> > -Os -Og is the minimal optimization flags for MSVC that does include DCE. >> >> The patch looks good to me if -Og alone doesn't help, >> thank you for the improved commit message. > > > Im not sure this is a good idea. It doesnt seem right to me that if the > user selects to disable optimizations that configure still performs some > anyway. As far as I see it if the user selects to have no optimizations > then there should be no optimizations. This seems like a slightly incorrect > hack to get around ffmpeg using DCE as opposed to tackling the broader > issue of DCE breaking builds, and not just with msvc and not just with no > optimizations enabled. > > As a slightly more appropriate (although still hacky fix) you can instead > add /FORCE:UNRESOLVED to the linker command which will still result in a > large number off errors being generated however they will be ignored and an > output binary will still be generated. As the errors all relate to > functions that never get called the output binary is still perfectly > functional and i think importantly doesnt contain optimizations just as the > user requested. Also this fixes debug builds aswell. It seems it's linking loosely, meaning it may not see if some actualmissing call exists or not. I just tried it and it segfaults if calling a function that doesn't exist. > I still think the best solution would be to apply a broader ranging fix to > the use of DCE but until a consensus is made on that then the above may be > of some help. I agree. > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff --git a/configure b/configure index 9dfd006..1a8a05c 100755 --- a/configure +++ b/configure @@ -4087,6 +4087,7 @@ probe_cc(){ _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs' _cflags_speed="-O2" _cflags_size="-O1" + _cflags_noopt="-Os -Og" if $_cc -nologo- 2>&1 | grep -q Linker; then _ld_o='-out:$@' else
From: Steve Lhomme <robux4@gmail.com> Without any optimization flags, MSVC does no dead code elimination (DCE) at all, even for the most trivial cases. DCE is a prerequisite for building ffmpeg correctly, otherwise there are undefined references to functions for other architectures and disabled components. -Os -Og is the minimal optimization flags for MSVC that does include DCE. It warns that -Og will be removed but it doesn't work without. -O1 includes these flags and some other ones not necessary to link properly. --- configure | 1 + 1 file changed, 1 insertion(+)