summaryrefslogtreecommitdiff
path: root/libdw/cie.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2010-06-16 03:11:57 -0700
committerRoland McGrath <roland@redhat.com>2010-06-16 03:11:57 -0700
commit5f4b5089e1e3ca3c696cb420a6e215006691cf95 (patch)
tree443b746b71d8e49a544d6850080b1c19c13ff11f /libdw/cie.c
parent7934ded435882538f8c551a3c2a9ed42d6d3c45a (diff)
downloadelfutils-5f4b5089e1e3ca3c696cb420a6e215006691cf95.tar.gz
Canonicalize CIE fde_encoding at interning.
Diffstat (limited to 'libdw/cie.c')
-rw-r--r--libdw/cie.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/libdw/cie.c b/libdw/cie.c
index 08752a6d..7c93f551 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 <assert.h>
#include <search.h>
#include <stdlib.h>
@@ -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;