]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgcc/unwind-pe.h
Reset PHI base0 flag if it's clear in any argument [PR101977, ...]
[thirdparty/gcc.git] / libgcc / unwind-pe.h
index e5dda41c8a06fcbc539ee74a71cf52160082d02a..79902c35e198e041bf5ebe111e22d42df62d5c4d 100644 (file)
@@ -1,5 +1,5 @@
 /* Exception handling and frame unwind runtime interface routines.
-   Copyright (C) 2001-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001-2021 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -177,6 +177,9 @@ read_sleb128 (const unsigned char *p, _sleb128_t *val)
    The function returns P incremented past the value.  BASE is as given
    by base_of_encoded_value for this encoding in the appropriate context.  */
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+
 static const unsigned char *
 read_encoded_value_with_base (unsigned char encoding, _Unwind_Ptr base,
                              const unsigned char *p, _Unwind_Ptr *val)
@@ -259,10 +262,27 @@ read_encoded_value_with_base (unsigned char encoding, _Unwind_Ptr base,
 
       if (result != 0)
        {
+#if __FDPIC__
+         /* FDPIC relative addresses imply taking the GOT address
+            into account.  */
+         if ((encoding & DW_EH_PE_pcrel) && (encoding & DW_EH_PE_indirect))
+           {
+             result += _Unwind_gnu_Find_got ((_Unwind_Ptr) u);
+             result = *(_Unwind_Internal_Ptr *) result;
+           }
+         else
+           {
+             result += ((encoding & 0x70) == DW_EH_PE_pcrel
+                        ? (_Unwind_Internal_Ptr) u : base);
+             if (encoding & DW_EH_PE_indirect)
+               result = *(_Unwind_Internal_Ptr *) result;
+           }
+#else
          result += ((encoding & 0x70) == DW_EH_PE_pcrel
                     ? (_Unwind_Internal_Ptr) u : base);
          if (encoding & DW_EH_PE_indirect)
            result = *(_Unwind_Internal_Ptr *) result;
+#endif
        }
     }
 
@@ -270,6 +290,8 @@ read_encoded_value_with_base (unsigned char encoding, _Unwind_Ptr base,
   return p;
 }
 
+#pragma GCC diagnostic pop
+
 #ifndef NO_BASE_OF_ENCODED_VALUE
 
 /* Like read_encoded_value_with_base, but get the base from the context