VirtualBox

Changeset 41307 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
May 15, 2012 12:09:10 PM (13 years ago)
Author:
vboxsync
Message:

Runtime/common/log/log: make g_Logger weak which is the better solution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r41306 r41307  
    183183*******************************************************************************/
    184184#ifdef IN_RC
    185 /** Default logger instance. */
    186 extern "C" DECLIMPORT(RTLOGGERRC)   g_Logger;
     185/** Default logger instance. Make it weak because our RC module loader does not
     186 *  necessarily resolve this symbol and the compiler _must_ check if this is
     187 *  the case or not. */
     188extern "C" DECLWEAK(DECLIMPORT(RTLOGGERRC)) g_Logger;
    187189#else /* !IN_RC */
    188190/** Default logger instance. */
     
    21132115    {
    21142116#ifdef IN_RC
    2115         /*
    2116          * XXX gcc assumes that the address of a variable is always > 0 but this
    2117          * is not always true for g_Logger (special case in our RC loader)
    2118          */
    2119         PRTLOGGER pLogger1 = &g_Logger;
    2120         pLogger = ASMAtomicReadPtrT(&pLogger1, PRTLOGGER);
     2117        pLogger = &g_Logger;
    21212118#else
    21222119        pLogger = g_pLogger;
     
    21642161{
    21652162#ifdef IN_RC
    2166     /*
    2167      * XXX gcc assumes that the address of a variable is always > 0 but this
    2168      * is not always true for g_Logger (special case in our RC loader)
    2169      */
    2170     PRTLOGGER pLogger = &g_Logger;
    2171     return ASMAtomicReadPtrT(&pLogger, PRTLOGGER);
     2163    return &g_Logger;
    21722164
    21732165#else /* !IN_RC */
     
    22062198{
    22072199#ifdef IN_RC
    2208     /*
    2209      * XXX gcc assumes that the address of a variable is always > 0 but this
    2210      * is not always true for g_Logger (special case in our RC loader)
    2211      */
    2212     PRTLOGGER pLogger = &g_Logger;
    2213     return ASMAtomicReadPtrT(&pLogger, PRTLOGGER);
     2200    return &g_Logger;
    22142201#else
    22152202# ifdef IN_RING0
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette