Skip to content

Conversation

@pabigot
Copy link
Contributor

@pabigot pabigot commented Sep 13, 2019

Some DWARF symbols for members of template classes members such as numeric_limits reference are static constexpr values that do not have a data member location. Avoid attempting to dereference the value for that attribute when it isn't present.

This fix is required to get some C++ applications to link when usermode is enabled.

Below is the information for a DIE aggregate type (name, size, child) for an example:

integral_constant<bool, false> 1 DIE DW_TAG_member, size=13, has_chidren=False
    |DW_AT_name        :  AttributeValue(name='DW_AT_name', form='DW_FORM_strp', value=b'value', raw_value=23231, offset=82)
    |DW_AT_decl_file   :  AttributeValue(name='DW_AT_decl_file', form='DW_FORM_data1', value=15, raw_value=15, offset=86)
    |DW_AT_decl_line   :  AttributeValue(name='DW_AT_decl_line', form='DW_FORM_data1', value=59, raw_value=59, offset=87)
    |DW_AT_decl_column :  AttributeValue(name='DW_AT_decl_column', form='DW_FORM_data1', value=45, raw_value=45, offset=88)
    |DW_AT_type        :  AttributeValue(name='DW_AT_type', form='DW_FORM_ref4', value=35867, raw_value=35867, offset=89)
    |DW_AT_external    :  AttributeValue(name='DW_AT_external', form='DW_FORM_flag_present', value=b'', raw_value=b'', offset=93)
    |DW_AT_declaration :  AttributeValue(name='DW_AT_declaration', form='DW_FORM_flag_present', value=b'', raw_value=b'', offset=93)
    |DW_AT_const_expr  :  AttributeValue(name='DW_AT_const_expr', form='DW_FORM_flag_present', value=b'', raw_value=b'', offset=93)
    |DW_AT_inline      :  AttributeValue(name='DW_AT_inline', form='DW_FORM_data1', value=1, raw_value=1, offset=93)

Some DWARF symbols for members of template classes members such as
numeric_limits<unsigned int> reference are static constexpr values
that do not have a data member location.  Avoid attempting to
dereference the value for that attribute when it isn't present.

Signed-off-by: Peter A. Bigot <[email protected]>
@nashif nashif merged commit 5611bee into zephyrproject-rtos:master Sep 17, 2019
@pabigot pabigot deleted the pr/20190913a branch September 17, 2019 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants