/* write.c - emit .o file
- Copyright (C) 1986-2019 Free Software Foundation, Inc.
+ Copyright (C) 1986-2020 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
#ifdef HANDLE_ALIGN
HANDLE_ALIGN (fragP);
#endif
-skip_align:
+ skip_align:
know (fragP->fr_next != NULL);
fragP->fr_offset = (fragP->fr_next->fr_address
- fragP->fr_address
/* Create a GNU Build Attribute section. */
sec = subseg_new (GNU_BUILD_ATTRS_SECTION_NAME, FALSE);
elf_section_type (sec) = SHT_NOTE;
- bfd_set_section_flags (sec, SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA);
+ bfd_set_section_flags (sec, (SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA
+ | SEC_OCTETS));
bfd_set_section_alignment (sec, 2);
/* Work out the size of the notes that we will create,
#endif
/* Stop if there is an error. */
- if (had_errors ())
+ if (!flag_always_generate_output && had_errors ())
return;
/* Now that all the sizes are known, and contents correct, we can
}
#ifdef TC_GENERIC_RELAX_TABLE
+#ifndef md_generic_table_relax_frag
+#define md_generic_table_relax_frag relax_frag
+#endif
+
/* Relax a fragment by scanning TC_GENERIC_RELAX_TABLE. */
long
const relax_typeS *table;
target = fragP->fr_offset;
- address = fragP->fr_address;
+ address = fragP->fr_address + fragP->fr_fix;
table = TC_GENERIC_RELAX_TABLE;
this_state = fragP->fr_subtype;
start_type = this_type = table + this_state;
negative. Don't allow this in case the negative reach is
large enough to require a larger branch instruction. */
else if (target < address)
- target = fragP->fr_next->fr_address + stretch;
+ return 0;
}
}
- aim = target - address - fragP->fr_fix;
+ aim = target - address;
#ifdef TC_PCREL_ADJUST
- /* Currently only the ns32k family needs this. */
+ /* Currently only the ns32k and arc needs this. */
aim += TC_PCREL_ADJUST (fragP);
#endif
#ifdef TC_GENERIC_RELAX_TABLE
/* The default way to relax a frag is to look through
TC_GENERIC_RELAX_TABLE. */
- growth = relax_frag (segment, fragP, stretch);
+ growth = md_generic_table_relax_frag (segment, fragP,
+ stretch);
#endif /* TC_GENERIC_RELAX_TABLE */
#endif
break;