Changeset 89547 in webkit


Ignore:
Timestamp:
Jun 23, 2011 2:55:37 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-06-23 Timur Iskhodzhanov <timurrrr@google.com>

Reviewed by David Levin.

Make dynamic annotations weak symbols and prevent identical code folding by the linker
https://bugs.webkit.org/show_bug.cgi?id=62443

  • wtf/DynamicAnnotations.cpp: (WTFAnnotateBenignRaceSized): (WTFAnnotateHappensBefore): (WTFAnnotateHappensAfter):
  • wtf/DynamicAnnotations.h:
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r89516 r89547  
     12011-06-23  Timur Iskhodzhanov  <timurrrr@google.com>
     2
     3        Reviewed by David Levin.
     4
     5        Make dynamic annotations weak symbols and prevent identical code folding by the linker
     6        https://bugs.webkit.org/show_bug.cgi?id=62443
     7
     8        * wtf/DynamicAnnotations.cpp:
     9        (WTFAnnotateBenignRaceSized):
     10        (WTFAnnotateHappensBefore):
     11        (WTFAnnotateHappensAfter):
     12        * wtf/DynamicAnnotations.h:
     13
    1142011-06-22  Yael Aharon  <yael.aharon@nokia.com>
    215
  • trunk/Source/JavaScriptCore/wtf/DynamicAnnotations.cpp

    r82508 r89547  
    3030
    3131#if USE(DYNAMIC_ANNOTATIONS)
    32 void WTFAnnotateBenignRaceSized(const char*, int, const volatile void*, long, const char*) { }
    33 void WTFAnnotateHappensBefore(const char*, int, const volatile void*) { }
    34 void WTFAnnotateHappensAfter(const char*, int, const volatile void*) { }
     32
     33/* Identical code folding(-Wl,--icf=all) countermeasures.
     34 * This makes all Annotate* functions different, which prevents the linker from folding them.
     35 */
     36#ifdef __COUNTER__
     37#define DYNAMIC_ANNOTATIONS_IMPL \
     38    volatile short lineno = (__LINE__ << 8) + __COUNTER__; \
     39    (void)lineno;
     40#else
     41#define DYNAMIC_ANNOTATIONS_IMPL \
     42    volatile short lineno = (__LINE__ << 8); \
     43    (void)lineno;
     44#endif
     45
     46void WTFAnnotateBenignRaceSized(const char*, int, const volatile void*, long, const char*) { DYNAMIC_ANNOTATIONS_IMPL }
     47void WTFAnnotateHappensBefore(const char*, int, const volatile void*) { DYNAMIC_ANNOTATIONS_IMPL }
     48void WTFAnnotateHappensAfter(const char*, int, const volatile void*) { DYNAMIC_ANNOTATIONS_IMPL }
    3549#endif // USE(DYNAMIC_ANNOTATIONS)
     50
  • trunk/Source/JavaScriptCore/wtf/DynamicAnnotations.h

    r82508 r89547  
    7474#define WTF_ANNOTATE_HAPPENS_AFTER(address) WTFAnnotateHappensAfter(__FILE__, __LINE__, address)
    7575
     76/* The dynamic annotations must be weak symbols to be interceptable by a linker. */
     77#if defined(__GNUC__)
     78#define WTF_DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK __attribute__((weak))
     79#else
     80#define WTF_DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK
     81#endif
     82
    7683#ifdef __cplusplus
    7784extern "C" {
    7885#endif
    7986/* Don't use these directly, use the above macros instead. */
    80 void WTFAnnotateBenignRaceSized(const char* file, int line, const volatile void* memory, long size, const char* description);
    81 void WTFAnnotateHappensBefore(const char* file, int line, const volatile void* address);
    82 void WTFAnnotateHappensAfter(const char* file, int line, const volatile void* address);
     87void WTFAnnotateBenignRaceSized(const char* file, int line, const volatile void* memory, long size, const char* description) WTF_DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
     88void WTFAnnotateHappensBefore(const char* file, int line, const volatile void* address) WTF_DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
     89void WTFAnnotateHappensAfter(const char* file, int line, const volatile void* address) WTF_DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
    8390#ifdef __cplusplus
    8491} // extern "C"
    8592#endif
     93
     94#undef WTF_DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK
    8695
    8796#else // USE(DYNAMIC_ANNOTATIONS)
Note: See TracChangeset for help on using the changeset viewer.