* config/tc-xtensa.c: Remove XTENSA_SECTION_RENAME ifdefs.

(add_section_rename): Delete.  Inlined into...
	(build_section_rename): ...here.  Use xstrdup instead of strdup.
	(xtensa_section_rename): Drop "const" from argument and return types.
	(md_show_usage): Indent to match show_usage().
	* config/tc-xtensa.h: Remove XTENSA_SECTION_RENAME ifdefs.
	(tc_canonicalize_section_name): Define.
	(md_elf_section_rename): Remove unused macro.
	* doc/as.texinfo (Overview): Document Xtensa --rename-section option.
	* doc/c-xtensa.texi (Xtensa Options): Likewise.
	(Frame Directive): Delete.
This commit is contained in:
Bob Wilson
2004-11-04 21:52:55 +00:00
parent a81b10aef7
commit 9456465c21
5 changed files with 77 additions and 115 deletions

View File

@ -1,3 +1,17 @@
2004-11-04 Bob Wilson <bob.wilson@acm.org>
* config/tc-xtensa.c: Remove XTENSA_SECTION_RENAME ifdefs.
(add_section_rename): Delete. Inlined into...
(build_section_rename): ...here. Use xstrdup instead of strdup.
(xtensa_section_rename): Drop "const" from argument and return types.
(md_show_usage): Indent to match show_usage().
* config/tc-xtensa.h: Remove XTENSA_SECTION_RENAME ifdefs.
(tc_canonicalize_section_name): Define.
(md_elf_section_rename): Remove unused macro.
* doc/as.texinfo (Overview): Document Xtensa --rename-section option.
* doc/c-xtensa.texi (Xtensa Options): Likewise.
(Frame Directive): Delete.
2004-11-04 Daniel Jacobowitz <dan@debian.org> 2004-11-04 Daniel Jacobowitz <dan@debian.org>
* configure.in: Remove arm-*-oabi and thumb-*-oabi. * configure.in: Remove arm-*-oabi and thumb-*-oabi.

View File

@ -517,10 +517,9 @@ static void set_expr_symbol_offset_diff
bfd_boolean expr_is_equal (expressionS *, expressionS *); bfd_boolean expr_is_equal (expressionS *, expressionS *);
static void copy_expr (expressionS *, const expressionS *); static void copy_expr (expressionS *, const expressionS *);
#ifdef XTENSA_SECTION_RENAME /* Section renaming. */
static void build_section_rename (const char *); static void build_section_rename (const char *);
static void add_section_rename (char *, char *);
#endif
/* ISA imported from bfd. */ /* ISA imported from bfd. */
@ -647,9 +646,7 @@ enum
option_no_workarounds, option_no_workarounds,
#ifdef XTENSA_SECTION_RENAME
option_rename_section_name, option_rename_section_name,
#endif
option_prefer_l32r, option_prefer_l32r,
option_prefer_const16, option_prefer_const16,
@ -716,9 +713,7 @@ struct option md_longopts[] =
{ "workaround-close-loop-end", no_argument, NULL, { "workaround-close-loop-end", no_argument, NULL,
option_workaround_close_loop_end }, option_workaround_close_loop_end },
#ifdef XTENSA_SECTION_RENAME
{ "rename-section", required_argument, NULL, option_rename_section_name }, { "rename-section", required_argument, NULL, option_rename_section_name },
#endif /* XTENSA_SECTION_RENAME */
{ "link-relax", no_argument, NULL, option_link_relax }, { "link-relax", no_argument, NULL, option_link_relax },
{ "no-link-relax", no_argument, NULL, option_no_link_relax }, { "no-link-relax", no_argument, NULL, option_no_link_relax },
@ -837,11 +832,9 @@ md_parse_option (int c, char *arg)
warn_unaligned_branch_targets = TRUE; warn_unaligned_branch_targets = TRUE;
return 1; return 1;
#ifdef XTENSA_SECTION_RENAME
case option_rename_section_name: case option_rename_section_name:
build_section_rename (arg); build_section_rename (arg);
return 1; return 1;
#endif /* XTENSA_SECTION_RENAME */
case 'Q': case 'Q':
/* -Qy, -Qn: SVR4 arguments controlling whether a .comment section /* -Qy, -Qn: SVR4 arguments controlling whether a .comment section
@ -909,18 +902,14 @@ md_show_usage (FILE *stream)
{ {
fputs ("\n\ fputs ("\n\
Xtensa options:\n\ Xtensa options:\n\
--[no-]text-section-literals\n\ --[no-]text-section-literals\n\
[Do not] put literals in the text section\n\ [Do not] put literals in the text section\n\
--[no-]absolute-literals\n\ --[no-]absolute-literals\n\
[Do not] default to use non-PC-relative literals\n\ [Do not] default to use non-PC-relative literals\n\
--[no-]target-align [Do not] try to align branch targets\n\ --[no-]target-align [Do not] try to align branch targets\n\
--[no-]longcalls [Do not] emit 32-bit call sequences\n\ --[no-]longcalls [Do not] emit 32-bit call sequences\n\
--[no-]transform [Do not] transform instructions\n" --[no-]transform [Do not] transform instructions\n\
#ifdef XTENSA_SECTION_RENAME --rename-section old=new Rename section 'old' to 'new'\n", stream);
"--rename-section old=new(:old1=new1)*\n\
Rename section 'old' to 'new'\n"
#endif /* XTENSA_SECTION_RENAME */
, stream);
} }
@ -11996,9 +11985,7 @@ copy_expr (expressionS *dst, const expressionS *src)
} }
/* Support for Tensilica's "--rename-section" option. */ /* Support for the "--rename-section" option. */
#ifdef XTENSA_SECTION_RENAME
struct rename_section_struct struct rename_section_struct
{ {
@ -12010,17 +11997,22 @@ struct rename_section_struct
static struct rename_section_struct *section_rename; static struct rename_section_struct *section_rename;
/* Parse the string oldname=new_name:oldname2=new_name2 /* Parse the string "oldname=new_name(:oldname2=new_name2)*" and add
and call add_section_rename. */ 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 static void
build_section_rename (const char *arg) build_section_rename (const char *arg)
{ {
struct rename_section_struct *r;
char *this_arg = NULL; char *this_arg = NULL;
char *next_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) if (this_arg)
{ {
next_arg = strchr (this_arg, ':'); next_arg = strchr (this_arg, ':');
@ -12030,56 +12022,47 @@ build_section_rename (const char *arg)
next_arg++; next_arg++;
} }
} }
{
char *old_name = this_arg;
char *new_name = strchr (this_arg, '=');
if (*old_name == '\0') old_name = this_arg;
{ new_name = strchr (this_arg, '=');
as_warn (_("ignoring extra '-rename-section' delimiter ':'"));
continue; if (*old_name == '\0')
} {
if (!new_name || new_name[1] == '\0') as_warn (_("ignoring extra '-rename-section' delimiter ':'"));
{ continue;
as_warn (_("ignoring invalid '-rename-section' " }
"specification: '%s'"), old_name); if (!new_name || new_name[1] == '\0')
continue; {
} as_warn (_("ignoring invalid '-rename-section' specification: '%s'"),
*new_name = '\0'; old_name);
new_name++; continue;
add_section_rename (old_name, new_name); }
} *new_name = '\0';
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;
} }
} }
static void char *
add_section_rename (char *old_name, char *new_name) xtensa_section_rename (char *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);
}
/* 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)
{ {
struct rename_section_struct *r = section_rename; struct rename_section_struct *r = section_rename;
@ -12091,5 +12074,3 @@ xtensa_section_rename (const char *name)
return name; return name;
} }
#endif /* XTENSA_SECTION_RENAME */

View File

@ -287,15 +287,6 @@ typedef struct xtensa_segment_info_struct
} xtensa_segment_info; } 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 const char *xtensa_target_format (void);
extern void xtensa_init_fix_data (struct fix *); extern void xtensa_init_fix_data (struct fix *);
extern void xtensa_frag_init (fragS *); extern void xtensa_frag_init (fragS *);
@ -312,6 +303,7 @@ extern void xtensa_elf_section_change_hook (void);
extern int xtensa_unrecognized_line (int); extern int xtensa_unrecognized_line (int);
extern bfd_boolean xtensa_check_inside_bundle (void); extern bfd_boolean xtensa_check_inside_bundle (void);
extern void xtensa_handle_align (fragS *); extern void xtensa_handle_align (fragS *);
extern char *xtensa_section_rename (char *);
#define TARGET_FORMAT xtensa_target_format () #define TARGET_FORMAT xtensa_target_format ()
#define TARGET_ARCH bfd_arch_xtensa #define TARGET_ARCH bfd_arch_xtensa
@ -324,13 +316,13 @@ extern void xtensa_handle_align (fragS *);
#define TC_FORCE_RELOCATION(fix) xtensa_force_relocation (fix) #define TC_FORCE_RELOCATION(fix) xtensa_force_relocation (fix)
#define NO_PSEUDO_DOT xtensa_check_inside_bundle () #define NO_PSEUDO_DOT xtensa_check_inside_bundle ()
#define tc_canonicalize_symbol_name(s) xtensa_section_rename (s) #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_init_after_args() xtensa_file_arch_init (stdoutput)
#define tc_fix_adjustable(fix) xtensa_fix_adjustable (fix) #define tc_fix_adjustable(fix) xtensa_fix_adjustable (fix)
#define tc_frob_label(sym) xtensa_frob_label (sym) #define tc_frob_label(sym) xtensa_frob_label (sym)
#define tc_unrecognized_line(ch) xtensa_unrecognized_line (ch) #define tc_unrecognized_line(ch) xtensa_unrecognized_line (ch)
#define md_do_align(a,b,c,d,e) xtensa_flush_pending_output () #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_change_hook xtensa_elf_section_change_hook
#define md_elf_section_rename(name) xtensa_section_rename (name)
#define md_end xtensa_end #define md_end xtensa_end
#define md_flush_pending_output() xtensa_flush_pending_output () #define md_flush_pending_output() xtensa_flush_pending_output ()
#define md_operand(x) #define md_operand(x)

View File

@ -424,6 +424,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
[@b{--[no-]text-section-literals}] [@b{--[no-]absolute-literals}] [@b{--[no-]text-section-literals}] [@b{--[no-]absolute-literals}]
[@b{--[no-]target-align}] [@b{--[no-]longcalls}] [@b{--[no-]target-align}] [@b{--[no-]longcalls}]
[@b{--[no-]transform}] [@b{--[no-]transform}]
[@b{--rename-section} @var{oldname}=@var{newname}]
@end ifset @end ifset
@c man end @c man end
@end smallexample @end smallexample

View File

@ -85,6 +85,11 @@ including both relaxation and optimization. The default is
rare cases when the instructions must be exactly as specified in the rare cases when the instructions must be exactly as specified in the
assembly source. Using @samp{--no-transform} causes out of range assembly source. Using @samp{--no-transform} causes out of range
instruction operands to be errors. 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 @end table
@node Xtensa Syntax @node Xtensa Syntax
@ -529,7 +534,6 @@ The following directives are available:
* Literal Position Directive:: Specify Inline Literal Pool Locations. * Literal Position Directive:: Specify Inline Literal Pool Locations.
* Literal Prefix Directive:: Specify Literal Section Name Prefix. * Literal Prefix Directive:: Specify Literal Section Name Prefix.
* Absolute Literals Directive:: Control PC-Relative vs. Absolute Literals. * Absolute Literals Directive:: Control PC-Relative vs. Absolute Literals.
* Frame Directive:: Describe a stack frame.
@end menu @end menu
@node Schedule Directive @node Schedule Directive
@ -744,36 +748,6 @@ Otherwise, the default is to assume PC-relative @code{L32R} addressing.
The @code{absolute-@-literals} directive can then be used to override The @code{absolute-@-literals} directive can then be used to override
the default determined by the command-line options. 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 Local Variables:
@c fill-column: 72 @c fill-column: 72
@c End: @c End: