Bug 1230910 Use gcc intrinsic for return address on MinGW draft
authorTom Ritter <tom@mozilla.com>
Thu, 09 Mar 2017 18:04:19 +0000
changeset 496080 2b6205ac822c79eaaba56a41f8d938aebcaae393
parent 496079 5732bd44616c876672dc98e2b367d0bf24dc1565
child 548538 745fb1f1a6140634593abe2068389045a8cff8ca
push id48518
push userbmo:tom@mozilla.com
push dateThu, 09 Mar 2017 19:30:51 +0000
bugs1230910
milestone52.0.1
Bug 1230910 Use gcc intrinsic for return address on MinGW MozReview-Commit-ID: BqGpQycTtf5
dom/media/gmp/rlz/GMPDeviceBinding.cpp
--- a/dom/media/gmp/rlz/GMPDeviceBinding.cpp
+++ b/dom/media/gmp/rlz/GMPDeviceBinding.cpp
@@ -57,17 +57,21 @@ namespace gmp {
 
 #if defined(XP_WIN) && defined(HASH_NODE_ID_WITH_DEVICE_ID)
 MOZ_NEVER_INLINE
 static bool
 GetStackAfterCurrentFrame(uint8_t** aOutTop, uint8_t** aOutBottom)
 {
   // "Top" of the free space on the stack is directly after the memory
   // holding our return address.
+  #ifndef __MINGW32__
   uint8_t* top = (uint8_t*)_AddressOfReturnAddress();
+  #else
+  uint8_t* top = (uint8_t*)__builtin_return_address(0);
+  #endif
 
   // Look down the stack until we find the guard page...
   MEMORY_BASIC_INFORMATION memInfo = {0};
   uint8_t* bottom = top;
   while (1) {
     if (!VirtualQuery(bottom, &memInfo, sizeof(memInfo))) {
       return false;
     }