bfd_boolean expr_is_equal (expressionS *, expressionS *);
static void copy_expr (expressionS *, const expressionS *);
-#ifdef XTENSA_SECTION_RENAME
+/* Section renaming. */
+
static void build_section_rename (const char *);
-static void add_section_rename (char *, char *);
-#endif
/* ISA imported from bfd. */
option_no_workarounds,
-#ifdef XTENSA_SECTION_RENAME
option_rename_section_name,
-#endif
option_prefer_l32r,
option_prefer_const16,
{ "workaround-close-loop-end", no_argument, NULL,
option_workaround_close_loop_end },
-#ifdef XTENSA_SECTION_RENAME
{ "rename-section", required_argument, NULL, option_rename_section_name },
-#endif /* XTENSA_SECTION_RENAME */
{ "link-relax", no_argument, NULL, option_link_relax },
{ "no-link-relax", no_argument, NULL, option_no_link_relax },
warn_unaligned_branch_targets = TRUE;
return 1;
-#ifdef XTENSA_SECTION_RENAME
case option_rename_section_name:
build_section_rename (arg);
return 1;
-#endif /* XTENSA_SECTION_RENAME */
case 'Q':
/* -Qy, -Qn: SVR4 arguments controlling whether a .comment section
{
fputs ("\n\
Xtensa options:\n\
---[no-]text-section-literals\n\
- [Do not] put literals in the text section\n\
---[no-]absolute-literals\n\
- [Do not] default to use non-PC-relative literals\n\
---[no-]target-align [Do not] try to align branch targets\n\
---[no-]longcalls [Do not] emit 32-bit call sequences\n\
---[no-]transform [Do not] transform instructions\n"
-#ifdef XTENSA_SECTION_RENAME
-"--rename-section old=new(:old1=new1)*\n\
- Rename section 'old' to 'new'\n"
-#endif /* XTENSA_SECTION_RENAME */
- , stream);
+ --[no-]text-section-literals\n\
+ [Do not] put literals in the text section\n\
+ --[no-]absolute-literals\n\
+ [Do not] default to use non-PC-relative literals\n\
+ --[no-]target-align [Do not] try to align branch targets\n\
+ --[no-]longcalls [Do not] emit 32-bit call sequences\n\
+ --[no-]transform [Do not] transform instructions\n\
+ --rename-section old=new Rename section 'old' to 'new'\n", stream);
}
\f
}
\f
-/* Support for Tensilica's "--rename-section" option. */
-
-#ifdef XTENSA_SECTION_RENAME
+/* Support for the "--rename-section" option. */
struct rename_section_struct
{
static struct rename_section_struct *section_rename;
-/* Parse the string oldname=new_name:oldname2=new_name2
- and call add_section_rename. */
+/* Parse the string "oldname=new_name(:oldname2=new_name2)*" and add
+ entries to the section_rename list. Note: Specifying multiple
+ renamings separated by colons is not documented and is retained only
+ for backward compatibility. */
static void
build_section_rename (const char *arg)
{
+ struct rename_section_struct *r;
char *this_arg = NULL;
char *next_arg = NULL;
- for (this_arg = strdup (arg); this_arg != NULL; this_arg = next_arg)
+ for (this_arg = xstrdup (arg); this_arg != NULL; this_arg = next_arg)
{
+ char *old_name, *new_name;
+
if (this_arg)
{
next_arg = strchr (this_arg, ':');
next_arg++;
}
}
- {
- char *old_name = this_arg;
- char *new_name = strchr (this_arg, '=');
- if (*old_name == '\0')
- {
- as_warn (_("ignoring extra '-rename-section' delimiter ':'"));
- continue;
- }
- if (!new_name || new_name[1] == '\0')
- {
- as_warn (_("ignoring invalid '-rename-section' "
- "specification: '%s'"), old_name);
- continue;
- }
- *new_name = '\0';
- new_name++;
- add_section_rename (old_name, new_name);
- }
- }
-}
+ old_name = this_arg;
+ new_name = strchr (this_arg, '=');
+ if (*old_name == '\0')
+ {
+ as_warn (_("ignoring extra '-rename-section' delimiter ':'"));
+ continue;
+ }
+ if (!new_name || new_name[1] == '\0')
+ {
+ as_warn (_("ignoring invalid '-rename-section' specification: '%s'"),
+ old_name);
+ continue;
+ }
+ *new_name = '\0';
+ new_name++;
-static void
-add_section_rename (char *old_name, char *new_name)
-{
- struct rename_section_struct *r = section_rename;
+ /* Check for invalid section renaming. */
+ for (r = section_rename; r != NULL; r = r->next)
+ {
+ if (strcmp (r->old_name, old_name) == 0)
+ as_bad (_("section %s renamed multiple times"), old_name);
+ if (strcmp (r->new_name, new_name) == 0)
+ as_bad (_("multiple sections remapped to output section %s"),
+ new_name);
+ }
- /* Check for invalid section renaming. */
- for (r = section_rename; r != NULL; r = r->next)
- {
- if (strcmp (r->old_name, old_name) == 0)
- as_bad (_("section %s renamed multiple times"), old_name);
- if (strcmp (r->new_name, new_name) == 0)
- as_bad (_("multiple sections remapped to output section %s"),
- new_name);
+ /* Now add it. */
+ r = (struct rename_section_struct *)
+ xmalloc (sizeof (struct rename_section_struct));
+ r->old_name = xstrdup (old_name);
+ r->new_name = xstrdup (new_name);
+ r->next = section_rename;
+ section_rename = r;
}
-
- /* Now add it. */
- r = (struct rename_section_struct *)
- xmalloc (sizeof (struct rename_section_struct));
- r->old_name = strdup (old_name);
- r->new_name = strdup (new_name);
- r->next = section_rename;
- section_rename = r;
}
-const char *
-xtensa_section_rename (const char *name)
+char *
+xtensa_section_rename (char *name)
{
struct rename_section_struct *r = section_rename;
return name;
}
-
-#endif /* XTENSA_SECTION_RENAME */
} xtensa_segment_info;
-/* Section renaming is only supported in Tensilica's version of GAS. */
-#ifdef XTENSA_SECTION_RENAME
-extern const char *xtensa_section_rename (const char *);
-#else
-/* Tensilica's section renaming feature is not included here. */
-#define xtensa_section_rename(name) (name)
-#endif /* XTENSA_SECTION_RENAME */
-
-
extern const char *xtensa_target_format (void);
extern void xtensa_init_fix_data (struct fix *);
extern void xtensa_frag_init (fragS *);
extern int xtensa_unrecognized_line (int);
extern bfd_boolean xtensa_check_inside_bundle (void);
extern void xtensa_handle_align (fragS *);
+extern char *xtensa_section_rename (char *);
#define TARGET_FORMAT xtensa_target_format ()
#define TARGET_ARCH bfd_arch_xtensa
#define TC_FORCE_RELOCATION(fix) xtensa_force_relocation (fix)
#define NO_PSEUDO_DOT xtensa_check_inside_bundle ()
#define tc_canonicalize_symbol_name(s) xtensa_section_rename (s)
+#define tc_canonicalize_section_name(s) xtensa_section_rename (s)
#define tc_init_after_args() xtensa_file_arch_init (stdoutput)
#define tc_fix_adjustable(fix) xtensa_fix_adjustable (fix)
#define tc_frob_label(sym) xtensa_frob_label (sym)
#define tc_unrecognized_line(ch) xtensa_unrecognized_line (ch)
#define md_do_align(a,b,c,d,e) xtensa_flush_pending_output ()
#define md_elf_section_change_hook xtensa_elf_section_change_hook
-#define md_elf_section_rename(name) xtensa_section_rename (name)
#define md_end xtensa_end
#define md_flush_pending_output() xtensa_flush_pending_output ()
#define md_operand(x)
rare cases when the instructions must be exactly as specified in the
assembly source. Using @samp{--no-transform} causes out of range
instruction operands to be errors.
+
+@item --rename-section @var{oldname}=@var{newname}
+@kindex --rename-section
+Rename the @var{oldname} section to @var{newname}. This option can be used
+multiple times to rename multiple sections.
@end table
@node Xtensa Syntax
* Literal Position Directive:: Specify Inline Literal Pool Locations.
* Literal Prefix Directive:: Specify Literal Section Name Prefix.
* Absolute Literals Directive:: Control PC-Relative vs. Absolute Literals.
-* Frame Directive:: Describe a stack frame.
@end menu
@node Schedule Directive
The @code{absolute-@-literals} directive can then be used to override
the default determined by the command-line options.
-@node Frame Directive
-@subsection frame
-@cindex @code{frame} directive
-
-This directive tells the assembler to emit information to allow the
-debugger to locate a function's stack frame. The syntax is:
-
-@smallexample
- .frame @var{reg}, @var{size}
-@end smallexample
-
-where @var{reg} is the register used to hold the frame pointer (usually
-the same as the stack pointer) and @var{size} is the size in bytes of
-the stack frame. The @code{.frame} directive is typically placed
-near the @code{ENTRY} instruction for a function.
-
-In many circumstances, this information just duplicates the
-information given in the function's @code{ENTRY} instruction; however,
-there are two cases where this is not true:
-
-@enumerate
-@item
-The size of the stack frame is too big to fit in the immediate field
-of the @code{ENTRY} instruction.
-
-@item
-The frame pointer is different than the stack pointer, as with functions
-that call @code{alloca}.
-@end enumerate
-
@c Local Variables:
@c fill-column: 72
@c End: