> On Jul 8, 2015, at 1:43 PM, Laszlo Ersek <ler...@redhat.com> wrote:
>
>> https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Library/DebugLib.h
>>
>> <https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Library/DebugLib.h>
>>
>> #if !defined(MDEPKG_NDEBUG)
>> #define ASSERT(Expression) \
>> do { \
>> if (DebugAssertEnabled ()) { \
>> if (!(Expression)) { \
>> _ASSERT (Expression); \
>> } \
>> } \
>> } while (FALSE)
>> #else
>> #define ASSERT(Expression)
>> #endif
>>
>> If you are not using the optional MDEPKG_NDEBUG flag then DEBUG and
>> ASSERT macros just become policy for a release build based on PCD.
>
> Ah! That's very useful background info.
>
> Perhaps it's time for dropping MDEPKG_NDEBUG? We have:
>
> [BuildOptions]
> GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
> GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
> INTEL:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
> MSFT:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
>
> I wonder why MDEPKG_NDEBUG was then added for MSFT in the first place
> (assuming MSVC had always been able to remove dead code),
It might make MSVC catch the same errors as GCC? Not sure about that?
I wonder is some hackery could make MDEPKG_NDEBUG path behave the same way?
#else
#define ASSERT(Expression) do {} while (FALSE && (Expression))
#endif
Maybe we could find something that all the compilers dead strip, but behaves
more like the non #if path?
Thanks,
Andrew Fish
> but in any
> case, perhaps we should restrict MDEPKG_NDEBUG to RELEASE builds with
> older (4.4, 4.5, ... ?) gcc.
>
> ... I experimented a bit now. I removed MDEPKG_NDEBUG, and watched how
> the size of DXEFV changed when I flipped the DEBUG_VERBOSE bit on and
> off. Summary: no matter what I tried in place of MDEPKG_NDEBUG (-O0,
> -O1, -O1 -flto), given one specific CC_FLAGS (and DLINK_FLAGS) setting,
> inverting the DEBUG_VERBOSE bit in the PCD mask had no effect.
>
> I think it would make a difference if -flto *actually* worked, but from
> a quick google search, I think it either doesn't work with gcc-4.8 at
> all, *or* the edk2 build system would have to use FLTO-aware binutils
> and linker wrappers (or parameters). I have no clue how to set that up.
> So for now we'll have to stick with MDEPKG_NDEBUG I guess.
>
> Thanks!
> Laszlo
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel