+static void emit_section_sparc(be_gas_section_t section, const ir_entity *entity)
+{
+ be_gas_section_t base = section & GAS_SECTION_TYPE_MASK;
+ be_gas_section_t flags = section & ~GAS_SECTION_TYPE_MASK;
+ static const char *const basename[] = {
+ "text", "data", "rodata", "bss", "ctors", "dtors"
+ };
+
+ if (current_section == section && !(section & GAS_SECTION_FLAG_COMDAT))
+ return;
+ current_section = section;
+
+ be_emit_cstring("\t.section\t\".");
+
+ /* Part1: section-name */
+ if (flags & GAS_SECTION_FLAG_TLS)
+ be_emit_char('t');
+ assert(base < sizeof(basename)/sizeof(basename[0]));
+ be_emit_string(basename[base]);
+
+ if (flags & GAS_SECTION_FLAG_COMDAT) {
+ be_emit_char('.');
+ be_gas_emit_entity(entity);
+ }
+ be_emit_char('"');
+
+ /* for the simple sections we're done here */
+ if (flags == 0)
+ goto end;
+
+ be_emit_cstring(",#alloc");
+
+ switch (base) {
+ case GAS_SECTION_TEXT: be_emit_cstring(",#execinstr"); break;
+ case GAS_SECTION_DATA:
+ case GAS_SECTION_BSS: be_emit_cstring(",#write"); break;
+ default:
+ /* nothing */
+ break;
+ }
+ if (flags & GAS_SECTION_FLAG_TLS) {
+ be_emit_cstring(",#tls");
+ }
+
+end:
+ be_emit_char('\n');
+ be_emit_write_line();
+}
+