@@ -17196,30 +17196,19 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
1719617196 list was that this is unspecified. We choose to always zero-extend
1719717197 because that is the interpretation long in use by GCC. */
1719817198
17199- static gdb_byte *
17200- dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack ,
17201- struct dwarf2_cu *cu, LONGEST *value, int bits)
17199+ static void
17200+ dwarf2_const_value_data (const struct attribute *attr, LONGEST *value ,
17201+ int bits)
1720217202{
17203- struct objfile *objfile = cu->per_objfile->objfile;
17204- enum bfd_endian byte_order = bfd_big_endian (objfile->obfd.get ()) ?
17205- BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
1720617203 LONGEST l = attr->constant_value (0);
1720717204
1720817205 if (bits < sizeof (*value) * 8)
1720917206 {
1721017207 l &= ((LONGEST) 1 << bits) - 1;
1721117208 *value = l;
1721217209 }
17213- else if (bits == sizeof (*value) * 8)
17214- *value = l;
1721517210 else
17216- {
17217- gdb_byte *bytes = (gdb_byte *) obstack_alloc (obstack, bits / 8);
17218- store_unsigned_integer (bytes, bits / 8, byte_order, l);
17219- return bytes;
17220- }
17221-
17222- return NULL;
17211+ *value = l;
1722317212}
1722417213
1722517214/* Read a constant value from an attribute. Either set *VALUE, or if
@@ -17305,16 +17294,16 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
1730517294 converted to host endianness, so we just need to sign- or
1730617295 zero-extend it as appropriate. */
1730717296 case DW_FORM_data1:
17308- *bytes = dwarf2_const_value_data (attr, obstack, cu , value, 8);
17297+ dwarf2_const_value_data (attr, value, 8);
1730917298 break;
1731017299 case DW_FORM_data2:
17311- *bytes = dwarf2_const_value_data (attr, obstack, cu , value, 16);
17300+ dwarf2_const_value_data (attr, value, 16);
1731217301 break;
1731317302 case DW_FORM_data4:
17314- *bytes = dwarf2_const_value_data (attr, obstack, cu , value, 32);
17303+ dwarf2_const_value_data (attr, value, 32);
1731517304 break;
1731617305 case DW_FORM_data8:
17317- *bytes = dwarf2_const_value_data (attr, obstack, cu , value, 64);
17306+ dwarf2_const_value_data (attr, value, 64);
1731817307 break;
1731917308
1732017309 case DW_FORM_sdata:
@@ -18519,31 +18508,23 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off,
1851918508 zero-extend it as appropriate. */
1852018509 case DW_FORM_data1:
1852118510 type = die_type (die, cu);
18522- result = dwarf2_const_value_data (attr, obstack, cu, &value, 8);
18523- if (result == NULL)
18524- result = write_constant_as_bytes (obstack, byte_order,
18525- type, value, len);
18511+ dwarf2_const_value_data (attr, &value, 8);
18512+ result = write_constant_as_bytes (obstack, byte_order, type, value, len);
1852618513 break;
1852718514 case DW_FORM_data2:
1852818515 type = die_type (die, cu);
18529- result = dwarf2_const_value_data (attr, obstack, cu, &value, 16);
18530- if (result == NULL)
18531- result = write_constant_as_bytes (obstack, byte_order,
18532- type, value, len);
18516+ dwarf2_const_value_data (attr, &value, 16);
18517+ result = write_constant_as_bytes (obstack, byte_order, type, value, len);
1853318518 break;
1853418519 case DW_FORM_data4:
1853518520 type = die_type (die, cu);
18536- result = dwarf2_const_value_data (attr, obstack, cu, &value, 32);
18537- if (result == NULL)
18538- result = write_constant_as_bytes (obstack, byte_order,
18539- type, value, len);
18521+ dwarf2_const_value_data (attr, &value, 32);
18522+ result = write_constant_as_bytes (obstack, byte_order, type, value, len);
1854018523 break;
1854118524 case DW_FORM_data8:
1854218525 type = die_type (die, cu);
18543- result = dwarf2_const_value_data (attr, obstack, cu, &value, 64);
18544- if (result == NULL)
18545- result = write_constant_as_bytes (obstack, byte_order,
18546- type, value, len);
18526+ dwarf2_const_value_data (attr, &value, 64);
18527+ result = write_constant_as_bytes (obstack, byte_order, type, value, len);
1854718528 break;
1854818529
1854918530 case DW_FORM_sdata:
0 commit comments