cl_rangelistptr);
if (cls != max_dw_class && ref_classes.test (cls))
- if (form->width (cu->head) == fw_8
- && cu->head->offset_size == 4)
- wr_error (where)
- << "reference attribute with form \""
- << pri::form (form_name) << "\" in 32-bit CU."
- << std::endl;
+ {
+ form_bitness_t bitness = form->bitness ();
+ if ((bitness == fb_32 && cu->head->offset_size == 8)
+ || (bitness == fb_64 && cu->head->offset_size == 4))
+ wr_error (where)
+ << "reference attribute with form \""
+ << pri::form (form_name) << "\" in "
+ << (8 * cu->head->offset_size) << "-bit CU."
+ << std::endl;
+ }
/* Setup pointer checking. */
switch (cls)
/* Pedantic checking of DWARF files
- Copyright (C) 2010 Red Hat, Inc.
+ Copyright (C) 2010, 2011 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
add (ref_form (DW_FORM_ref1, fw_1));
add (ref_form (DW_FORM_ref2, fw_2));
add (ref_form (DW_FORM_ref4, fw_4));
- add (ref_form (DW_FORM_ref8, fw_8));
+ add (ref_form (DW_FORM_ref8, fw_8, fb_64));
add (ref_form (DW_FORM_ref_udata, fw_uleb));
add (string_form (DW_FORM_string));
/* Pedantic checking of DWARF files
- Copyright (C) 2010 Red Hat, Inc.
+ Copyright (C) 2010, 2011 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
struct preset_form
: public form
{
- preset_form (int a_name, form_width_t a_width)
- : form (a_name, dw_class_set (Classes...), a_width, StorClass)
+ preset_form (int a_name, form_width_t a_width,
+ form_bitness_t a_bitness = fb_any)
+ : form (a_name, dw_class_set (Classes...), a_width, StorClass, a_bitness)
{}
};
}
form::form (int a_name, dw_class_set a_classes,
- form_width_t a_width, storage_class_t a_storclass)
+ form_width_t a_width, storage_class_t a_storclass,
+ form_bitness_t a_bitness)
: _m_name (a_name)
, _m_classes (a_classes)
, _m_width (a_width)
, _m_storclass (a_storclass)
+ , _m_bitness (a_bitness)
{}
form::form (int a_name, dw_class_set a_classes,
- form_width_special_t a_width, storage_class_t a_storclass)
+ form_width_special_t a_width, storage_class_t a_storclass,
+ form_bitness_t a_bitness)
: _m_name (a_name)
, _m_classes (a_classes)
, _m_width (a_width)
, _m_storclass (a_storclass)
+ , _m_bitness (a_bitness)
{}
dw_class
sc_string,
};
+enum form_bitness_t
+ {
+ fb_any, ///< Form is allowed in all CUs
+ fb_32, ///< Form is allowed only in 32-bit CUs
+ fb_64, ///< Form is allowed only in 64-bit CUs
+ };
+
class form
{
int const _m_name;
dw_class_set const _m_classes;
int const _m_width;
storage_class_t const _m_storclass;
+ form_bitness_t _m_bitness;
public:
- form (int a_name, dw_class_set a_classes,
- form_width_t a_width, storage_class_t a_storclass);
+ form (int name, dw_class_set classes,
+ form_width_t width, storage_class_t storclass,
+ form_bitness_t bitness = fb_any);
- form (int a_name, dw_class_set a_classes,
- form_width_special_t a_width, storage_class_t a_storclass);
+ form (int name, dw_class_set classes,
+ form_width_special_t width, storage_class_t storclass,
+ form_bitness_t bitness = fb_any);
int
name () const
{
return _m_storclass;
}
+
+ form_bitness_t
+ bitness () const
+ {
+ return _m_bitness;
+ }
};
std::ostream &operator << (std::ostream &os, form const &obj);