Commit d44e2e93 authored by Matthias Braun's avatar Matthias Braun
Browse files

add support for jcr section

parent b8b01a71
...@@ -57,8 +57,10 @@ typedef enum ir_segment_t { ...@@ -57,8 +57,10 @@ typedef enum ir_segment_t {
IR_SEGMENT_CONSTRUCTORS, IR_SEGMENT_CONSTRUCTORS,
/** like constructors, but functions are executed on module exit */ /** like constructors, but functions are executed on module exit */
IR_SEGMENT_DESTRUCTORS, IR_SEGMENT_DESTRUCTORS,
/** java class registry */
IR_SEGMENT_JCR,
IR_SEGMENT_LAST = IR_SEGMENT_DESTRUCTORS IR_SEGMENT_LAST = IR_SEGMENT_JCR
} ir_segment_t; } ir_segment_t;
ENUM_COUNTABLE(ir_segment_t) ENUM_COUNTABLE(ir_segment_t)
......
...@@ -110,6 +110,7 @@ static void emit_section_sparc(be_gas_section_t section, ...@@ -110,6 +110,7 @@ static void emit_section_sparc(be_gas_section_t section,
"bss", "bss",
"ctors", "ctors",
"dtors", "dtors",
"jcr",
NULL, /* cstring */ NULL, /* cstring */
NULL, /* pic trampolines */ NULL, /* pic trampolines */
NULL, /* pic symbols */ NULL, /* pic symbols */
...@@ -177,6 +178,7 @@ static void emit_section(be_gas_section_t section, const ir_entity *entity) ...@@ -177,6 +178,7 @@ static void emit_section(be_gas_section_t section, const ir_entity *entity)
{ "bss", "nobits", "aw" }, { "bss", "nobits", "aw" },
{ "ctors", "progbits", "aw" }, { "ctors", "progbits", "aw" },
{ "dtors", "progbits", "aw" }, { "dtors", "progbits", "aw" },
{ "jcr", "progbits", "aw" },
{ NULL, NULL, NULL }, /* cstring */ { NULL, NULL, NULL }, /* cstring */
{ NULL, NULL, NULL }, /* pic trampolines */ { NULL, NULL, NULL }, /* pic trampolines */
{ NULL, NULL, NULL }, /* pic symbols */ { NULL, NULL, NULL }, /* pic symbols */
...@@ -429,6 +431,8 @@ static be_gas_section_t determine_section(be_gas_decl_env_t *env, ...@@ -429,6 +431,8 @@ static be_gas_section_t determine_section(be_gas_decl_env_t *env,
return GAS_SECTION_CONSTRUCTORS; return GAS_SECTION_CONSTRUCTORS;
} else if (owner == get_segment_type(IR_SEGMENT_DESTRUCTORS)) { } else if (owner == get_segment_type(IR_SEGMENT_DESTRUCTORS)) {
return GAS_SECTION_DESTRUCTORS; return GAS_SECTION_DESTRUCTORS;
} else if (owner == get_segment_type(IR_SEGMENT_JCR)) {
return GAS_SECTION_JCR;
} else if (owner == get_segment_type(IR_SEGMENT_THREAD_LOCAL)) { } else if (owner == get_segment_type(IR_SEGMENT_THREAD_LOCAL)) {
be_gas_section_t section = determine_basic_section(entity); be_gas_section_t section = determine_basic_section(entity);
if (is_comdat(entity)) if (is_comdat(entity))
...@@ -1471,6 +1475,7 @@ static void emit_global_decls(const be_main_env_t *main_env) ...@@ -1471,6 +1475,7 @@ static void emit_global_decls(const be_main_env_t *main_env)
be_gas_emit_globals(get_tls_type(), &env); be_gas_emit_globals(get_tls_type(), &env);
be_gas_emit_globals(get_segment_type(IR_SEGMENT_CONSTRUCTORS), &env); be_gas_emit_globals(get_segment_type(IR_SEGMENT_CONSTRUCTORS), &env);
be_gas_emit_globals(get_segment_type(IR_SEGMENT_DESTRUCTORS), &env); be_gas_emit_globals(get_segment_type(IR_SEGMENT_DESTRUCTORS), &env);
be_gas_emit_globals(get_segment_type(IR_SEGMENT_JCR), &env);
be_gas_emit_globals(main_env->pic_symbols_type, &env); be_gas_emit_globals(main_env->pic_symbols_type, &env);
be_gas_emit_globals(main_env->pic_trampolines_type, &env); be_gas_emit_globals(main_env->pic_trampolines_type, &env);
......
...@@ -24,6 +24,7 @@ typedef enum { ...@@ -24,6 +24,7 @@ typedef enum {
GAS_SECTION_BSS, /**< bss section - zero initialized data */ GAS_SECTION_BSS, /**< bss section - zero initialized data */
GAS_SECTION_CONSTRUCTORS, /**< ctors section */ GAS_SECTION_CONSTRUCTORS, /**< ctors section */
GAS_SECTION_DESTRUCTORS, /**< dtors section */ GAS_SECTION_DESTRUCTORS, /**< dtors section */
GAS_SECTION_JCR, /**< java class registry */
GAS_SECTION_CSTRING, /**< section for constant strings */ GAS_SECTION_CSTRING, /**< section for constant strings */
GAS_SECTION_PIC_TRAMPOLINES, /**< trampolines for pic codes */ GAS_SECTION_PIC_TRAMPOLINES, /**< trampolines for pic codes */
GAS_SECTION_PIC_SYMBOLS, /**< contains resolved pic symbols */ GAS_SECTION_PIC_SYMBOLS, /**< contains resolved pic symbols */
......
...@@ -197,6 +197,7 @@ static void symtbl_init(void) ...@@ -197,6 +197,7 @@ static void symtbl_init(void)
INSERT(tt_segment, "thread_local", IR_SEGMENT_THREAD_LOCAL); INSERT(tt_segment, "thread_local", IR_SEGMENT_THREAD_LOCAL);
INSERT(tt_segment, "constructors", IR_SEGMENT_CONSTRUCTORS); INSERT(tt_segment, "constructors", IR_SEGMENT_CONSTRUCTORS);
INSERT(tt_segment, "destructors", IR_SEGMENT_DESTRUCTORS); INSERT(tt_segment, "destructors", IR_SEGMENT_DESTRUCTORS);
INSERT(tt_segment, "jcr", IR_SEGMENT_JCR);
INSERT(tt_linkage, "constant", IR_LINKAGE_CONSTANT); INSERT(tt_linkage, "constant", IR_LINKAGE_CONSTANT);
INSERT(tt_linkage, "weak", IR_LINKAGE_WEAK); INSERT(tt_linkage, "weak", IR_LINKAGE_WEAK);
...@@ -287,6 +288,7 @@ static const char *get_segment_name(ir_segment_t segment) ...@@ -287,6 +288,7 @@ static const char *get_segment_name(ir_segment_t segment)
case IR_SEGMENT_THREAD_LOCAL: return "thread_local"; case IR_SEGMENT_THREAD_LOCAL: return "thread_local";
case IR_SEGMENT_CONSTRUCTORS: return "constructors"; case IR_SEGMENT_CONSTRUCTORS: return "constructors";
case IR_SEGMENT_DESTRUCTORS: return "destructors"; case IR_SEGMENT_DESTRUCTORS: return "destructors";
case IR_SEGMENT_JCR: return "jcr";
} }
panic("INVALID_SEGMENT"); panic("INVALID_SEGMENT");
} }
......
...@@ -61,10 +61,11 @@ static void complete_ir_prog(ir_prog *irp, const char *module_name) ...@@ -61,10 +61,11 @@ static void complete_ir_prog(ir_prog *irp, const char *module_name)
#define IDENT(x) new_id_from_chars(x, sizeof(x) - 1) #define IDENT(x) new_id_from_chars(x, sizeof(x) - 1)
irp->name = new_id_from_str(module_name); irp->name = new_id_from_str(module_name);
irp->segment_types[IR_SEGMENT_GLOBAL] = new_type_segment(IDENT("GlobalType"), tf_global_type); irp->segment_types[IR_SEGMENT_GLOBAL] = new_type_segment(IDENT("GlobalType"), tf_global_type);
irp->segment_types[IR_SEGMENT_THREAD_LOCAL] = new_type_segment(IDENT("ThreadLocal"), tf_tls_type); irp->segment_types[IR_SEGMENT_THREAD_LOCAL] = new_type_segment(IDENT("ThreadLocal"), tf_tls_type);
irp->segment_types[IR_SEGMENT_CONSTRUCTORS] = new_type_segment(IDENT("Constructors"), tf_constructors); irp->segment_types[IR_SEGMENT_CONSTRUCTORS] = new_type_segment(IDENT("Constructors"), tf_info);
irp->segment_types[IR_SEGMENT_DESTRUCTORS] = new_type_segment(IDENT("Destructors"), tf_destructors); irp->segment_types[IR_SEGMENT_DESTRUCTORS] = new_type_segment(IDENT("Destructors"), tf_info);
irp->segment_types[IR_SEGMENT_JCR] = new_type_segment(IDENT("Java Class Registry"), tf_info);
irp->const_code_irg = new_const_code_irg(); irp->const_code_irg = new_const_code_irg();
irp->globals_entity_usage_state = ir_entity_usage_not_computed; irp->globals_entity_usage_state = ir_entity_usage_not_computed;
......
...@@ -114,8 +114,7 @@ typedef enum type_flags { ...@@ -114,8 +114,7 @@ typedef enum type_flags {
tf_segment = 1U << 3, /**< type represents a linker segment */ tf_segment = 1U << 3, /**< type represents a linker segment */
tf_global_type = 1U << 4, /**< Set only for the global type */ tf_global_type = 1U << 4, /**< Set only for the global type */
tf_tls_type = 1U << 5, /**< Set only for the tls type */ tf_tls_type = 1U << 5, /**< Set only for the tls type */
tf_constructors = 1U << 6, /**< Set only for the constructors segment type */ tf_info = 1U << 6, /**< infos (for example constructor, destructor pointers) */
tf_destructors = 1U << 7, /**< Set only for the destructors segment type */
tf_variable_size = 1U << 8, /**< compound or array type may have variable size last element */ tf_variable_size = 1U << 8, /**< compound or array type may have variable size last element */
} type_flags; } type_flags;
ENUM_BITSET(type_flags) ENUM_BITSET(type_flags)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment