X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=libgcc%2Funwind-pe.h;h=a6b4bffa944137b3afc9126dd4bfca5dec80fd6e;hb=4a9aa9dec7fc413654807890061a4d7df8a1c5e7;hp=27abebf67e14b042eab4f5edcb280212f0fdbfbd;hpb=818ab71a415cd234be092111a0aa5e812ec56434;p=gcc.git diff --git a/libgcc/unwind-pe.h b/libgcc/unwind-pe.h index 27abebf67e1..a6b4bffa944 100644 --- a/libgcc/unwind-pe.h +++ b/libgcc/unwind-pe.h @@ -1,5 +1,5 @@ /* Exception handling and frame unwind runtime interface routines. - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2020 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