From: Roland McGrath Date: Wed, 16 Jun 2010 10:11:57 +0000 (-0700) Subject: Canonicalize CIE fde_encoding at interning. X-Git-Tag: elfutils-0.148~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f4b5089e1e3ca3c696cb420a6e215006691cf95;p=thirdparty%2Felfutils.git Canonicalize CIE fde_encoding at interning. --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index e0e4c55d4..f974e96d4 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,5 +1,8 @@ 2010-06-16 Roland McGrath + * cie.c (intern_new_cie): Canonicalize DW_EH_PE_absptr FDE encoding to + either DW_EH_PE_udata8 or DW_EH_PE_udata4. + * encoded-value.h (read_encoded_value): Handle DW_EH_PE_indirect. Don't assume DW_EH_PE_aligned refers to native address size. diff --git a/libdw/cie.c b/libdw/cie.c index 08752a6da..7c93f5510 100644 --- a/libdw/cie.c +++ b/libdw/cie.c @@ -1,5 +1,5 @@ /* CIE reading. - Copyright (C) 2009 Red Hat, Inc. + Copyright (C) 2009-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -53,6 +53,7 @@ #include "cfi.h" #include "encoded-value.h" +#include #include #include @@ -135,6 +136,29 @@ intern_new_cie (Dwarf_CFI *cache, Dwarf_Off offset, const Dwarf_CIE *info) break; } + if ((cie->fde_encoding & 0x0f) == DW_EH_PE_absptr) + { + /* Canonicalize encoding to a specific size. */ + assert (DW_EH_PE_absptr == 0); + + /* XXX should get from dwarf_next_cfi with v4 header. */ + uint_fast8_t address_size + = cache->e_ident[EI_CLASS] == ELFCLASS32 ? 4 : 8; + switch (address_size) + { + case 8: + cie->fde_encoding |= DW_EH_PE_udata8; + break; + case 4: + cie->fde_encoding |= DW_EH_PE_udata4; + break; + default: + free (cie); + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return NULL; + } + } + /* Save the initial instructions to be played out into initial state. */ cie->initial_instructions = info->initial_instructions; cie->initial_instructions_end = info->initial_instructions_end;