Skip to content

Commit

Permalink
Revert "Emit DWARF debug_abbrev offset for compile units as a label i…
Browse files Browse the repository at this point in the history
…nstead of 0 (#19794)" (#20013)

This reverts commit 87ef555.

It breaks on iOS: #8806 (comment)
  • Loading branch information
akoeplinger authored Jun 23, 2020
1 parent 109b4b6 commit 83105ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 55 deletions.
9 changes: 1 addition & 8 deletions mono/mini/dwarfwriter.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,6 @@ emit_int32 (MonoDwarfWriter *w, int value)
mono_img_writer_emit_int32 (w->w, value);
}

static void
emit_symbol (MonoDwarfWriter *w, const char *symbol)
{
mono_img_writer_emit_symbol (w->w, symbol);
}

static void
emit_symbol_diff (MonoDwarfWriter *w, const char *end, const char* start, int offset)
{
Expand Down Expand Up @@ -805,7 +799,6 @@ mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, const char *cu_name, GSLis
w->cie_program = base_unwind_program;

emit_section_change (w, ".debug_abbrev", 0);
emit_label (w, ".Ldebug_abbrev_start");
emit_dwarf_abbrev (w, ABBREV_COMPILE_UNIT, DW_TAG_compile_unit, TRUE,
compile_unit_attr, G_N_ELEMENTS (compile_unit_attr));
emit_dwarf_abbrev (w, ABBREV_SUBPROGRAM, DW_TAG_subprogram, TRUE,
Expand Down Expand Up @@ -849,7 +842,7 @@ mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, const char *cu_name, GSLis
emit_symbol_diff (w, ".Ldebug_info_end", ".Ldebug_info_begin", 0); /* length */
emit_label (w, ".Ldebug_info_begin");
emit_int16 (w, 0x2); /* DWARF version 2 */
emit_symbol (w, ".Ldebug_abbrev_start"); /* .debug_abbrev offset */
emit_int32 (w, 0); /* .debug_abbrev offset */
emit_byte (w, sizeof (target_mgreg_t)); /* address size */

/* Compilation unit */
Expand Down
50 changes: 5 additions & 45 deletions mono/mini/image-writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,11 @@ create_reloc (MonoImageWriter *acfg, const char *end, const char* start, int off
BinReloc *reloc;
reloc = (BinReloc *)mono_mempool_alloc0 (acfg->mempool, sizeof (BinReloc));
reloc->val1 = mono_mempool_strdup (acfg->mempool, end);
if (start)
{
if (strcmp (start, ".") == 0) {
reloc->val2_section = acfg->cur_section;
reloc->val2_offset = acfg->cur_section->cur_offset;
} else {
reloc->val2 = mono_mempool_strdup (acfg->mempool, start);
}
if (strcmp (start, ".") == 0) {
reloc->val2_section = acfg->cur_section;
reloc->val2_offset = acfg->cur_section->cur_offset;
} else {
reloc->val2 = mono_mempool_strdup (acfg->mempool, start);
}
reloc->offset = offset;
reloc->section = acfg->cur_section;
Expand All @@ -427,13 +424,6 @@ create_reloc (MonoImageWriter *acfg, const char *end, const char* start, int off
return reloc;
}

static void
bin_writer_emit_symbol (MonoImageWriter *acfg, const char *symbol)
{
create_reloc (acfg, symbol, NULL, 0);
acfg->cur_section->cur_offset += 4;
}

static void
bin_writer_emit_symbol_diff (MonoImageWriter *acfg, const char *end, const char* start, int offset)
{
Expand Down Expand Up @@ -1934,23 +1924,6 @@ asm_writer_emit_int32 (MonoImageWriter *acfg, int value)
fprintf (acfg->fp, "%d", value);
}

static void
asm_writer_emit_symbol (MonoImageWriter *acfg, const char *symbol)
{
if (acfg->mode != EMIT_LONG) {
acfg->mode = EMIT_LONG;
acfg->col_count = 0;
}

symbol = get_label (symbol);

if ((acfg->col_count++ % 8) == 0)
fprintf (acfg->fp, "\n\t%s ", AS_INT32_DIRECTIVE);
else
fprintf (acfg->fp, ",");
fprintf (acfg->fp, "%s", symbol);
}

static void
asm_writer_emit_symbol_diff (MonoImageWriter *acfg, const char *end, const char* start, int offset)
{
Expand Down Expand Up @@ -2240,19 +2213,6 @@ mono_img_writer_emit_int32 (MonoImageWriter *acfg, int value)
#endif
}

void
mono_img_writer_emit_symbol (MonoImageWriter *acfg, const char *symbol)
{
#ifdef USE_BIN_WRITER
if (acfg->use_bin_writer)
bin_writer_emit_symbol (acfg, symbol);
else
asm_writer_emit_symbol (acfg, symbol);
#else
asm_writer_emit_symbol (acfg, symbol);
#endif
}

void
mono_img_writer_emit_symbol_diff (MonoImageWriter *acfg, const char *end, const char* start, int offset)
{
Expand Down
2 changes: 0 additions & 2 deletions mono/mini/image-writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ void mono_img_writer_emit_int16 (MonoImageWriter *w, int value);

void mono_img_writer_emit_int32 (MonoImageWriter *w, int value);

void mono_img_writer_emit_symbol (MonoImageWriter *w, const char *symbol);

void mono_img_writer_emit_symbol_diff (MonoImageWriter *w, const char *end, const char* start, int offset);

void mono_img_writer_emit_zero_bytes (MonoImageWriter *w, int num);
Expand Down

0 comments on commit 83105ba

Please sign in to comment.