diff options
author | Bob Wilson <bob.wilson@acm.org> | 2004-11-04 21:52:55 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@acm.org> | 2004-11-04 21:52:55 +0000 |
commit | 9456465c211025cbe18b74c073302d164206a427 (patch) | |
tree | 0ecec7e252f2dc24b77c8017d00d5a0ffe41fb5a /gas/config | |
parent | a81b10aef7a31ca324e3588f6c646359c3a77204 (diff) | |
download | gdb-9456465c211025cbe18b74c073302d164206a427.zip gdb-9456465c211025cbe18b74c073302d164206a427.tar.gz gdb-9456465c211025cbe18b74c073302d164206a427.tar.bz2 |
* 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.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-xtensa.c | 123 | ||||
-rw-r--r-- | gas/config/tc-xtensa.h | 12 |
2 files changed, 54 insertions, 81 deletions
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index b75de92..a2eaf96 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -517,10 +517,9 @@ static void set_expr_symbol_offset_diff 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. */ @@ -647,9 +646,7 @@ enum option_no_workarounds, -#ifdef XTENSA_SECTION_RENAME option_rename_section_name, -#endif option_prefer_l32r, option_prefer_const16, @@ -716,9 +713,7 @@ struct option md_longopts[] = { "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 }, @@ -837,11 +832,9 @@ md_parse_option (int c, char *arg) 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 @@ -909,18 +902,14 @@ md_show_usage (FILE *stream) { 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); } @@ -11996,9 +11985,7 @@ copy_expr (expressionS *dst, const expressionS *src) } -/* Support for Tensilica's "--rename-section" option. */ - -#ifdef XTENSA_SECTION_RENAME +/* Support for the "--rename-section" option. */ struct rename_section_struct { @@ -12010,17 +11997,22 @@ 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, ':'); @@ -12030,56 +12022,47 @@ build_section_rename (const char *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; @@ -12091,5 +12074,3 @@ xtensa_section_rename (const char *name) return name; } - -#endif /* XTENSA_SECTION_RENAME */ diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h index cdf5cc2..585f1ce 100644 --- a/gas/config/tc-xtensa.h +++ b/gas/config/tc-xtensa.h @@ -287,15 +287,6 @@ typedef struct xtensa_segment_info_struct } 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 *); @@ -312,6 +303,7 @@ extern void xtensa_elf_section_change_hook (void); 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 @@ -324,13 +316,13 @@ extern void xtensa_handle_align (fragS *); #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) |