1 # This shell script emits a C file. -*- C -*-
2 # Copyright 2003, 2004, 2005, 2006
3 # Free Software Foundation, Inc.
5 # This file is part of GLD, the Gnu Linker.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
22 # This file is sourced from elf32.em, and defines extra xtensa-elf
25 cat >>e${EMULATION_NAME}.c <<EOF
27 #include <xtensa-config.h>
28 #include "../bfd/elf-bfd.h"
29 #include "../bfd/libbfd.h"
30 #include "elf/xtensa.h"
33 static void xtensa_wild_group_interleave (lang_statement_union_type *);
34 static void xtensa_colocate_output_literals (lang_statement_union_type *);
35 static void xtensa_strip_inconsistent_linkonce_sections
36 (lang_statement_list_type *);
39 /* Flag for the emulation-specific "--no-relax" option. */
40 static bfd_boolean disable_relaxation = FALSE;
42 /* This number is irrelevant until we turn on use_literal_pages */
43 static bfd_vma xtensa_page_power = 12; /* 4K pages. */
45 /* To force a page break between literals and text, change
46 xtensa_use_literal_pages to "TRUE". */
47 static bfd_boolean xtensa_use_literal_pages = FALSE;
49 #define EXTRA_VALIDATION 0
53 elf_xtensa_choose_target (int argc ATTRIBUTE_UNUSED,
54 char **argv ATTRIBUTE_UNUSED)
57 return "${BIG_OUTPUT_FORMAT}";
59 return "${LITTLE_OUTPUT_FORMAT}";
64 elf_xtensa_before_parse (void)
66 /* Just call the default hook.... Tensilica's version of this function
67 does some other work that isn't relevant here. */
68 gld${EMULATION_NAME}_before_parse ();
73 remove_section (bfd *abfd, asection *os)
76 for (spp = &abfd->sections; *spp; spp = &(*spp)->next)
80 os->owner->section_count--;
87 replace_insn_sec_with_prop_sec (bfd *abfd,
88 const char *insn_sec_name,
89 const char *prop_sec_name,
94 bfd_byte *prop_contents = NULL;
95 bfd_byte *insn_contents = NULL;
98 Elf_Internal_Shdr *symtab_hdr;
99 Elf_Internal_Rela *internal_relocs = NULL;
100 unsigned reloc_count;
103 insn_sec = bfd_get_section_by_name (abfd, insn_sec_name);
104 if (insn_sec == NULL)
106 entry_count = insn_sec->size / 8;
108 prop_sec = bfd_get_section_by_name (abfd, prop_sec_name);
109 if (prop_sec != NULL && insn_sec != NULL)
111 *error_message = _("file already has property tables");
115 if (insn_sec->size != 0)
117 insn_contents = (bfd_byte *) bfd_malloc (insn_sec->size);
118 if (insn_contents == NULL)
120 *error_message = _("out of memory");
123 if (! bfd_get_section_contents (abfd, insn_sec, insn_contents,
124 (file_ptr) 0, insn_sec->size))
126 *error_message = _("failed to read section contents");
131 /* Create a Property table section and relocation section for it. */
132 prop_sec_name = strdup (prop_sec_name);
133 prop_sec = bfd_make_section (abfd, prop_sec_name);
135 || ! bfd_set_section_flags (abfd, prop_sec,
136 bfd_get_section_flags (abfd, insn_sec))
137 || ! bfd_set_section_alignment (abfd, prop_sec, 2))
139 *error_message = _("could not create new section");
143 if (! bfd_set_section_flags (abfd, prop_sec,
144 bfd_get_section_flags (abfd, insn_sec))
145 || ! bfd_set_section_alignment (abfd, prop_sec, 2))
147 *error_message = _("could not set new section properties");
150 prop_sec->size = entry_count * 12;
151 prop_contents = (bfd_byte *) bfd_zalloc (abfd, prop_sec->size);
152 elf_section_data (prop_sec)->this_hdr.contents = prop_contents;
154 /* The entry size and size must be set to allow the linker to compute
155 the number of relocations since it does not use reloc_count. */
156 elf_section_data (prop_sec)->rel_hdr.sh_entsize =
157 sizeof (Elf32_External_Rela);
158 elf_section_data (prop_sec)->rel_hdr.sh_size =
159 elf_section_data (insn_sec)->rel_hdr.sh_size;
161 if (prop_contents == NULL && prop_sec->size != 0)
163 *error_message = _("could not allocate section contents");
167 /* Read the relocations. */
168 reloc_count = insn_sec->reloc_count;
169 if (reloc_count != 0)
171 /* If there is already an internal_reloc, then save it so that the
172 read_relocs function freshly allocates a copy. */
173 Elf_Internal_Rela *saved_relocs = elf_section_data (insn_sec)->relocs;
175 elf_section_data (insn_sec)->relocs = NULL;
177 _bfd_elf_link_read_relocs (abfd, insn_sec, NULL, NULL, FALSE);
178 elf_section_data (insn_sec)->relocs = saved_relocs;
180 if (internal_relocs == NULL)
182 *error_message = _("out of memory");
187 /* Create a relocation section for the property section. */
188 if (internal_relocs != NULL)
190 elf_section_data (prop_sec)->relocs = internal_relocs;
191 prop_sec->reloc_count = reloc_count;
194 /* Now copy each insn table entry to the prop table entry with
195 appropriate flags. */
196 for (entry = 0; entry < entry_count; ++entry)
199 unsigned flags = (XTENSA_PROP_INSN | XTENSA_PROP_INSN_NO_TRANSFORM
200 | XTENSA_PROP_INSN_NO_REORDER);
201 value = bfd_get_32 (abfd, insn_contents + entry * 8 + 0);
202 bfd_put_32 (abfd, value, prop_contents + entry * 12 + 0);
203 value = bfd_get_32 (abfd, insn_contents + entry * 8 + 4);
204 bfd_put_32 (abfd, value, prop_contents + entry * 12 + 4);
205 bfd_put_32 (abfd, flags, prop_contents + entry * 12 + 8);
208 /* Now copy all of the relocations. Change offsets for the
209 instruction table section to offsets in the property table
214 symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
216 for (i = 0; i < reloc_count; i++)
218 Elf_Internal_Rela *rela;
221 rela = &internal_relocs[i];
223 /* If this relocation is to the .xt.insn section,
224 change the section number and the offset. */
225 r_offset = rela->r_offset;
226 r_offset += 4 * (r_offset / 8);
227 rela->r_offset = r_offset;
231 remove_section (abfd, insn_sec);
234 free (insn_contents);
239 if (prop_sec && prop_sec->owner)
240 remove_section (abfd, prop_sec);
242 free (insn_contents);
244 free (internal_relocs);
250 #define PROP_SEC_BASE_NAME ".xt.prop"
251 #define INSN_SEC_BASE_NAME ".xt.insn"
252 #define LINKONCE_SEC_OLD_TEXT_BASE_NAME ".gnu.linkonce.x."
256 replace_instruction_table_sections (bfd *abfd, asection *sec)
259 const char *insn_sec_name = NULL;
260 char *prop_sec_name = NULL;
261 char *owned_prop_sec_name = NULL;
262 const char *sec_name;
264 sec_name = bfd_get_section_name (abfd, sec);
265 if (strcmp (sec_name, INSN_SEC_BASE_NAME) == 0)
267 insn_sec_name = INSN_SEC_BASE_NAME;
268 prop_sec_name = PROP_SEC_BASE_NAME;
270 else if (strncmp (sec_name, LINKONCE_SEC_OLD_TEXT_BASE_NAME,
271 strlen (LINKONCE_SEC_OLD_TEXT_BASE_NAME)) == 0)
273 insn_sec_name = sec_name;
274 owned_prop_sec_name = (char *) xmalloc (strlen (sec_name) + 20);
275 prop_sec_name = owned_prop_sec_name;
276 strcpy (prop_sec_name, ".gnu.linkonce.prop.t.");
277 strcat (prop_sec_name,
278 sec_name + strlen (LINKONCE_SEC_OLD_TEXT_BASE_NAME));
280 if (insn_sec_name != NULL)
282 if (! replace_insn_sec_with_prop_sec (abfd, insn_sec_name, prop_sec_name,
285 einfo (_("%P: warning: failed to convert %s table in %B (%s); subsequent disassembly may be incomplete\n"),
286 insn_sec_name, abfd, message);
289 if (owned_prop_sec_name)
290 free (owned_prop_sec_name);
294 /* This is called after all input sections have been opened to convert
295 instruction tables (.xt.insn, gnu.linkonce.x.*) tables into property
296 tables (.xt.prop) before any section placement. */
299 elf_xtensa_after_open (void)
303 /* First call the ELF version. */
304 gld${EMULATION_NAME}_after_open ();
306 /* Now search the input files looking for instruction table sections. */
307 for (abfd = link_info.input_bfds;
309 abfd = abfd->link_next)
311 asection *sec = abfd->sections;
314 /* Do not use bfd_map_over_sections here since we are removing
315 sections as we iterate. */
318 next_sec = sec->next;
319 replace_instruction_table_sections (abfd, sec);
326 /* This is called after the sections have been attached to output
327 sections, but before any sizes or addresses have been set. */
330 elf_xtensa_before_allocation (void)
333 bfd_boolean is_big_endian = XCHAL_HAVE_BE;
335 /* Check that the output endianness matches the Xtensa
336 configuration. The BFD library always includes both big and
337 little endian target vectors for Xtensa, but it only supports the
338 detailed instruction encode/decode operations (such as are
339 required to process relocations) for the selected Xtensa
342 if (is_big_endian && output_bfd->xvec->byteorder == BFD_ENDIAN_LITTLE)
344 einfo (_("%F%P: little endian output does not match "
345 "Xtensa configuration\n"));
347 if (!is_big_endian && output_bfd->xvec->byteorder == BFD_ENDIAN_BIG)
349 einfo (_("%F%P: big endian output does not match "
350 "Xtensa configuration\n"));
353 /* Check that the endianness for each input file matches the output.
354 The merge_private_bfd_data hook has already reported any mismatches
355 as errors, but those errors are not fatal. At this point, we
356 cannot go any further if there are any mismatches. */
358 for (in_bfd = link_info.input_bfds;
360 in_bfd = in_bfd->link_next)
362 if ((is_big_endian && in_bfd->xvec->byteorder == BFD_ENDIAN_LITTLE)
363 || (!is_big_endian && in_bfd->xvec->byteorder == BFD_ENDIAN_BIG))
364 einfo (_("%F%P: cross-endian linking not supported\n"));
367 /* Enable relaxation by default if the "--no-relax" option was not
368 specified. This is done here instead of in the before_parse hook
369 because there is a check in main() to prohibit use of --relax and
370 -r together and that combination should be allowed for Xtensa. */
372 if (!disable_relaxation)
373 command_line.relax = TRUE;
375 xtensa_strip_inconsistent_linkonce_sections (stat_ptr);
377 gld${EMULATION_NAME}_before_allocation ();
379 xtensa_wild_group_interleave (stat_ptr->head);
380 if (command_line.relax)
381 xtensa_colocate_output_literals (stat_ptr->head);
383 /* TBD: We need to force the page alignments to here and only do
384 them as needed for the entire output section. Finally, if this
385 is a relocatable link then we need to add alignment notes so
386 that the literals can be separated later. */
390 typedef struct wildcard_list section_name_list;
392 typedef struct reloc_deps_e_t reloc_deps_e;
393 typedef struct reloc_deps_section_t reloc_deps_section;
394 typedef struct reloc_deps_graph_t reloc_deps_graph;
397 struct reloc_deps_e_t
399 asection *src; /* Contains l32rs. */
400 asection *tgt; /* Contains literals. */
404 /* Place these in the userdata field. */
405 struct reloc_deps_section_t
409 bfd_boolean is_only_literal;
413 struct reloc_deps_graph_t
420 static void xtensa_layout_wild
421 (const reloc_deps_graph *, lang_wild_statement_type *);
423 typedef void (*deps_callback_t) (asection *, /* src_sec */
424 bfd_vma, /* src_offset */
425 asection *, /* target_sec */
426 bfd_vma, /* target_offset */
427 void *); /* closure */
429 extern bfd_boolean xtensa_callback_required_dependence
430 (bfd *, asection *, struct bfd_link_info *, deps_callback_t, void *);
431 static void xtensa_ldlang_clear_addresses (lang_statement_union_type *);
432 static bfd_boolean ld_local_file_relocations_fit
433 (lang_statement_union_type *, const reloc_deps_graph *);
434 static bfd_vma ld_assign_relative_paged_dot
435 (bfd_vma, lang_statement_union_type *, const reloc_deps_graph *,
437 static bfd_vma ld_xtensa_insert_page_offsets
438 (bfd_vma, lang_statement_union_type *, reloc_deps_graph *, bfd_boolean);
440 static size_t ld_count_children (lang_statement_union_type *);
443 extern lang_statement_list_type constructor_list;
445 /* Begin verbatim code from ldlang.c:
446 the following are copied from ldlang.c because they are defined
450 lang_for_each_statement_worker (void (*func) (lang_statement_union_type *),
451 lang_statement_union_type *s)
453 for (; s != (lang_statement_union_type *) NULL; s = s->header.next)
457 switch (s->header.type)
459 case lang_constructors_statement_enum:
460 lang_for_each_statement_worker (func, constructor_list.head);
462 case lang_output_section_statement_enum:
463 lang_for_each_statement_worker
465 s->output_section_statement.children.head);
467 case lang_wild_statement_enum:
468 lang_for_each_statement_worker
470 s->wild_statement.children.head);
472 case lang_group_statement_enum:
473 lang_for_each_statement_worker (func,
474 s->group_statement.children.head);
476 case lang_data_statement_enum:
477 case lang_reloc_statement_enum:
478 case lang_object_symbols_statement_enum:
479 case lang_output_statement_enum:
480 case lang_target_statement_enum:
481 case lang_input_section_enum:
482 case lang_input_statement_enum:
483 case lang_assignment_statement_enum:
484 case lang_padding_statement_enum:
485 case lang_address_statement_enum:
486 case lang_fill_statement_enum:
495 /* End of verbatim code from ldlang.c. */
498 static reloc_deps_section *
499 xtensa_get_section_deps (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
502 /* We have a separate function for this so that
503 we could in the future keep a completely independent
504 structure that maps a section to its dependence edges.
505 For now, we place these in the sec->userdata field. */
506 reloc_deps_section *sec_deps = sec->userdata;
511 xtensa_set_section_deps (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
513 reloc_deps_section *deps_section)
515 sec->userdata = deps_section;
519 /* This is used to keep a list of all of the sections participating in
520 the graph so we can clean them up quickly. */
523 xtensa_append_section_deps (reloc_deps_graph *deps, asection *sec)
525 if (deps->size <= deps->count)
527 asection **new_sections;
531 new_size = deps->size * 2;
535 new_sections = xmalloc (sizeof (asection *) * new_size);
536 memset (new_sections, 0, sizeof (asection *) * new_size);
537 for (i = 0; i < deps->count; i++)
539 new_sections[i] = deps->sections[i];
541 if (deps->sections != NULL)
542 free (deps->sections);
543 deps->sections = new_sections;
544 deps->size = new_size;
546 deps->sections[deps->count] = sec;
552 free_reloc_deps_graph (reloc_deps_graph *deps)
555 for (i = 0; i < deps->count; i++)
557 asection *sec = deps->sections[i];
558 reloc_deps_section *sec_deps;
559 sec_deps = xtensa_get_section_deps (deps, sec);
563 while (sec_deps->succs != NULL)
565 next = sec_deps->succs->next;
566 free (sec_deps->succs);
567 sec_deps->succs = next;
570 while (sec_deps->preds != NULL)
572 next = sec_deps->preds->next;
573 free (sec_deps->preds);
574 sec_deps->preds = next;
578 xtensa_set_section_deps (deps, sec, NULL);
581 free (deps->sections);
588 section_is_source (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
589 lang_statement_union_type *s)
592 const reloc_deps_section *sec_deps;
594 if (s->header.type != lang_input_section_enum)
596 sec = s->input_section.section;
598 sec_deps = xtensa_get_section_deps (deps, sec);
599 return sec_deps && sec_deps->succs != NULL;
604 section_is_target (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
605 lang_statement_union_type *s)
608 const reloc_deps_section *sec_deps;
610 if (s->header.type != lang_input_section_enum)
612 sec = s->input_section.section;
614 sec_deps = xtensa_get_section_deps (deps, sec);
615 return sec_deps && sec_deps->preds != NULL;
620 section_is_source_or_target (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
621 lang_statement_union_type *s)
623 return (section_is_source (deps, s)
624 || section_is_target (deps, s));
628 typedef struct xtensa_ld_iter_stack_t xtensa_ld_iter_stack;
629 typedef struct xtensa_ld_iter_t xtensa_ld_iter;
631 struct xtensa_ld_iter_t
633 lang_statement_union_type *parent; /* Parent of the list. */
634 lang_statement_list_type *l; /* List that holds it. */
635 lang_statement_union_type **loc; /* Place in the list. */
638 struct xtensa_ld_iter_stack_t
640 xtensa_ld_iter iterloc; /* List that hold it. */
642 xtensa_ld_iter_stack *next; /* Next in the stack. */
643 xtensa_ld_iter_stack *prev; /* Back pointer for stack. */
648 ld_xtensa_move_section_after (xtensa_ld_iter *to, xtensa_ld_iter *current)
650 lang_statement_union_type *to_next;
651 lang_statement_union_type *current_next;
652 lang_statement_union_type **e;
655 size_t old_to_count, new_to_count;
656 size_t old_current_count, new_current_count;
663 old_to_count = ld_count_children (to->parent);
664 old_current_count = ld_count_children (current->parent);
667 to_next = *(to->loc);
668 current_next = (*current->loc)->header.next;
670 *(to->loc) = *(current->loc);
672 *(current->loc) = current_next;
673 (*(to->loc))->header.next = to_next;
675 /* reset "to" list tail */
676 for (e = &to->l->head; *e != NULL; e = &(*e)->header.next)
680 /* reset "current" list tail */
681 for (e = ¤t->l->head; *e != NULL; e = &(*e)->header.next)
683 current->l->tail = e;
686 new_to_count = ld_count_children (to->parent);
687 new_current_count = ld_count_children (current->parent);
689 ASSERT ((old_to_count + old_current_count)
690 == (new_to_count + new_current_count));
695 /* Can only be called with lang_statements that have lists. Returns
696 FALSE if the list is empty. */
699 iter_stack_empty (xtensa_ld_iter_stack **stack_p)
701 return *stack_p == NULL;
706 iter_stack_push (xtensa_ld_iter_stack **stack_p,
707 lang_statement_union_type *parent)
709 xtensa_ld_iter_stack *stack;
710 lang_statement_list_type *l = NULL;
712 switch (parent->header.type)
714 case lang_output_section_statement_enum:
715 l = &parent->output_section_statement.children;
717 case lang_wild_statement_enum:
718 l = &parent->wild_statement.children;
720 case lang_group_statement_enum:
721 l = &parent->group_statement.children;
728 /* Empty. do not push. */
729 if (l->tail == &l->head)
732 stack = xmalloc (sizeof (xtensa_ld_iter_stack));
733 memset (stack, 0, sizeof (xtensa_ld_iter_stack));
734 stack->iterloc.parent = parent;
735 stack->iterloc.l = l;
736 stack->iterloc.loc = &l->head;
738 stack->next = *stack_p;
740 if (*stack_p != NULL)
741 (*stack_p)->prev = stack;
748 iter_stack_pop (xtensa_ld_iter_stack **stack_p)
750 xtensa_ld_iter_stack *stack;
756 ASSERT (stack != NULL);
760 if (stack->next != NULL)
761 stack->next->prev = NULL;
763 *stack_p = stack->next;
768 /* This MUST be called if, during iteration, the user changes the
769 underlying structure. It will check for a NULL current and advance
773 iter_stack_update (xtensa_ld_iter_stack **stack_p)
775 if (!iter_stack_empty (stack_p)
776 && (*(*stack_p)->iterloc.loc) == NULL)
778 iter_stack_pop (stack_p);
780 while (!iter_stack_empty (stack_p)
781 && ((*(*stack_p)->iterloc.loc)->header.next == NULL))
783 iter_stack_pop (stack_p);
785 if (!iter_stack_empty (stack_p))
786 (*stack_p)->iterloc.loc = &(*(*stack_p)->iterloc.loc)->header.next;
792 iter_stack_next (xtensa_ld_iter_stack **stack_p)
794 xtensa_ld_iter_stack *stack;
795 lang_statement_union_type *current;
798 current = *stack->iterloc.loc;
799 /* If we are on the first element. */
802 switch (current->header.type)
804 case lang_output_section_statement_enum:
805 case lang_wild_statement_enum:
806 case lang_group_statement_enum:
807 /* If the list if not empty, we are done. */
808 if (iter_stack_push (stack_p, *stack->iterloc.loc))
810 /* Otherwise increment the pointer as normal. */
817 while (!iter_stack_empty (stack_p)
818 && ((*(*stack_p)->iterloc.loc)->header.next == NULL))
820 iter_stack_pop (stack_p);
822 if (!iter_stack_empty (stack_p))
823 (*stack_p)->iterloc.loc = &(*(*stack_p)->iterloc.loc)->header.next;
827 static lang_statement_union_type *
828 iter_stack_current (xtensa_ld_iter_stack **stack_p)
830 return *((*stack_p)->iterloc.loc);
834 /* The iter stack is a preorder. */
837 iter_stack_create (xtensa_ld_iter_stack **stack_p,
838 lang_statement_union_type *parent)
840 iter_stack_push (stack_p, parent);
845 iter_stack_copy_current (xtensa_ld_iter_stack **stack_p, xtensa_ld_iter *front)
847 *front = (*stack_p)->iterloc;
852 xtensa_colocate_literals (reloc_deps_graph *deps,
853 lang_statement_union_type *statement)
855 /* Keep a stack of pointers to control iteration through the contours. */
856 xtensa_ld_iter_stack *stack = NULL;
857 xtensa_ld_iter_stack **stack_p = &stack;
859 xtensa_ld_iter front; /* Location where new insertion should occur. */
860 xtensa_ld_iter *front_p = NULL;
862 xtensa_ld_iter current; /* Location we are checking. */
863 xtensa_ld_iter *current_p = NULL;
864 bfd_boolean in_literals = FALSE;
866 if (deps->count == 0)
869 iter_stack_create (stack_p, statement);
871 while (!iter_stack_empty (stack_p))
873 bfd_boolean skip_increment = FALSE;
874 lang_statement_union_type *l = iter_stack_current (stack_p);
876 switch (l->header.type)
878 case lang_assignment_statement_enum:
879 /* Any assignment statement should block reordering across it. */
884 case lang_input_section_enum:
887 in_literals = (section_is_target (deps, l)
888 && !section_is_source (deps, l));
892 iter_stack_copy_current (stack_p, front_p);
897 bfd_boolean is_target;
898 current_p = ¤t;
899 iter_stack_copy_current (stack_p, current_p);
900 is_target = (section_is_target (deps, l)
901 && !section_is_source (deps, l));
905 iter_stack_copy_current (stack_p, front_p);
913 /* Try to insert in place. */
914 ld_xtensa_move_section_after (front_p, current_p);
915 ld_assign_relative_paged_dot (0x100000,
918 xtensa_use_literal_pages);
920 /* We use this code because it's already written. */
921 if (!ld_local_file_relocations_fit (statement, deps))
924 ld_xtensa_move_section_after (current_p, front_p);
925 /* Reset the literal placement. */
926 iter_stack_copy_current (stack_p, front_p);
930 /* Move front pointer up by one. */
931 front_p->loc = &(*front_p->loc)->header.next;
933 /* Do not increment the current pointer. */
934 skip_increment = TRUE;
945 iter_stack_next (stack_p);
947 /* Be careful to update the stack_p if it now is a null. */
948 iter_stack_update (stack_p);
951 lang_for_each_statement_worker (xtensa_ldlang_clear_addresses, statement);
956 xtensa_move_dependencies_to_front (reloc_deps_graph *deps,
957 lang_wild_statement_type *w)
959 /* Keep a front pointer and a current pointer. */
960 lang_statement_union_type **front;
961 lang_statement_union_type **current;
963 /* Walk to the end of the targets. */
964 for (front = &w->children.head;
965 (*front != NULL) && section_is_source_or_target (deps, *front);
966 front = &(*front)->header.next)
972 current = &(*front)->header.next;
973 while (*current != NULL)
975 if (section_is_source_or_target (deps, *current))
977 /* Insert in place. */
978 xtensa_ld_iter front_iter;
979 xtensa_ld_iter current_iter;
981 front_iter.parent = (lang_statement_union_type *) w;
982 front_iter.l = &w->children;
983 front_iter.loc = front;
985 current_iter.parent = (lang_statement_union_type *) w;
986 current_iter.l = &w->children;
987 current_iter.loc = current;
989 ld_xtensa_move_section_after (&front_iter, ¤t_iter);
990 front = &(*front)->header.next;
994 current = &(*current)->header.next;
1001 deps_has_sec_edge (const reloc_deps_graph *deps, asection *src, asection *tgt)
1003 const reloc_deps_section *sec_deps;
1004 const reloc_deps_e *sec_deps_e;
1006 sec_deps = xtensa_get_section_deps (deps, src);
1007 if (sec_deps == NULL)
1010 for (sec_deps_e = sec_deps->succs;
1012 sec_deps_e = sec_deps_e->next)
1014 ASSERT (sec_deps_e->src == src);
1015 if (sec_deps_e->tgt == tgt)
1023 deps_has_edge (const reloc_deps_graph *deps,
1024 lang_statement_union_type *src,
1025 lang_statement_union_type *tgt)
1027 if (!section_is_source (deps, src))
1029 if (!section_is_target (deps, tgt))
1032 if (src->header.type != lang_input_section_enum)
1034 if (tgt->header.type != lang_input_section_enum)
1037 return deps_has_sec_edge (deps, src->input_section.section,
1038 tgt->input_section.section);
1043 add_deps_edge (reloc_deps_graph *deps, asection *src_sec, asection *tgt_sec)
1045 reloc_deps_section *src_sec_deps;
1046 reloc_deps_section *tgt_sec_deps;
1048 reloc_deps_e *src_edge;
1049 reloc_deps_e *tgt_edge;
1051 if (deps_has_sec_edge (deps, src_sec, tgt_sec))
1054 src_sec_deps = xtensa_get_section_deps (deps, src_sec);
1055 if (src_sec_deps == NULL)
1057 /* Add a section. */
1058 src_sec_deps = xmalloc (sizeof (reloc_deps_section));
1059 memset (src_sec_deps, 0, sizeof (reloc_deps_section));
1060 src_sec_deps->is_only_literal = 0;
1061 src_sec_deps->preds = NULL;
1062 src_sec_deps->succs = NULL;
1063 xtensa_set_section_deps (deps, src_sec, src_sec_deps);
1064 xtensa_append_section_deps (deps, src_sec);
1067 tgt_sec_deps = xtensa_get_section_deps (deps, tgt_sec);
1068 if (tgt_sec_deps == NULL)
1070 /* Add a section. */
1071 tgt_sec_deps = xmalloc (sizeof (reloc_deps_section));
1072 memset (tgt_sec_deps, 0, sizeof (reloc_deps_section));
1073 tgt_sec_deps->is_only_literal = 0;
1074 tgt_sec_deps->preds = NULL;
1075 tgt_sec_deps->succs = NULL;
1076 xtensa_set_section_deps (deps, tgt_sec, tgt_sec_deps);
1077 xtensa_append_section_deps (deps, tgt_sec);
1080 /* Add the edges. */
1081 src_edge = xmalloc (sizeof (reloc_deps_e));
1082 memset (src_edge, 0, sizeof (reloc_deps_e));
1083 src_edge->src = src_sec;
1084 src_edge->tgt = tgt_sec;
1085 src_edge->next = src_sec_deps->succs;
1086 src_sec_deps->succs = src_edge;
1088 tgt_edge = xmalloc (sizeof (reloc_deps_e));
1089 memset (tgt_edge, 0, sizeof (reloc_deps_e));
1090 tgt_edge->src = src_sec;
1091 tgt_edge->tgt = tgt_sec;
1092 tgt_edge->next = tgt_sec_deps->preds;
1093 tgt_sec_deps->preds = tgt_edge;
1098 build_deps_graph_callback (asection *src_sec,
1099 bfd_vma src_offset ATTRIBUTE_UNUSED,
1100 asection *target_sec,
1101 bfd_vma target_offset ATTRIBUTE_UNUSED,
1104 reloc_deps_graph *deps = closure;
1106 /* If the target is defined. */
1107 if (target_sec != NULL)
1108 add_deps_edge (deps, src_sec, target_sec);
1112 static reloc_deps_graph *
1113 ld_build_required_section_dependence (lang_statement_union_type *s)
1115 reloc_deps_graph *deps;
1116 xtensa_ld_iter_stack *stack = NULL;
1118 deps = xmalloc (sizeof (reloc_deps_graph));
1119 deps->sections = NULL;
1123 for (iter_stack_create (&stack, s);
1124 !iter_stack_empty (&stack);
1125 iter_stack_next (&stack))
1127 lang_statement_union_type *l = iter_stack_current (&stack);
1129 if (l->header.type == lang_input_section_enum)
1131 lang_input_section_type *input;
1132 input = &l->input_section;
1133 xtensa_callback_required_dependence (input->section->owner,
1136 /* Use the same closure. */
1137 build_deps_graph_callback,
1145 #if EXTRA_VALIDATION
1147 ld_count_children (lang_statement_union_type *s)
1150 xtensa_ld_iter_stack *stack = NULL;
1151 for (iter_stack_create (&stack, s);
1152 !iter_stack_empty (&stack);
1153 iter_stack_next (&stack))
1155 lang_statement_union_type *l = iter_stack_current (&stack);
1161 #endif /* EXTRA_VALIDATION */
1164 /* Check if a particular section is included in the link. This will only
1165 be true for one instance of a particular linkonce section. */
1167 static bfd_boolean input_section_found = FALSE;
1168 static asection *input_section_target = NULL;
1171 input_section_linked_worker (lang_statement_union_type *statement)
1173 if ((statement->header.type == lang_input_section_enum
1174 && (statement->input_section.section == input_section_target)))
1175 input_section_found = TRUE;
1179 input_section_linked (asection *sec)
1181 input_section_found = FALSE;
1182 input_section_target = sec;
1183 lang_for_each_statement_worker (input_section_linked_worker, stat_ptr->head);
1184 return input_section_found;
1188 /* Strip out any linkonce literal sections or property tables where the
1189 associated linkonce text is from a different object file. Normally,
1190 a matching set of linkonce sections is taken from the same object file,
1191 but sometimes the files are compiled differently so that some of the
1192 linkonce sections are not present in all files. Stripping the
1193 inconsistent sections like this is not completely robust -- a much
1194 better solution is to use comdat groups. */
1196 static int linkonce_len = sizeof (".gnu.linkonce.") - 1;
1199 is_inconsistent_linkonce_section (asection *sec)
1201 bfd *abfd = sec->owner;
1202 const char *sec_name = bfd_get_section_name (abfd, sec);
1205 if ((bfd_get_section_flags (abfd, sec) & SEC_LINK_ONCE) == 0
1206 || strncmp (sec_name, ".gnu.linkonce.", linkonce_len) != 0)
1209 /* Check if this is an Xtensa property section. */
1210 if (strncmp (sec_name + linkonce_len, "p.", 2) == 0)
1212 else if (strncmp (sec_name + linkonce_len, "prop.", 5) == 0)
1216 int tag_len = strlen (prop_tag);
1217 char *dep_sec_name = xmalloc (strlen (sec_name));
1220 /* Get the associated linkonce text section and check if it is
1221 included in the link. If not, this section is inconsistent
1222 and should be stripped. */
1223 strcpy (dep_sec_name, ".gnu.linkonce.");
1224 strcat (dep_sec_name, sec_name + linkonce_len + tag_len);
1225 dep_sec = bfd_get_section_by_name (abfd, dep_sec_name);
1226 if (dep_sec == NULL || ! input_section_linked (dep_sec))
1228 free (dep_sec_name);
1231 free (dep_sec_name);
1239 xtensa_strip_inconsistent_linkonce_sections (lang_statement_list_type *slist)
1241 lang_statement_union_type **s_p = &slist->head;
1244 lang_statement_union_type *s = *s_p;
1245 lang_statement_union_type *s_next = (*s_p)->header.next;
1247 switch (s->header.type)
1249 case lang_input_section_enum:
1250 if (is_inconsistent_linkonce_section (s->input_section.section))
1257 case lang_constructors_statement_enum:
1258 xtensa_strip_inconsistent_linkonce_sections (&constructor_list);
1261 case lang_output_section_statement_enum:
1262 if (s->output_section_statement.children.head)
1263 xtensa_strip_inconsistent_linkonce_sections
1264 (&s->output_section_statement.children);
1267 case lang_wild_statement_enum:
1268 xtensa_strip_inconsistent_linkonce_sections
1269 (&s->wild_statement.children);
1272 case lang_group_statement_enum:
1273 xtensa_strip_inconsistent_linkonce_sections
1274 (&s->group_statement.children);
1277 case lang_data_statement_enum:
1278 case lang_reloc_statement_enum:
1279 case lang_object_symbols_statement_enum:
1280 case lang_output_statement_enum:
1281 case lang_target_statement_enum:
1282 case lang_input_statement_enum:
1283 case lang_assignment_statement_enum:
1284 case lang_padding_statement_enum:
1285 case lang_address_statement_enum:
1286 case lang_fill_statement_enum:
1294 s_p = &(*s_p)->header.next;
1297 /* Reset the tail of the list, in case the last entry was removed. */
1298 if (s_p != slist->tail)
1304 xtensa_wild_group_interleave_callback (lang_statement_union_type *statement)
1306 lang_wild_statement_type *w;
1307 reloc_deps_graph *deps;
1308 if (statement->header.type == lang_wild_statement_enum)
1310 #if EXTRA_VALIDATION
1311 size_t old_child_count;
1312 size_t new_child_count;
1314 bfd_boolean no_reorder;
1316 w = &statement->wild_statement;
1320 /* If it has 0 or 1 section bound, then do not reorder. */
1321 if (w->children.head == NULL
1322 || (w->children.head->header.type == lang_input_section_enum
1323 && w->children.head->header.next == NULL))
1326 if (w->filenames_sorted)
1329 /* Check for sorting in a section list wildcard spec as well. */
1332 struct wildcard_list *l;
1333 for (l = w->section_list; l != NULL; l = l->next)
1335 if (l->spec.sorted == TRUE)
1343 /* Special case until the NOREORDER linker directive is supported:
1344 *(.init) output sections and *(.fini) specs may NOT be reordered. */
1346 /* Check for sorting in a section list wildcard spec as well. */
1349 struct wildcard_list *l;
1350 for (l = w->section_list; l != NULL; l = l->next)
1353 && ((strcmp (".init", l->spec.name) == 0)
1354 || (strcmp (".fini", l->spec.name) == 0)))
1362 #if EXTRA_VALIDATION
1363 old_child_count = ld_count_children (statement);
1366 /* It is now officially a target. Build the graph of source
1367 section -> target section (kept as a list of edges). */
1368 deps = ld_build_required_section_dependence (statement);
1370 /* If this wildcard does not reorder.... */
1371 if (!no_reorder && deps->count != 0)
1373 /* First check for reverse dependences. Fix if possible. */
1374 xtensa_layout_wild (deps, w);
1376 xtensa_move_dependencies_to_front (deps, w);
1377 #if EXTRA_VALIDATION
1378 new_child_count = ld_count_children (statement);
1379 ASSERT (new_child_count == old_child_count);
1382 xtensa_colocate_literals (deps, statement);
1384 #if EXTRA_VALIDATION
1385 new_child_count = ld_count_children (statement);
1386 ASSERT (new_child_count == old_child_count);
1391 free_reloc_deps_graph (deps);
1397 xtensa_wild_group_interleave (lang_statement_union_type *s)
1399 lang_for_each_statement_worker (xtensa_wild_group_interleave_callback, s);
1404 xtensa_layout_wild (const reloc_deps_graph *deps, lang_wild_statement_type *w)
1406 /* If it does not fit initially, we need to do this step. Move all
1407 of the wild literal sections to a new list, then move each of
1408 them back in just before the first section they depend on. */
1409 lang_statement_union_type **s_p;
1410 #if EXTRA_VALIDATION
1411 size_t old_count, new_count;
1415 lang_wild_statement_type literal_wild;
1416 literal_wild.header.next = NULL;
1417 literal_wild.header.type = lang_wild_statement_enum;
1418 literal_wild.filename = NULL;
1419 literal_wild.filenames_sorted = FALSE;
1420 literal_wild.section_list = NULL;
1421 literal_wild.keep_sections = FALSE;
1422 literal_wild.children.head = NULL;
1423 literal_wild.children.tail = &literal_wild.children.head;
1425 #if EXTRA_VALIDATION
1426 old_count = ld_count_children ((lang_statement_union_type*) w);
1429 s_p = &w->children.head;
1430 while (*s_p != NULL)
1432 lang_statement_union_type *l = *s_p;
1433 if (l->header.type == lang_input_section_enum)
1435 if (section_is_target (deps, l)
1436 && ! section_is_source (deps, l))
1439 *s_p = l->header.next;
1441 w->children.tail = s_p;
1442 l->header.next = NULL;
1445 *literal_wild.children.tail = l;
1446 literal_wild.children.tail = &l->header.next;
1450 s_p = &(*s_p)->header.next;
1453 #if EXTRA_VALIDATION
1454 ct1 = ld_count_children ((lang_statement_union_type*) w);
1455 ct2 = ld_count_children ((lang_statement_union_type*) &literal_wild);
1457 ASSERT (old_count == (ct1 + ct2));
1460 /* Now place them back in front of their dependent sections. */
1462 while (literal_wild.children.head != NULL)
1464 lang_statement_union_type *lit = literal_wild.children.head;
1465 bfd_boolean placed = FALSE;
1467 #if EXTRA_VALIDATION
1473 literal_wild.children.head = lit->header.next;
1474 if (literal_wild.children.head == NULL)
1475 literal_wild.children.tail = &literal_wild.children.head;
1476 lit->header.next = NULL;
1478 /* Find a spot to place it. */
1479 for (s_p = &w->children.head; *s_p != NULL; s_p = &(*s_p)->header.next)
1481 lang_statement_union_type *src = *s_p;
1482 if (deps_has_edge (deps, src, lit))
1484 /* Place it here. */
1485 lit->header.next = *s_p;
1494 /* Put it at the end. */
1495 *w->children.tail = lit;
1496 w->children.tail = &lit->header.next;
1500 #if EXTRA_VALIDATION
1501 new_count = ld_count_children ((lang_statement_union_type*) w);
1502 ASSERT (new_count == old_count);
1508 xtensa_colocate_output_literals_callback (lang_statement_union_type *statement)
1510 lang_output_section_statement_type *os;
1511 reloc_deps_graph *deps;
1512 if (statement->header.type == lang_output_section_statement_enum)
1514 /* Now, we walk over the contours of the output section statement.
1516 First we build the literal section dependences as before.
1518 At the first uniquely_literal section, we mark it as a good
1519 spot to place other literals. Continue walking (and counting
1520 sizes) until we find the next literal section. If this
1521 section can be moved to the first one, then we move it. If
1522 we every find a modification of ".", start over. If we find
1523 a labeling of the current location, start over. Finally, at
1524 the end, if we require page alignment, add page alignments. */
1526 #if EXTRA_VALIDATION
1527 size_t old_child_count;
1528 size_t new_child_count;
1530 bfd_boolean no_reorder = FALSE;
1532 os = &statement->output_section_statement;
1534 #if EXTRA_VALIDATION
1535 old_child_count = ld_count_children (statement);
1538 /* It is now officially a target. Build the graph of source
1539 section -> target section (kept as a list of edges). */
1541 deps = ld_build_required_section_dependence (statement);
1543 /* If this wildcard does not reorder.... */
1546 /* First check for reverse dependences. Fix if possible. */
1547 xtensa_colocate_literals (deps, statement);
1549 #if EXTRA_VALIDATION
1550 new_child_count = ld_count_children (statement);
1551 ASSERT (new_child_count == old_child_count);
1555 /* Insert align/offset assignment statement. */
1556 if (xtensa_use_literal_pages)
1558 ld_xtensa_insert_page_offsets (0, statement, deps,
1559 xtensa_use_literal_pages);
1560 lang_for_each_statement_worker (xtensa_ldlang_clear_addresses,
1565 free_reloc_deps_graph (deps);
1571 xtensa_colocate_output_literals (lang_statement_union_type *s)
1573 lang_for_each_statement_worker (xtensa_colocate_output_literals_callback, s);
1578 xtensa_ldlang_clear_addresses (lang_statement_union_type *statement)
1580 switch (statement->header.type)
1582 case lang_input_section_enum:
1584 asection *bfd_section = statement->input_section.section;
1585 bfd_section->output_offset = 0;
1595 ld_assign_relative_paged_dot (bfd_vma dot,
1596 lang_statement_union_type *s,
1597 const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
1598 bfd_boolean lit_align)
1600 /* Walk through all of the input statements in this wild statement
1601 assign dot to all of them. */
1603 xtensa_ld_iter_stack *stack = NULL;
1604 xtensa_ld_iter_stack **stack_p = &stack;
1606 bfd_boolean first_section = FALSE;
1607 bfd_boolean in_literals = FALSE;
1609 for (iter_stack_create (stack_p, s);
1610 !iter_stack_empty (stack_p);
1611 iter_stack_next (stack_p))
1613 lang_statement_union_type *l = iter_stack_current (stack_p);
1615 switch (l->header.type)
1617 case lang_input_section_enum:
1619 asection *section = l->input_section.section;
1620 size_t align_pow = section->alignment_power;
1621 bfd_boolean do_xtensa_alignment = FALSE;
1625 bfd_boolean sec_is_target = section_is_target (deps, l);
1626 bfd_boolean sec_is_source = section_is_source (deps, l);
1628 if (section->size != 0
1630 || (in_literals && !sec_is_target)
1631 || (!in_literals && sec_is_target)))
1633 do_xtensa_alignment = TRUE;
1635 first_section = FALSE;
1636 if (section->size != 0)
1637 in_literals = (sec_is_target && !sec_is_source);
1640 if (do_xtensa_alignment && xtensa_page_power != 0)
1641 dot += (1 << xtensa_page_power);
1643 dot = align_power (dot, align_pow);
1644 section->output_offset = dot;
1645 dot += section->size;
1648 case lang_fill_statement_enum:
1649 dot += l->fill_statement.size;
1651 case lang_padding_statement_enum:
1652 dot += l->padding_statement.size;
1663 ld_local_file_relocations_fit (lang_statement_union_type *statement,
1664 const reloc_deps_graph *deps ATTRIBUTE_UNUSED)
1666 /* Walk over all of the dependencies that we identified and make
1667 sure that IF the source and target are here (addr != 0):
1668 1) target addr < source addr
1669 2) (roundup(source + source_size, 4) - rounddown(target, 4))
1670 < (256K - (1 << bad align))
1671 Need a worst-case proof.... */
1673 xtensa_ld_iter_stack *stack = NULL;
1674 xtensa_ld_iter_stack **stack_p = &stack;
1675 size_t max_align_power = 0;
1676 size_t align_penalty = 256;
1680 /* Find the worst-case alignment requirement for this set of statements. */
1681 for (iter_stack_create (stack_p, statement);
1682 !iter_stack_empty (stack_p);
1683 iter_stack_next (stack_p))
1685 lang_statement_union_type *l = iter_stack_current (stack_p);
1686 if (l->header.type == lang_input_section_enum)
1688 lang_input_section_type *input = &l->input_section;
1689 asection *section = input->section;
1690 if (section->alignment_power > max_align_power)
1691 max_align_power = section->alignment_power;
1695 /* Now check that everything fits. */
1696 for (i = 0; i < deps->count; i++)
1698 asection *sec = deps->sections[i];
1699 const reloc_deps_section *deps_section =
1700 xtensa_get_section_deps (deps, sec);
1703 /* We choose to walk through the successors. */
1704 for (e = deps_section->succs; e != NULL; e = e->next)
1706 if (e->src != e->tgt
1707 && e->src->output_section == e->tgt->output_section
1708 && e->src->output_offset != 0
1709 && e->tgt->output_offset != 0)
1712 align_power (e->src->output_offset + e->src->size, 2);
1713 bfd_vma target_addr = e->tgt->output_offset & ~3;
1714 if (l32r_addr < target_addr)
1716 fprintf (stderr, "Warning: "
1717 "l32r target section before l32r\n");
1721 if (l32r_addr - target_addr > 256 * 1024 - align_penalty)
1733 ld_xtensa_insert_page_offsets (bfd_vma dot,
1734 lang_statement_union_type *s,
1735 reloc_deps_graph *deps,
1736 bfd_boolean lit_align)
1738 xtensa_ld_iter_stack *stack = NULL;
1739 xtensa_ld_iter_stack **stack_p = &stack;
1741 bfd_boolean first_section = FALSE;
1742 bfd_boolean in_literals = FALSE;
1747 for (iter_stack_create (stack_p, s);
1748 !iter_stack_empty (stack_p);
1749 iter_stack_next (stack_p))
1751 lang_statement_union_type *l = iter_stack_current (stack_p);
1753 switch (l->header.type)
1755 case lang_input_section_enum:
1757 asection *section = l->input_section.section;
1758 bfd_boolean do_xtensa_alignment = FALSE;
1762 if (section->size != 0
1764 || (in_literals && !section_is_target (deps, l))
1765 || (!in_literals && section_is_target (deps, l))))
1767 do_xtensa_alignment = TRUE;
1769 first_section = FALSE;
1770 if (section->size != 0)
1772 in_literals = (section_is_target (deps, l)
1773 && !section_is_source (deps, l));
1777 if (do_xtensa_alignment && xtensa_page_power != 0)
1779 /* Create an expression that increments the current address,
1780 i.e., "dot", by (1 << xtensa_align_power). */
1781 etree_type *name_op = exp_nameop (NAME, ".");
1782 etree_type *addend_op = exp_intop (1 << xtensa_page_power);
1783 etree_type *add_op = exp_binop ('+', name_op, addend_op);
1784 etree_type *assign_op = exp_assop ('=', ".", add_op);
1786 lang_assignment_statement_type *assign_stmt;
1787 lang_statement_union_type *assign_union;
1788 lang_statement_list_type tmplist;
1789 lang_statement_list_type *old_stat_ptr = stat_ptr;
1791 /* There is hidden state in "lang_add_assignment". It
1792 appends the new assignment statement to the stat_ptr
1793 list. Thus, we swap it before and after the call. */
1795 tmplist.head = NULL;
1796 tmplist.tail = &tmplist.head;
1798 stat_ptr = &tmplist;
1799 /* Warning: side effect; statement appended to stat_ptr. */
1800 assign_stmt = lang_add_assignment (assign_op);
1801 assign_union = (lang_statement_union_type *) assign_stmt;
1802 stat_ptr = old_stat_ptr;
1804 assign_union->header.next = l;
1805 *(*stack_p)->iterloc.loc = assign_union;
1806 iter_stack_next (stack_p);
1819 # Define some shell vars to insert bits of code into the standard ELF
1820 # parse_args and list_options functions.
1822 PARSE_AND_LIST_PROLOGUE='
1823 #define OPTION_OPT_SIZEOPT (300)
1824 #define OPTION_NO_RELAX (OPTION_OPT_SIZEOPT + 1)
1825 #define OPTION_LITERAL_MOVEMENT (OPTION_NO_RELAX + 1)
1826 #define OPTION_NO_LITERAL_MOVEMENT (OPTION_LITERAL_MOVEMENT + 1)
1827 extern int elf32xtensa_size_opt;
1828 extern int elf32xtensa_no_literal_movement;
1831 PARSE_AND_LIST_LONGOPTS='
1832 { "size-opt", no_argument, NULL, OPTION_OPT_SIZEOPT},
1833 { "no-relax", no_argument, NULL, OPTION_NO_RELAX},
1834 { "literal-movement", no_argument, NULL, OPTION_LITERAL_MOVEMENT},
1835 { "no-literal-movement", no_argument, NULL, OPTION_NO_LITERAL_MOVEMENT},
1838 PARSE_AND_LIST_OPTIONS='
1839 fprintf (file, _(" --size-opt\t\tWhen relaxing longcalls, prefer size optimization\n\t\t\t over branch target alignment\n"));
1840 fprintf (file, _(" --no-relax\t\tDo not relax branches or coalesce literals\n"));
1843 PARSE_AND_LIST_ARGS_CASES='
1844 case OPTION_OPT_SIZEOPT:
1845 elf32xtensa_size_opt = 1;
1847 case OPTION_NO_RELAX:
1848 disable_relaxation = TRUE;
1850 case OPTION_LITERAL_MOVEMENT:
1851 elf32xtensa_no_literal_movement = 0;
1853 case OPTION_NO_LITERAL_MOVEMENT:
1854 elf32xtensa_no_literal_movement = 1;
1858 # Replace some of the standard ELF functions with our own versions.
1860 LDEMUL_BEFORE_PARSE=elf_xtensa_before_parse
1861 LDEMUL_AFTER_OPEN=elf_xtensa_after_open
1862 LDEMUL_CHOOSE_TARGET=elf_xtensa_choose_target
1863 LDEMUL_BEFORE_ALLOCATION=elf_xtensa_before_allocation