#include "filenames.h"
#include "fnmatch.h"
#include "elf-bfd.h"
-#include "libbfd.h"
#include "coff/internal.h"
#include "libcoff.h"
#define SECTION_CONTEXT_SET_LMA (1 << 4) /* Set the sections' LMA address. */
#define SECTION_CONTEXT_ALTER_LMA (1 << 5) /* Increment or decrement the section's LMA address. */
#define SECTION_CONTEXT_SET_FLAGS (1 << 6) /* Set the section's flags. */
+#define SECTION_CONTEXT_REMOVE_RELOCS (1 << 7) /* Remove relocations for this section. */
bfd_vma vma_val; /* Amount to change by or set to. */
bfd_vma lma_val; /* Amount to change by or set to. */
decompress = 1 << 4
} do_debug_sections = nothing;
+/* Whether to generate ELF common symbols with the STT_COMMON type. */
+static enum bfd_link_elf_stt_common do_elf_stt_common = unchanged;
+
/* Whether to change the leading character in symbol names. */
static bfd_boolean change_leading_char = FALSE;
OPTION_DEBUGGING,
OPTION_DECOMPRESS_DEBUG_SECTIONS,
OPTION_DUMP_SECTION,
+ OPTION_ELF_STT_COMMON,
OPTION_EXTRACT_DWO,
OPTION_EXTRACT_SYMBOL,
OPTION_FILE_ALIGNMENT,
OPTION_REDEFINE_SYM,
OPTION_REDEFINE_SYMS,
OPTION_REMOVE_LEADING_CHAR,
+ OPTION_REMOVE_RELOCS,
OPTION_RENAME_SECTION,
OPTION_REVERSE_BYTES,
OPTION_SECTION_ALIGNMENT,
{"output-target", required_argument, 0, 'O'},
{"preserve-dates", no_argument, 0, 'p'},
{"remove-section", required_argument, 0, 'R'},
+ {"remove-relocations", required_argument, 0, OPTION_REMOVE_RELOCS},
{"strip-all", no_argument, 0, 's'},
{"strip-debug", no_argument, 0, 'S'},
{"strip-dwo", no_argument, 0, OPTION_STRIP_DWO},
{"discard-all", no_argument, 0, 'x'},
{"discard-locals", no_argument, 0, 'X'},
{"dump-section", required_argument, 0, OPTION_DUMP_SECTION},
+ {"elf-stt-common", required_argument, 0, OPTION_ELF_STT_COMMON},
{"enable-deterministic-archives", no_argument, 0, 'D'},
{"extract-dwo", no_argument, 0, OPTION_EXTRACT_DWO},
{"extract-symbol", no_argument, 0, OPTION_EXTRACT_SYMBOL},
{"redefine-syms", required_argument, 0, OPTION_REDEFINE_SYMS},
{"remove-leading-char", no_argument, 0, OPTION_REMOVE_LEADING_CHAR},
{"remove-section", required_argument, 0, 'R'},
+ {"remove-relocations", required_argument, 0, OPTION_REMOVE_RELOCS},
{"rename-section", required_argument, 0, OPTION_RENAME_SECTION},
{"reverse-bytes", required_argument, 0, OPTION_REVERSE_BYTES},
{"section-alignment", required_argument, 0, OPTION_SECTION_ALIGNMENT},
static void mark_symbols_used_in_relocations (bfd *, asection *, void *);
static bfd_boolean write_debugging_info (bfd *, void *, long *, asymbol ***);
static const char *lookup_sym_redefinition (const char *);
+static const char *find_section_rename (const char *, flagword *);
\f
-static void
+ATTRIBUTE_NORETURN static void
copy_usage (FILE *stream, int exit_status)
{
fprintf (stream, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name);
-j --only-section <name> Only copy section <name> into the output\n\
--add-gnu-debuglink=<file> Add section .gnu_debuglink linking to <file>\n\
-R --remove-section <name> Remove section <name> from the output\n\
+ --remove-relocations <name> Remove relocations from section <name>\n\
-S --strip-all Remove all symbol and relocation information\n\
-g --strip-debug Remove all debugging symbols & sections\n\
--strip-dwo Remove all DWO sections\n\
--compress-debug-sections[={none|zlib|zlib-gnu|zlib-gabi}]\n\
Compress DWARF debug sections using zlib\n\
--decompress-debug-sections Decompress DWARF debug sections using zlib\n\
+ --elf-stt-common=[yes|no] Generate ELF common symbols with STT_COMMON\n\
+ type\n\
-v --verbose List all object files modified\n\
@<file> Read options from <file>\n\
-V --version Display this program's version number\n\
exit (exit_status);
}
-static void
+ATTRIBUTE_NORETURN static void
strip_usage (FILE *stream, int exit_status)
{
fprintf (stream, _("Usage: %s <option(s)> in-file(s)\n"), program_name);
Disable -D behavior (default)\n"));
fprintf (stream, _("\
-R --remove-section=<name> Also remove section <name> from the output\n\
+ --remove-relocations <name> Remove relocations from section <name>\n\
-s --strip-all Remove all symbol and relocation information\n\
-g -S -d --strip-debug Remove all debugging symbols & sections\n\
--strip-dwo Remove all DWO sections\n\
}
if (0) ;
-#define PARSE_FLAG(fname,fval) \
- else if (strncasecmp (fname, s, len) == 0) ret |= fval
+#define PARSE_FLAG(fname,fval) \
+ else if (strncasecmp (fname, s, len) == 0) ret |= fval
PARSE_FLAG ("alloc", SEC_ALLOC);
PARSE_FLAG ("load", SEC_LOAD);
PARSE_FLAG ("noload", SEC_NEVER_LOAD);
{
flagword ret;
const char *snext;
- int len;
+ size_t len;
ret = BSF_NO_FLAGS;
{
snext = strchr (s, ',');
if (snext == NULL)
- len = strlen (s);
+ len = strlen (s);
else
{
len = snext - s;
++snext;
}
-#define PARSE_FLAG(fname,fval) \
- else if (len == (int) sizeof fname - 1 && strncasecmp (fname, s, len) == 0) \
+#define PARSE_FLAG(fname, fval) \
+ else if (len == sizeof fname - 1 \
+ && strncasecmp (fname, s, len) == 0) \
ret |= fval
-#define PARSE_OTHER(fname,fval) \
- else if (len >= (int) sizeof fname && strncasecmp (fname, s, sizeof fname - 1) == 0) \
+#define PARSE_OTHER(fname, fval) \
+ else if (len >= sizeof fname \
+ && strncasecmp (fname, s, sizeof fname - 1) == 0) \
fval = xstrndup (s + sizeof fname - 1, len - sizeof fname + 1)
-
+
if (0) ;
PARSE_FLAG ("local", BSF_LOCAL);
PARSE_FLAG ("global", BSF_GLOBAL);
copy[len] = '\0';
non_fatal (_("unrecognized symbol flag `%s'"), copy);
fatal (_("supported flags: %s"),
- "local, global, export, debug, function, weak, section, "
- "constructor, warning, indirect, file, object, synthetic, "
- "indirect-function, unique-object, before=<othersym>");
+ "local, global, export, debug, function, weak, section, "
+ "constructor, warning, indirect, file, object, synthetic, "
+ "indirect-function, unique-object, before=<othersym>");
}
s = snext;
static struct section_list *
find_section_list (const char *name, bfd_boolean add, unsigned int context)
{
- struct section_list *p;
+ struct section_list *p, *match = NULL;
/* assert ((context & ((1 << 7) - 1)) != 0); */
}
/* If we are not adding a new name/pattern then
only check for a match if the context applies. */
- else if ((p->context & context)
- /* We could check for the presence of wildchar characters
- first and choose between calling strcmp and fnmatch,
- but is that really worth it ? */
- && fnmatch (p->pattern, name, 0) == 0)
- {
- p->used = TRUE;
- return p;
- }
+ else if (p->context & context)
+ {
+ /* We could check for the presence of wildchar characters
+ first and choose between calling strcmp and fnmatch,
+ but is that really worth it ? */
+ if (p->pattern [0] == '!')
+ {
+ if (fnmatch (p->pattern + 1, name, 0) == 0)
+ {
+ p->used = TRUE;
+ return NULL;
+ }
+ }
+ else
+ {
+ if (fnmatch (p->pattern, name, 0) == 0)
+ {
+ if (match == NULL)
+ match = p;
+ }
+ }
+ }
}
if (! add)
- return NULL;
+ {
+ if (match != NULL)
+ match->used = TRUE;
+ return match;
+ }
p = (struct section_list *) xmalloc (sizeof (struct section_list));
p->pattern = name;
bfd *abfd = group->owner;
Elf_Internal_Shdr *ghdr;
+ /* PR 20089: An earlier error may have prevented us from loading the symbol table. */
+ if (isympp == NULL)
+ return NULL;
+
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
return NULL;
Elf_Internal_Shdr *symhdr = elf_elfsections (abfd) [ghdr->sh_link];
if (symhdr->sh_type == SHT_SYMTAB
- && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
+ && ghdr->sh_info > 0
+ && ghdr->sh_info < (symhdr->sh_size / bed->s->sizeof_sym))
return isympp[ghdr->sh_info - 1];
}
return NULL;
struct section_add *pupdate;
for (pupdate = update_sections;
- pupdate != NULL;
- pupdate = pupdate->next)
+ pupdate != NULL;
+ pupdate = pupdate->next)
{
- if (strcmp (sec->name, pupdate->name) == 0)
- return TRUE;
- }
+ if (strcmp (sec->name, pupdate->name) == 0)
+ return TRUE;
+ }
}
return FALSE;
fatal (_("error: section %s matches both remove and copy options"),
bfd_get_section_name (abfd, sec));
if (p && is_update_section (abfd, sec))
- fatal (_("error: section %s matches both update and remove options"),
- bfd_get_section_name (abfd, sec));
+ fatal (_("error: section %s matches both update and remove options"),
+ bfd_get_section_name (abfd, sec));
if (p != NULL)
return TRUE;
static asymbol *
create_new_symbol (struct addsym_node *ptr, bfd *obfd)
{
- asymbol *sym = bfd_make_empty_symbol(obfd);
+ asymbol *sym = bfd_make_empty_symbol (obfd);
- bfd_asymbol_name(sym) = ptr->symdef;
+ bfd_asymbol_name (sym) = ptr->symdef;
sym->value = ptr->symval;
sym->flags = ptr->flags;
if (ptr->section)
fatal (_("Section %s not found"), ptr->section);
sym->section = sec;
}
- else
- sym->section = bfd_abs_section_ptr;
+ else
+ sym->section = bfd_abs_section_ptr;
return sym;
}
to[dst_count++] = create_new_symbol (ptr, obfd);
}
- if (redefine_sym_list)
+ if (redefine_sym_list || section_rename_list)
{
- char *old_name, *new_name;
+ char *new_name;
- old_name = (char *) bfd_asymbol_name (sym);
- new_name = (char *) lookup_sym_redefinition (old_name);
+ new_name = (char *) lookup_sym_redefinition (name);
+ if (new_name == name
+ && (flags & BSF_SECTION_SYM) != 0)
+ new_name = (char *) find_section_rename (name, NULL);
bfd_asymbol_name (sym) = new_name;
name = new_name;
}
/* Short circuit for change_leading_char if we can do it in-place. */
if (rem_leading_char && add_leading_char && !prefix_symbols_string)
- {
+ {
name[0] = bfd_get_symbol_leading_char (obfd);
bfd_asymbol_name (sym) = name;
rem_leading_char = FALSE;
add_leading_char = FALSE;
- }
+ }
/* Remove leading char. */
if (rem_leading_char)
/* Add new leading char and/or prefix. */
if (add_leading_char || prefix_symbols_string)
- {
- char *n, *ptr;
+ {
+ char *n, *ptr;
- ptr = n = (char *) xmalloc (1 + strlen (prefix_symbols_string)
- + strlen (name) + 1);
- if (add_leading_char)
+ ptr = n = (char *) xmalloc (1 + strlen (prefix_symbols_string)
+ + strlen (name) + 1);
+ if (add_leading_char)
*ptr++ = bfd_get_symbol_leading_char (obfd);
- if (prefix_symbols_string)
- {
- strcpy (ptr, prefix_symbols_string);
- ptr += strlen (prefix_symbols_string);
- }
+ if (prefix_symbols_string)
+ {
+ strcpy (ptr, prefix_symbols_string);
+ ptr += strlen (prefix_symbols_string);
+ }
- strcpy (ptr, name);
- bfd_asymbol_name (sym) = n;
- name = n;
+ strcpy (ptr, name);
+ bfd_asymbol_name (sym) = n;
+ name = n;
}
if (strip_symbols == STRIP_ALL)
if ((c == '\r' && (c = getc (file)) == '\n')
|| c == '\n' || c == EOF)
{
- end_of_line:
+ end_of_line:
/* Append the redefinition to the list. */
if (buf[0] != '\0')
redefine_list_append (filename, &buf[0], &buf[outsym_off]);
}
else
fatal (_("%s:%d: garbage found at end of line"), filename, lineno);
- comment:
+ comment:
if (len != 0 && (outsym_off == 0 || outsym_off == len))
fatal (_("%s:%d: missing new symbol name"), filename, lineno);
buf[len++] = '\0';
return FALSE;
}
- if ((do_debug_sections & compress) != 0
- && do_debug_sections != compress
- && ibfd->xvec->flavour != bfd_target_elf_flavour)
+ if (ibfd->xvec->flavour != bfd_target_elf_flavour)
{
- non_fatal (_("--compress-debug-sections=[zlib|zlib-gnu|zlib-gabi] is unsupported on `%s'"),
- bfd_get_archive_filename (ibfd));
- return FALSE;
+ if ((do_debug_sections & compress) != 0
+ && do_debug_sections != compress)
+ {
+ non_fatal (_("--compress-debug-sections=[zlib|zlib-gnu|zlib-gabi] is unsupported on `%s'"),
+ bfd_get_archive_filename (ibfd));
+ return FALSE;
+ }
+
+ if (do_elf_stt_common)
+ {
+ non_fatal (_("--elf-stt-common=[yes|no] is unsupported on `%s'"),
+ bfd_get_archive_filename (ibfd));
+ return FALSE;
+ }
}
if (verbose)
if (bfd_get_section_by_name (obfd, padd->name))
{
bfd_nonfatal_message (NULL, obfd, NULL,
- _("can't add section '%s'"), padd->name);
+ _("can't add section '%s'"), padd->name);
return FALSE;
}
else
{
/* We use LINKER_CREATED here so that the backend hooks
- will create any special section type information,
- instead of presuming we know what we're doing merely
- because we set the flags. */
+ will create any special section type information,
+ instead of presuming we know what we're doing merely
+ because we set the flags. */
padd->section = bfd_make_section_with_flags
(obfd, padd->name, flags | SEC_LINKER_CREATED);
if (padd->section == NULL)
|| change_leading_char
|| remove_leading_char
|| redefine_sym_list
+ || section_rename_list
|| weaken
|| add_symbols)
{
struct section_add *pupdate;
for (pupdate = update_sections;
- pupdate != NULL;
- pupdate = pupdate->next)
+ pupdate != NULL;
+ pupdate = pupdate->next)
{
asection *osec;
osec = pupdate->section->output_section;
if (! bfd_set_section_contents (obfd, osec, pupdate->contents,
- 0, pupdate->size))
+ 0, pupdate->size))
{
bfd_nonfatal_message (NULL, obfd, osec, NULL);
return FALSE;
/* Make a temp directory to hold the contents. */
dir = make_tempdir (bfd_get_filename (obfd));
if (dir == NULL)
- fatal (_("cannot create tempdir for archive copying (error: %s)"),
+ fatal (_("cannot create tempdir for archive copying (error: %s)"),
strerror (errno));
if (strip_symbols == STRIP_ALL)
break;
}
+ switch (do_elf_stt_common)
+ {
+ case elf_stt_common:
+ ibfd->flags |= BFD_CONVERT_ELF_COMMON | BFD_USE_ELF_STT_COMMON;
+ break;
+ break;
+ case no_elf_stt_common:
+ ibfd->flags |= BFD_CONVERT_ELF_COMMON;
+ break;
+ default:
+ break;
+ }
+
if (bfd_check_format (ibfd, bfd_archive))
{
bfd_boolean force_output_target;
bfd *obfd;
/* bfd_get_target does not return the correct value until
- bfd_check_format succeeds. */
+ bfd_check_format succeeds. */
if (output_target == NULL)
{
output_target = bfd_get_target (ibfd);
do_copy:
/* bfd_get_target does not return the correct value until
- bfd_check_format succeeds. */
+ bfd_check_format succeeds. */
if (output_target == NULL)
output_target = bfd_get_target (ibfd);
}
/* Check the section rename list for a new name of the input section
- ISECTION. Return the new name if one is found.
- Also set RETURNED_FLAGS to the flags to be used for this section. */
+ called OLD_NAME. Returns the new name if one is found and sets
+ RETURNED_FLAGS if non-NULL to the flags to be used for this section. */
static const char *
-find_section_rename (bfd * ibfd ATTRIBUTE_UNUSED, sec_ptr isection,
- flagword * returned_flags)
+find_section_rename (const char *old_name, flagword *returned_flags)
{
- const char * old_name = bfd_section_name (ibfd, isection);
- section_rename * srename;
-
- /* Default to using the flags of the input section. */
- * returned_flags = bfd_get_section_flags (ibfd, isection);
+ const section_rename *srename;
for (srename = section_rename_list; srename != NULL; srename = srename->next)
if (strcmp (srename->old_name, old_name) == 0)
{
- if (srename->flags != (flagword) -1)
- * returned_flags = srename->flags;
+ if (returned_flags != NULL && srename->flags != (flagword) -1)
+ *returned_flags = srename->flags;
return srename->new_name;
}
return;
/* Get the, possibly new, name of the output section. */
- name = find_section_rename (ibfd, isection, & flags);
+ name = bfd_section_name (ibfd, isection);
+ flags = bfd_get_section_flags (ibfd, isection);
+ name = find_section_rename (name, &flags);
/* Prefix sections. */
if ((prefix_alloc_sections_string)
flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC));
else if (strip_symbols == STRIP_NONDEBUG
&& (flags & (SEC_ALLOC | SEC_GROUP)) != 0
- && !is_nondebug_keep_contents_section (ibfd, isection))
+ && !is_nondebug_keep_contents_section (ibfd, isection))
{
flags &= ~(SEC_HAS_CONTENTS | SEC_LOAD | SEC_GROUP);
if (obfd->xvec->flavour == bfd_target_elf_flavour)
/* All went well. */
return;
-loser:
+ loser:
status = 1;
bfd_nonfatal_message (NULL, obfd, osection, err);
}
return FALSE;
}
+/* Add section SECTION_PATTERN to the list of sections that will have their
+ relocations removed. */
+
+static void
+handle_remove_relocations_option (const char *section_pattern)
+{
+ find_section_list (section_pattern, TRUE, SECTION_CONTEXT_REMOVE_RELOCS);
+}
+
+/* Return TRUE if ISECTION from IBFD should have its relocations removed,
+ otherwise return FALSE. If the user has requested that relocations be
+ removed from a section that does not have relocations then this
+ function will still return TRUE. */
+
+static bfd_boolean
+discard_relocations (bfd *ibfd ATTRIBUTE_UNUSED, asection *isection)
+{
+ return (find_section_list (bfd_section_name (ibfd, isection), FALSE,
+ SECTION_CONTEXT_REMOVE_RELOCS) != NULL);
+}
+
+/* Wrapper for dealing with --remove-section (-R) command line arguments.
+ A special case is detected here, if the user asks to remove a relocation
+ section (one starting with ".rela." or ".rel.") then this removal must
+ be done using a different technique. */
+
+static void
+handle_remove_section_option (const char *section_pattern)
+{
+ if (strncmp (section_pattern, ".rela.", 6) == 0)
+ handle_remove_relocations_option (section_pattern + 5);
+ else if (strncmp (section_pattern, ".rel.", 5) == 0)
+ handle_remove_relocations_option (section_pattern + 4);
+ else
+ {
+ find_section_list (section_pattern, TRUE, SECTION_CONTEXT_REMOVE);
+ sections_removed = TRUE;
+ }
+}
+
/* Copy relocations in input section ISECTION of IBFD to an output
section with the same name in OBFDARG. If stripping then don't
copy any relocation info. */
osection = isection->output_section;
/* Core files and DWO files do not need to be relocated. */
- if (bfd_get_format (obfd) == bfd_core || strip_symbols == STRIP_NONDWO)
+ if (bfd_get_format (obfd) == bfd_core
+ || strip_symbols == STRIP_NONDWO
+ || discard_relocations (ibfd, isection))
relsize = 0;
else
{
for (i = 0; i < relcount; i++)
{
/* PR 17512: file: 9e907e0c. */
- if (relpp[i]->sym_ptr_ptr)
+ if (relpp[i]->sym_ptr_ptr
+ /* PR 20096 */
+ && * relpp[i]->sym_ptr_ptr)
if (is_specified_symbol (bfd_asymbol_name (*relpp[i]->sym_ptr_ptr),
keep_specific_htab))
temp_relpp [temp_relcount++] = relpp [i];
}
/* We can get away with setting the section contents now because
- the next thing the caller is going to do is copy over the
- real sections. We may someday have to split the contents
- setting out of this function. */
+ the next thing the caller is going to do is copy over the
+ real sections. We may someday have to split the contents
+ setting out of this function. */
if (! bfd_set_section_contents (obfd, stabsec, syms, 0, symsize)
|| ! bfd_set_section_contents (obfd, stabstrsec, strings, 0,
stringsize))
bfd_nonfatal_message (NULL, obfd, NULL,
_("don't know how to write debugging information for %s"),
- bfd_get_target (obfd));
+ bfd_get_target (obfd));
return FALSE;
}
input_target = output_target = optarg;
break;
case 'R':
- find_section_list (optarg, TRUE, SECTION_CONTEXT_REMOVE);
- sections_removed = TRUE;
+ handle_remove_section_option (optarg);
+ break;
+ case OPTION_REMOVE_RELOCS:
+ handle_remove_relocations_option (optarg);
break;
case 's':
strip_symbols = STRIP_ALL;
static struct section_add *
init_section_add (const char *arg,
- struct section_add *next,
- const char *option)
+ struct section_add *next,
+ const char *option)
{
struct section_add *pa;
const char *s;
f = fopen (pa->filename, FOPEN_RB);
if (f == NULL)
fatal (_("cannot open: %s: %s"),
- pa->filename, strerror (errno));
+ pa->filename, strerror (errno));
off = 0;
alloc = 4096;
off_t got;
if (off == alloc)
- {
- alloc <<= 1;
- pa->contents = (bfd_byte *) xrealloc (pa->contents, alloc);
- }
+ {
+ alloc <<= 1;
+ pa->contents = (bfd_byte *) xrealloc (pa->contents, alloc);
+ }
got = fread (pa->contents + off, 1, alloc - off, f);
if (ferror (f))
- fatal (_("%s: fread failed"), pa->filename);
+ fatal (_("%s: fread failed"), pa->filename);
off += got;
}
break;
case 'R':
- find_section_list (optarg, TRUE, SECTION_CONTEXT_REMOVE);
- sections_removed = TRUE;
+ handle_remove_section_option (optarg);
+ break;
+
+ case OPTION_REMOVE_RELOCS:
+ handle_remove_relocations_option (optarg);
break;
case 'S':
break;
case OPTION_ADD_SECTION:
- add_sections = init_section_add (optarg, add_sections,
- "--add-section");
- section_add_load_file (add_sections);
+ add_sections = init_section_add (optarg, add_sections,
+ "--add-section");
+ section_add_load_file (add_sections);
break;
case OPTION_UPDATE_SECTION:
update_sections = init_section_add (optarg, update_sections,
- "--update-section");
+ "--update-section");
section_add_load_file (update_sections);
break;
case OPTION_DUMP_SECTION:
- dump_sections = init_section_add (optarg, dump_sections,
- "--dump-section");
+ dump_sections = init_section_add (optarg, dump_sections,
+ "--dump-section");
break;
case OPTION_ADD_SYMBOL:
}
t = strchr (t + 1, ',');
+ newsym->othersym = NULL;
if (t)
newsym->flags = parse_symflags (t+1, &newsym->othersym);
else
{
case OPTION_CHANGE_SECTION_ADDRESS:
p->vma_val = val;
- /* Drop through. */
+ /* Fall through. */
case OPTION_CHANGE_SECTION_LMA:
p->lma_val = val;
do_debug_sections = decompress;
break;
+ case OPTION_ELF_STT_COMMON:
+ if (strcasecmp (optarg, "yes") == 0)
+ do_elf_stt_common = elf_stt_common;
+ else if (strcasecmp (optarg, "no") == 0)
+ do_elf_stt_common = no_elf_stt_common;
+ else
+ fatal (_("unrecognized --elf-stt-common= option `%s'"),
+ optarg);
+ break;
+
case OPTION_GAP_FILL:
{
bfd_vma gap_fill_vma;
break;
case OPTION_REVERSE_BYTES:
- {
- int prev = reverse_bytes;
+ {
+ int prev = reverse_bytes;
- reverse_bytes = atoi (optarg);
- if ((reverse_bytes <= 0) || ((reverse_bytes % 2) != 0))
- fatal (_("number of bytes to reverse must be positive and even"));
+ reverse_bytes = atoi (optarg);
+ if ((reverse_bytes <= 0) || ((reverse_bytes % 2) != 0))
+ fatal (_("number of bytes to reverse must be positive and even"));
- if (prev && prev != reverse_bytes)
- non_fatal (_("Warning: ignoring previous --reverse-bytes value of %d"),
- prev);
- break;
- }
+ if (prev && prev != reverse_bytes)
+ non_fatal (_("Warning: ignoring previous --reverse-bytes value of %d"),
+ prev);
+ break;
+ }
case OPTION_FILE_ALIGNMENT:
pe_file_alignment = parse_vma (optarg, "--file-alignment");
break;
case OPTION_HEAP:
- {
- char *end;
- pe_heap_reserve = strtoul (optarg, &end, 0);
- if (end == optarg
- || (*end != '.' && *end != '\0'))
- non_fatal (_("%s: invalid reserve value for --heap"),
- optarg);
- else if (*end != '\0')
- {
- pe_heap_commit = strtoul (end + 1, &end, 0);
- if (*end != '\0')
- non_fatal (_("%s: invalid commit value for --heap"),
- optarg);
- }
- }
+ {
+ char *end;
+ pe_heap_reserve = strtoul (optarg, &end, 0);
+ if (end == optarg
+ || (*end != '.' && *end != '\0'))
+ non_fatal (_("%s: invalid reserve value for --heap"),
+ optarg);
+ else if (*end != '\0')
+ {
+ pe_heap_commit = strtoul (end + 1, &end, 0);
+ if (*end != '\0')
+ non_fatal (_("%s: invalid commit value for --heap"),
+ optarg);
+ }
+ }
break;
case OPTION_IMAGE_BASE:
break;
case OPTION_STACK:
- {
- char *end;
- pe_stack_reserve = strtoul (optarg, &end, 0);
- if (end == optarg
- || (*end != '.' && *end != '\0'))
- non_fatal (_("%s: invalid reserve value for --stack"),
- optarg);
- else if (*end != '\0')
- {
- pe_stack_commit = strtoul (end + 1, &end, 0);
- if (*end != '\0')
- non_fatal (_("%s: invalid commit value for --stack"),
- optarg);
- }
- }
+ {
+ char *end;
+ pe_stack_reserve = strtoul (optarg, &end, 0);
+ if (end == optarg
+ || (*end != '.' && *end != '\0'))
+ non_fatal (_("%s: invalid reserve value for --stack"),
+ optarg);
+ else if (*end != '\0')
+ {
+ pe_stack_commit = strtoul (end + 1, &end, 0);
+ if (*end != '\0')
+ non_fatal (_("%s: invalid commit value for --stack"),
+ optarg);
+ }
+ }
break;
case 0: