}
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;
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;
}
/* 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';
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)
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)
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);
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);
}
}
/* 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;
}
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 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
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: