@@ -6127,130 +6127,10 @@ builtin_type (struct gdbarch *gdbarch)
return result;
}
-/* This set of objfile-based types is intended to be used by symbol
- readers as basic types. */
-
-static const registry<objfile>::key<struct objfile_type,
- gdb::noop_deleter<struct objfile_type>>
- objfile_type_data;
-
-const struct objfile_type *
+const struct builtin_type *
builtin_type (struct objfile *objfile)
{
- struct gdbarch *gdbarch;
- struct objfile_type *objfile_type = objfile_type_data.get (objfile);
-
- if (objfile_type)
- return objfile_type;
-
- objfile_type = OBSTACK_CALLOC (&objfile->objfile_obstack,
- 1, struct objfile_type);
-
- /* Use the objfile architecture to determine basic type properties. */
- gdbarch = objfile->arch ();
-
- type_allocator alloc (objfile);
-
- /* Basic types. */
- objfile_type->builtin_void
- = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
- objfile_type->builtin_char
- = init_integer_type (alloc, TARGET_CHAR_BIT,
- !gdbarch_char_signed (gdbarch), "char");
- objfile_type->builtin_char->set_has_no_signedness (true);
- objfile_type->builtin_signed_char
- = init_integer_type (alloc, TARGET_CHAR_BIT,
- 0, "signed char");
- objfile_type->builtin_unsigned_char
- = init_integer_type (alloc, TARGET_CHAR_BIT,
- 1, "unsigned char");
- objfile_type->builtin_short
- = init_integer_type (alloc, gdbarch_short_bit (gdbarch),
- 0, "short");
- objfile_type->builtin_unsigned_short
- = init_integer_type (alloc, gdbarch_short_bit (gdbarch),
- 1, "unsigned short");
- objfile_type->builtin_int
- = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
- 0, "int");
- objfile_type->builtin_unsigned_int
- = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
- 1, "unsigned int");
- objfile_type->builtin_long
- = init_integer_type (alloc, gdbarch_long_bit (gdbarch),
- 0, "long");
- objfile_type->builtin_unsigned_long
- = init_integer_type (alloc, gdbarch_long_bit (gdbarch),
- 1, "unsigned long");
- objfile_type->builtin_long_long
- = init_integer_type (alloc, gdbarch_long_long_bit (gdbarch),
- 0, "long long");
- objfile_type->builtin_unsigned_long_long
- = init_integer_type (alloc, gdbarch_long_long_bit (gdbarch),
- 1, "unsigned long long");
- objfile_type->builtin_float
- = init_float_type (alloc, gdbarch_float_bit (gdbarch),
- "float", gdbarch_float_format (gdbarch));
- objfile_type->builtin_double
- = init_float_type (alloc, gdbarch_double_bit (gdbarch),
- "double", gdbarch_double_format (gdbarch));
- objfile_type->builtin_long_double
- = init_float_type (alloc, gdbarch_long_double_bit (gdbarch),
- "long double", gdbarch_long_double_format (gdbarch));
-
- /* This type represents a type that was unrecognized in symbol read-in. */
- objfile_type->builtin_error
- = alloc.new_type (TYPE_CODE_ERROR, 0, "<unknown type>");
-
- /* The following set of types is used for symbols with no
- debug information. */
- objfile_type->nodebug_text_symbol
- = alloc.new_type (TYPE_CODE_FUNC, TARGET_CHAR_BIT,
- "<text variable, no debug info>");
-
- objfile_type->nodebug_text_gnu_ifunc_symbol
- = alloc.new_type (TYPE_CODE_FUNC, TARGET_CHAR_BIT,
- "<text gnu-indirect-function variable, no debug info>");
- objfile_type->nodebug_text_gnu_ifunc_symbol->set_is_gnu_ifunc (true);
-
- objfile_type->nodebug_got_plt_symbol
- = init_pointer_type (alloc, gdbarch_addr_bit (gdbarch),
- "<text from jump slot in .got.plt, no debug info>",
- objfile_type->nodebug_text_symbol);
- objfile_type->nodebug_data_symbol
- = alloc.new_type (TYPE_CODE_ERROR, 0, "<data variable, no debug info>");
- objfile_type->nodebug_unknown_symbol
- = alloc.new_type (TYPE_CODE_ERROR, 0,
- "<variable (not text or data), no debug info>");
- objfile_type->nodebug_tls_symbol
- = alloc.new_type (TYPE_CODE_ERROR, 0,
- "<thread local variable, no debug info>");
-
- /* NOTE: on some targets, addresses and pointers are not necessarily
- the same.
-
- The upshot is:
- - gdb's `struct type' always describes the target's
- representation.
- - gdb's `struct value' objects should always hold values in
- target form.
- - gdb's CORE_ADDR values are addresses in the unified virtual
- address space that the assembler and linker work with. Thus,
- since target_read_memory takes a CORE_ADDR as an argument, it
- can access any memory on the target, even if the processor has
- separate code and data address spaces.
-
- In this context, objfile_type->builtin_core_addr is a bit odd:
- it's a target type for a value the target will never see. It's
- only used to hold the values of (typeless) linker symbols, which
- are indeed in the unified virtual address space. */
-
- objfile_type->builtin_core_addr
- = init_integer_type (alloc, gdbarch_addr_bit (gdbarch), 1,
- "__CORE_ADDR");
-
- objfile_type_data.set (objfile, objfile_type);
- return objfile_type;
+ return builtin_type (objfile->arch ());
}
/* See gdbtypes.h. */
@@ -2119,47 +2119,9 @@ struct builtin_type
extern const struct builtin_type *builtin_type (struct gdbarch *gdbarch);
-/* * Per-objfile types used by symbol readers. */
-
-struct objfile_type
-{
- /* Basic types based on the objfile architecture. */
- struct type *builtin_void;
- struct type *builtin_char;
- struct type *builtin_short;
- struct type *builtin_int;
- struct type *builtin_long;
- struct type *builtin_long_long;
- struct type *builtin_signed_char;
- struct type *builtin_unsigned_char;
- struct type *builtin_unsigned_short;
- struct type *builtin_unsigned_int;
- struct type *builtin_unsigned_long;
- struct type *builtin_unsigned_long_long;
- struct type *builtin_half;
- struct type *builtin_float;
- struct type *builtin_double;
- struct type *builtin_long_double;
-
- /* * This type is used to represent symbol addresses. */
- struct type *builtin_core_addr;
-
- /* * This type represents a type that was unrecognized in symbol
- read-in. */
- struct type *builtin_error;
-
- /* * Types used for symbols with no debug information. */
- struct type *nodebug_text_symbol;
- struct type *nodebug_text_gnu_ifunc_symbol;
- struct type *nodebug_got_plt_symbol;
- struct type *nodebug_data_symbol;
- struct type *nodebug_unknown_symbol;
- struct type *nodebug_tls_symbol;
-};
-
/* * Return the type table for the specified objfile. */
-extern const struct objfile_type *builtin_type (struct objfile *objfile);
+extern const struct builtin_type *builtin_type (struct objfile *objfile);
/* Explicit floating-point formats. See "floatformat.h". */
extern const struct floatformat *floatformats_ieee_half[BFD_ENDIAN_UNKNOWN];