Commit 9246866a authored by Matthias Braun's avatar Matthias Braun
Browse files

begnuas: let user specify elf variants

parent 45748a5e
......@@ -47,6 +47,7 @@
/** by default, we generate assembler code for the Linux gas */
object_file_format_t be_gas_object_file_format = OBJECT_FILE_FORMAT_ELF;
elf_variant_t be_gas_elf_variant = ELF_VARIANT_NORMAL;
bool be_gas_emit_types = true;
char be_gas_elf_type_char = '@';
......@@ -166,7 +167,7 @@ static void emit_section(be_gas_section_t section, const ir_entity *entity)
if (be_gas_object_file_format == OBJECT_FILE_FORMAT_MACH_O) {
emit_section_macho(section);
return;
} else if(be_gas_object_file_format == OBJECT_FILE_FORMAT_ELF_SPARC) {
} else if(be_gas_elf_variant == ELF_VARIANT_SPARC) {
emit_section_sparc(section, entity);
return;
}
......@@ -526,7 +527,6 @@ void be_gas_emit_function_prolog(const ir_entity *entity, unsigned po2alignment)
switch (be_gas_object_file_format) {
case OBJECT_FILE_FORMAT_ELF:
case OBJECT_FILE_FORMAT_ELF_SPARC:
be_emit_cstring("\t.type\t");
be_gas_emit_entity(entity);
be_emit_cstring(", ");
......@@ -1406,7 +1406,6 @@ static void emit_common(const ir_entity *entity)
be_emit_write_line();
return;
case OBJECT_FILE_FORMAT_ELF:
case OBJECT_FILE_FORMAT_ELF_SPARC:
be_emit_cstring("\t.comm ");
be_gas_emit_entity(entity);
be_emit_irprintf(",%u,%u\n", size, alignment);
......@@ -1439,7 +1438,6 @@ static void emit_local_common(const ir_entity *entity)
be_emit_write_line();
return;
case OBJECT_FILE_FORMAT_ELF:
case OBJECT_FILE_FORMAT_ELF_SPARC:
be_emit_cstring("\t.local ");
be_gas_emit_entity(entity);
be_emit_cstring("\n");
......
......@@ -53,17 +53,22 @@ typedef enum object_file_format_t {
OBJECT_FILE_FORMAT_ELF, /**< Executable and Linkable Format (unixes) */
OBJECT_FILE_FORMAT_COFF, /**< Common Object File Format (Windows) */
OBJECT_FILE_FORMAT_MACH_O, /**< Mach Object File Format (OS/X) */
OBJECT_FILE_FORMAT_ELF_SPARC, /**< Sparc variant of ELF */
OBJECT_FILE_FORMAT_LAST = OBJECT_FILE_FORMAT_ELF_SPARC
OBJECT_FILE_FORMAT_LAST = OBJECT_FILE_FORMAT_MACH_O
} object_file_format_t;
typedef enum elf_variant_t {
ELF_VARIANT_NORMAL,
ELF_VARIANT_SPARC
} elf_variant_t;
/** The variable where the GAS dialect is stored. */
extern object_file_format_t be_gas_object_file_format;
extern bool be_gas_emit_types;
extern elf_variant_t be_gas_elf_variant;
/**
* the .type directive needs to specify @function, #function or %function
* depending on the target architecture (yay)
* depending on the target architecture
*/
extern char be_gas_elf_type_char;
......
......@@ -357,7 +357,8 @@ static arch_env_t *sparc_init(FILE *outfile)
isa->constants = pmap_create();
be_gas_elf_type_char = '#';
be_gas_object_file_format = OBJECT_FILE_FORMAT_ELF_SPARC;
be_gas_object_file_format = OBJECT_FILE_FORMAT_ELF;
be_gas_elf_variant = ELF_VARIANT_SPARC;
be_emit_init(outfile);
......
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