aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binutils/ChangeLog17
-rw-r--r--binutils/ar.c161
-rw-r--r--binutils/dlltool.c747
-rw-r--r--binutils/filemode.c12
-rw-r--r--binutils/size.c28
-rw-r--r--binutils/srconv.c145
-rw-r--r--binutils/sysdump.c92
7 files changed, 354 insertions, 848 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index b432cfe..368a769 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,20 @@
+2005-01-21 Ben Elliston <bje@au.ibm.com>
+
+ * dlltool.c (dump_iat): Remove unused function.
+ (gen_exp_file): Remove #if 0'd code.
+ (make_one_lib_file): Likewise.
+ * srconv.c: Remove #if 0'd code throughout.
+ * size.c (lprint_number): Remove.
+ (print_berkeley_format): Remove #if 0'd code.
+ * ar.c (do_quick_append): Remove declaration and definiton.
+ (main): Remove #if 0'd code.
+ * filemode.c (filemodestring): Remove #if 0'd function.
+ * sysdump.c (unit_info_list): Remove function.
+ (object_body_list): Likewise.
+ (program_structure): Likewise.
+ (debug_list): Likewise.
+ (module): Remove #if 0'd code.
+
2005-01-20 Mark Mitchell <mark@codesourcery.com>
* BRANCHES: Add binutils-2_15-branch.
diff --git a/binutils/ar.c b/binutils/ar.c
index 6cc7941..05933a1 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -65,11 +65,6 @@ static void map_over_members (bfd *, void (*)(bfd *), char **, int);
static void print_contents (bfd * member);
static void delete_members (bfd *, char **files_to_delete);
-#if 0
-static void do_quick_append
- (const char *archive_filename, char **files_to_append);
-#endif
-
static void move_members (bfd *, char **files_to_move);
static void replace_members
(bfd *, char **files_to_replace, bfd_boolean quick);
@@ -589,6 +584,10 @@ main (int argc, char **argv)
{
bfd *arch;
+ /* We don't use do_quick_append any more. Too many systems
+ expect ar to always rebuild the symbol table even when q is
+ used. */
+
/* We can't write an armap when using ar q, so just do ar r
instead. */
if (operation == quick_append && write_armap)
@@ -624,39 +623,6 @@ main (int argc, char **argv)
files = arg_index < argc ? argv + arg_index : NULL;
file_count = argc - arg_index;
-#if 0
- /* We don't use do_quick_append any more. Too many systems
- expect ar to always rebuild the symbol table even when q is
- used. */
-
- /* We can't do a quick append if we need to construct an
- extended name table, because do_quick_append won't be able to
- rebuild the name table. Unfortunately, at this point we
- don't actually know the maximum name length permitted by this
- object file format. So, we guess. FIXME. */
- if (operation == quick_append && ! ar_truncate)
- {
- char **chk;
-
- for (chk = files; chk != NULL && *chk != '\0'; chk++)
- {
- if (strlen (normalize (*chk, (bfd *) NULL)) > 14)
- {
- operation = replace;
- break;
- }
- }
- }
-
- if (operation == quick_append)
- {
- /* Note that quick appending to a non-existent archive creates it,
- even if there are no files to append. */
- do_quick_append (inarch_filename, files);
- xexit (0);
- }
-#endif
-
arch = open_inarch (inarch_filename,
files == NULL ? (char *) NULL : files[0]);
@@ -945,125 +911,6 @@ extract_file (bfd *abfd)
free (cbuf);
}
-#if 0
-
-/* We don't use this anymore. Too many systems expect ar to rebuild
- the symbol table even when q is used. */
-
-/* Just do it quickly; don't worry about dups, armap, or anything like that */
-
-static void
-do_quick_append (const char *archive_filename, char **files_to_append)
-{
- FILE *ofile, *ifile;
- char *buf = xmalloc (BUFSIZE);
- long tocopy, thistime;
- bfd *temp;
- struct stat sbuf;
- bfd_boolean newfile = FALSE;
- bfd_set_error (bfd_error_no_error);
-
- if (stat (archive_filename, &sbuf) != 0)
- {
-
-#if !defined(__GO32__) || defined(__DJGPP__)
-
- /* FIXME: I don't understand why this fragment was ifndef'ed
- away for __GO32__; perhaps it was in the days of DJGPP v1.x.
- stat() works just fine in v2.x, so I think this should be
- removed. For now, I enable it for DJGPP v2.
-
- (And yes, I know this is all unused, but somebody, someday,
- might wish to resurrect this again... -- EZ. */
-
-/* KLUDGE ALERT! Temporary fix until I figger why
- stat() is wrong ... think it's buried in GO32's IDT - Jax */
-
- if (errno != ENOENT)
- bfd_fatal (archive_filename);
-#endif
-
- newfile = TRUE;
- }
-
- ofile = fopen (archive_filename, FOPEN_AUB);
- if (ofile == NULL)
- {
- perror (program_name);
- xexit (1);
- }
-
- temp = bfd_openr (archive_filename, NULL);
- if (temp == NULL)
- {
- bfd_fatal (archive_filename);
- }
- if (!newfile)
- {
- if (!bfd_check_format (temp, bfd_archive))
- /* xgettext:c-format */
- fatal (_("%s is not an archive"), archive_filename);
- }
- else
- {
- fwrite (ARMAG, 1, SARMAG, ofile);
- if (!silent_create)
- /* xgettext:c-format */
- non_fatal (_("creating %s"), archive_filename);
- }
-
- if (ar_truncate)
- temp->flags |= BFD_TRADITIONAL_FORMAT;
-
- /* assume it's an archive, go straight to the end, sans $200 */
- fseek (ofile, 0, 2);
-
- for (; files_to_append && *files_to_append; ++files_to_append)
- {
- struct ar_hdr *hdr = bfd_special_undocumented_glue (temp, *files_to_append);
- if (hdr == NULL)
- {
- bfd_fatal (*files_to_append);
- }
-
- BFD_SEND (temp, _bfd_truncate_arname, (temp, *files_to_append, (char *) hdr));
-
- ifile = fopen (*files_to_append, FOPEN_RB);
- if (ifile == NULL)
- {
- bfd_nonfatal (*files_to_append);
- }
-
- if (stat (*files_to_append, &sbuf) != 0)
- {
- bfd_nonfatal (*files_to_append);
- }
-
- tocopy = sbuf.st_size;
-
- /* XXX should do error-checking! */
- fwrite (hdr, 1, sizeof (struct ar_hdr), ofile);
-
- while (tocopy > 0)
- {
- thistime = tocopy;
- if (thistime > BUFSIZE)
- thistime = BUFSIZE;
- fread (buf, 1, thistime, ifile);
- fwrite (buf, 1, thistime, ofile);
- tocopy -= thistime;
- }
- fclose (ifile);
- if ((sbuf.st_size % 2) == 1)
- putc ('\012', ofile);
- }
- fclose (ofile);
- bfd_close (temp);
- free (buf);
-}
-
-#endif /* 0 */
-
static void
write_archive (bfd *iarch)
{
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 8b7f9fb..3e663e5 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -694,9 +694,6 @@ static void generate_idata_ofile (FILE *);
static void assemble_file (const char *, const char *);
static void gen_exp_file (void);
static const char *xlate (const char *);
-#if 0
-static void dump_iat (FILE *, export_type *);
-#endif
static char *make_label (const char *, const char *);
static char *make_imp_label (const char *, const char *);
static bfd *make_one_lib_file (export_type *, int);
@@ -1815,14 +1812,6 @@ gen_exp_file (void)
{
if (exp->ordinal != i)
{
-#if 0
- fprintf (f, "\t%s\t%d\t%s %d..%d missing\n",
- ASM_SPACE,
- (exp->ordinal - i) * 4,
- ASM_C,
- i, exp->ordinal - 1);
- i = exp->ordinal;
-#endif
while (i < exp->ordinal)
{
fprintf(f,"\t%s\t0\n", ASM_LONG);
@@ -2034,29 +2023,6 @@ xlate (const char *name)
return name;
}
-/**********************************************************************/
-
-#if 0
-
-static void
-dump_iat (FILE *f, export_type *exp)
-{
- if (exp->noname && !show_allnames )
- {
- fprintf (f, "\t%s\t0x%08x\n",
- ASM_LONG,
- exp->ordinal | 0x80000000); /* hint or orindal ?? */
- }
- else
- {
- fprintf (f, "\t%sID%d%s\n", ASM_RVA_BEFORE,
- exp->ordinal,
- ASM_RVA_AFTER);
- }
-}
-
-#endif
-
typedef struct
{
int id;
@@ -2207,466 +2173,409 @@ make_imp_label (const char *prefix, const char *name)
static bfd *
make_one_lib_file (export_type *exp, int i)
{
-#if 0
- {
- char *name;
- FILE *f;
- const char *prefix = "d";
- char *dest;
-
- name = (char *) alloca (strlen (prefix) + 10);
- sprintf (name, "%ss%05d.s", prefix, i);
- f = fopen (name, FOPEN_WT);
- fprintf (f, "\t.text\n");
- fprintf (f, "\t%s\t%s%s\n", ASM_GLOBAL, ASM_PREFIX (exp->name), exp->name);
- if (create_compat_implib)
- fprintf (f, "\t%s\t__imp_%s\n", ASM_GLOBAL, exp->name);
- fprintf (f, "\t%s\t_imp__%s\n", ASM_GLOBAL, exp->name);
- if (create_compat_implib)
- fprintf (f, "%s%s:\n\t%s\t__imp_%s\n", ASM_PREFIX (exp->name),
- exp->name, ASM_JUMP, exp->name);
-
- fprintf (f, "\t.section\t.idata$7\t%s To force loading of head\n", ASM_C);
- fprintf (f, "\t%s\t%s\n", ASM_LONG, head_label);
-
-
- fprintf (f,"%s Import Address Table\n", ASM_C);
-
- fprintf (f, "\t.section .idata$5\n");
- if (create_compat_implib)
- fprintf (f, "__imp_%s:\n", exp->name);
- fprintf (f, "_imp__%s:\n", exp->name);
-
- dump_iat (f, exp);
-
- fprintf (f, "\n%s Import Lookup Table\n", ASM_C);
- fprintf (f, "\t.section .idata$4\n");
-
- dump_iat (f, exp);
-
- if(!exp->noname || show_allnames)
- {
- fprintf (f, "%s Hint/Name table\n", ASM_C);
- fprintf (f, "\t.section .idata$6\n");
- fprintf (f, "ID%d:\t%s\t%d\n", exp->ordinal, ASM_SHORT, exp->hint);
- fprintf (f, "\t%s\t\"%s\"\n", ASM_TEXT, xlate (exp->name));
- }
-
- fclose (f);
-
- dest = (char *) alloca (strlen (prefix) + 10);
- sprintf (dest, "%ss%05d.o", prefix, i);
- assemble_file (name, dest);
- }
-#else /* if 0 */
- {
- bfd * abfd;
- asymbol * exp_label;
- asymbol * iname = 0;
- asymbol * iname2;
- asymbol * iname_lab;
- asymbol ** iname_lab_pp;
- asymbol ** iname_pp;
+ bfd * abfd;
+ asymbol * exp_label;
+ asymbol * iname = 0;
+ asymbol * iname2;
+ asymbol * iname_lab;
+ asymbol ** iname_lab_pp;
+ asymbol ** iname_pp;
#ifdef DLLTOOL_PPC
- asymbol ** fn_pp;
- asymbol ** toc_pp;
+ asymbol ** fn_pp;
+ asymbol ** toc_pp;
#define EXTRA 2
#endif
#ifndef EXTRA
#define EXTRA 0
#endif
- asymbol * ptrs[NSECS + 4 + EXTRA + 1];
- flagword applicable;
- char * outname = xmalloc (strlen (TMP_STUB) + 10);
- int oidx = 0;
+ asymbol * ptrs[NSECS + 4 + EXTRA + 1];
+ flagword applicable;
+ char * outname = xmalloc (strlen (TMP_STUB) + 10);
+ int oidx = 0;
- sprintf (outname, "%s%05d.o", TMP_STUB, i);
+ sprintf (outname, "%s%05d.o", TMP_STUB, i);
- abfd = bfd_openw (outname, HOW_BFD_WRITE_TARGET);
+ abfd = bfd_openw (outname, HOW_BFD_WRITE_TARGET);
- if (!abfd)
- /* xgettext:c-format */
- fatal (_("bfd_open failed open stub file: %s"), outname);
+ if (!abfd)
+ /* xgettext:c-format */
+ fatal (_("bfd_open failed open stub file: %s"), outname);
- /* xgettext:c-format */
- inform (_("Creating stub file: %s"), outname);
+ /* xgettext:c-format */
+ inform (_("Creating stub file: %s"), outname);
- bfd_set_format (abfd, bfd_object);
- bfd_set_arch_mach (abfd, HOW_BFD_ARCH, 0);
+ bfd_set_format (abfd, bfd_object);
+ bfd_set_arch_mach (abfd, HOW_BFD_ARCH, 0);
#ifdef DLLTOOL_ARM
- if (machine == MARM_INTERWORK || machine == MTHUMB)
- bfd_set_private_flags (abfd, F_INTERWORK);
+ if (machine == MARM_INTERWORK || machine == MTHUMB)
+ bfd_set_private_flags (abfd, F_INTERWORK);
#endif
- applicable = bfd_applicable_section_flags (abfd);
+ applicable = bfd_applicable_section_flags (abfd);
- /* First make symbols for the sections. */
- for (i = 0; i < NSECS; i++)
- {
- sinfo *si = secdata + i;
-
- if (si->id != i)
- abort();
- si->sec = bfd_make_section_old_way (abfd, si->name);
- bfd_set_section_flags (abfd,
- si->sec,
- si->flags & applicable);
-
- bfd_set_section_alignment(abfd, si->sec, si->align);
- si->sec->output_section = si->sec;
- si->sym = bfd_make_empty_symbol(abfd);
- si->sym->name = si->sec->name;
- si->sym->section = si->sec;
- si->sym->flags = BSF_LOCAL;
- si->sym->value = 0;
- ptrs[oidx] = si->sym;
- si->sympp = ptrs + oidx;
- si->size = 0;
- si->data = NULL;
-
- oidx++;
- }
+ /* First make symbols for the sections. */
+ for (i = 0; i < NSECS; i++)
+ {
+ sinfo *si = secdata + i;
- if (! exp->data)
- {
- exp_label = bfd_make_empty_symbol (abfd);
- exp_label->name = make_imp_label ("", exp->name);
+ if (si->id != i)
+ abort();
+ si->sec = bfd_make_section_old_way (abfd, si->name);
+ bfd_set_section_flags (abfd,
+ si->sec,
+ si->flags & applicable);
+
+ bfd_set_section_alignment(abfd, si->sec, si->align);
+ si->sec->output_section = si->sec;
+ si->sym = bfd_make_empty_symbol(abfd);
+ si->sym->name = si->sec->name;
+ si->sym->section = si->sec;
+ si->sym->flags = BSF_LOCAL;
+ si->sym->value = 0;
+ ptrs[oidx] = si->sym;
+ si->sympp = ptrs + oidx;
+ si->size = 0;
+ si->data = NULL;
+
+ oidx++;
+ }
+
+ if (! exp->data)
+ {
+ exp_label = bfd_make_empty_symbol (abfd);
+ exp_label->name = make_imp_label ("", exp->name);
- /* On PowerPC, the function name points to a descriptor in
- the rdata section, the first element of which is a
- pointer to the code (..function_name), and the second
- points to the .toc. */
+ /* On PowerPC, the function name points to a descriptor in
+ the rdata section, the first element of which is a
+ pointer to the code (..function_name), and the second
+ points to the .toc. */
#ifdef DLLTOOL_PPC
- if (machine == MPPC)
- exp_label->section = secdata[RDATA].sec;
- else
+ if (machine == MPPC)
+ exp_label->section = secdata[RDATA].sec;
+ else
#endif
- exp_label->section = secdata[TEXT].sec;
+ exp_label->section = secdata[TEXT].sec;
- exp_label->flags = BSF_GLOBAL;
- exp_label->value = 0;
+ exp_label->flags = BSF_GLOBAL;
+ exp_label->value = 0;
#ifdef DLLTOOL_ARM
- if (machine == MTHUMB)
- bfd_coff_set_symbol_class (abfd, exp_label, C_THUMBEXTFUNC);
+ if (machine == MTHUMB)
+ bfd_coff_set_symbol_class (abfd, exp_label, C_THUMBEXTFUNC);
#endif
- ptrs[oidx++] = exp_label;
- }
+ ptrs[oidx++] = exp_label;
+ }
- /* Generate imp symbols with one underscore for Microsoft
- compatibility, and with two underscores for backward
- compatibility with old versions of cygwin. */
- if (create_compat_implib)
- {
- iname = bfd_make_empty_symbol (abfd);
- iname->name = make_imp_label ("___imp", exp->name);
- iname->section = secdata[IDATA5].sec;
- iname->flags = BSF_GLOBAL;
- iname->value = 0;
- }
+ /* Generate imp symbols with one underscore for Microsoft
+ compatibility, and with two underscores for backward
+ compatibility with old versions of cygwin. */
+ if (create_compat_implib)
+ {
+ iname = bfd_make_empty_symbol (abfd);
+ iname->name = make_imp_label ("___imp", exp->name);
+ iname->section = secdata[IDATA5].sec;
+ iname->flags = BSF_GLOBAL;
+ iname->value = 0;
+ }
- iname2 = bfd_make_empty_symbol (abfd);
- iname2->name = make_imp_label ("__imp_", exp->name);
- iname2->section = secdata[IDATA5].sec;
- iname2->flags = BSF_GLOBAL;
- iname2->value = 0;
+ iname2 = bfd_make_empty_symbol (abfd);
+ iname2->name = make_imp_label ("__imp_", exp->name);
+ iname2->section = secdata[IDATA5].sec;
+ iname2->flags = BSF_GLOBAL;
+ iname2->value = 0;
- iname_lab = bfd_make_empty_symbol (abfd);
+ iname_lab = bfd_make_empty_symbol (abfd);
- iname_lab->name = head_label;
- iname_lab->section = (asection *) &bfd_und_section;
- iname_lab->flags = 0;
- iname_lab->value = 0;
+ iname_lab->name = head_label;
+ iname_lab->section = (asection *) &bfd_und_section;
+ iname_lab->flags = 0;
+ iname_lab->value = 0;
- iname_pp = ptrs + oidx;
- if (create_compat_implib)
- ptrs[oidx++] = iname;
- ptrs[oidx++] = iname2;
+ iname_pp = ptrs + oidx;
+ if (create_compat_implib)
+ ptrs[oidx++] = iname;
+ ptrs[oidx++] = iname2;
- iname_lab_pp = ptrs + oidx;
- ptrs[oidx++] = iname_lab;
+ iname_lab_pp = ptrs + oidx;
+ ptrs[oidx++] = iname_lab;
#ifdef DLLTOOL_PPC
- /* The symbol referring to the code (.text). */
- {
- asymbol *function_name;
+ /* The symbol referring to the code (.text). */
+ {
+ asymbol *function_name;
- function_name = bfd_make_empty_symbol(abfd);
- function_name->name = make_label ("..", exp->name);
- function_name->section = secdata[TEXT].sec;
- function_name->flags = BSF_GLOBAL;
- function_name->value = 0;
+ function_name = bfd_make_empty_symbol(abfd);
+ function_name->name = make_label ("..", exp->name);
+ function_name->section = secdata[TEXT].sec;
+ function_name->flags = BSF_GLOBAL;
+ function_name->value = 0;
- fn_pp = ptrs + oidx;
- ptrs[oidx++] = function_name;
- }
+ fn_pp = ptrs + oidx;
+ ptrs[oidx++] = function_name;
+ }
- /* The .toc symbol. */
- {
- asymbol *toc_symbol;
+ /* The .toc symbol. */
+ {
+ asymbol *toc_symbol;
- toc_symbol = bfd_make_empty_symbol (abfd);
- toc_symbol->name = make_label (".", "toc");
- toc_symbol->section = (asection *)&bfd_und_section;
- toc_symbol->flags = BSF_GLOBAL;
- toc_symbol->value = 0;
+ toc_symbol = bfd_make_empty_symbol (abfd);
+ toc_symbol->name = make_label (".", "toc");
+ toc_symbol->section = (asection *)&bfd_und_section;
+ toc_symbol->flags = BSF_GLOBAL;
+ toc_symbol->value = 0;
- toc_pp = ptrs + oidx;
- ptrs[oidx++] = toc_symbol;
- }
+ toc_pp = ptrs + oidx;
+ ptrs[oidx++] = toc_symbol;
+ }
#endif
- ptrs[oidx] = 0;
+ ptrs[oidx] = 0;
- for (i = 0; i < NSECS; i++)
- {
- sinfo *si = secdata + i;
- asection *sec = si->sec;
- arelent *rel;
- arelent **rpp;
+ for (i = 0; i < NSECS; i++)
+ {
+ sinfo *si = secdata + i;
+ asection *sec = si->sec;
+ arelent *rel;
+ arelent **rpp;
- switch (i)
+ switch (i)
+ {
+ case TEXT:
+ if (! exp->data)
{
- case TEXT:
- if (! exp->data)
- {
- si->size = HOW_JTAB_SIZE;
- si->data = xmalloc (HOW_JTAB_SIZE);
- memcpy (si->data, HOW_JTAB, HOW_JTAB_SIZE);
-
- /* add the reloc into idata$5 */
- rel = xmalloc (sizeof (arelent));
-
- rpp = xmalloc (sizeof (arelent *) * 2);
- rpp[0] = rel;
- rpp[1] = 0;
+ si->size = HOW_JTAB_SIZE;
+ si->data = xmalloc (HOW_JTAB_SIZE);
+ memcpy (si->data, HOW_JTAB, HOW_JTAB_SIZE);
- rel->address = HOW_JTAB_ROFF;
- rel->addend = 0;
+ /* add the reloc into idata$5 */
+ rel = xmalloc (sizeof (arelent));
- if (machine == MPPC)
- {
- rel->howto = bfd_reloc_type_lookup (abfd,
- BFD_RELOC_16_GOTOFF);
- rel->sym_ptr_ptr = iname_pp;
- }
- else
- {
- rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
- rel->sym_ptr_ptr = secdata[IDATA5].sympp;
- }
- sec->orelocation = rpp;
- sec->reloc_count = 1;
- }
- break;
- case IDATA4:
- case IDATA5:
- /* An idata$4 or idata$5 is one word long, and has an
- rva to idata$6. */
+ rpp = xmalloc (sizeof (arelent *) * 2);
+ rpp[0] = rel;
+ rpp[1] = 0;
- si->data = xmalloc (4);
- si->size = 4;
+ rel->address = HOW_JTAB_ROFF;
+ rel->addend = 0;
- if (exp->noname)
+ if (machine == MPPC)
{
- si->data[0] = exp->ordinal ;
- si->data[1] = exp->ordinal >> 8;
- si->data[2] = exp->ordinal >> 16;
- si->data[3] = 0x80;
+ rel->howto = bfd_reloc_type_lookup (abfd,
+ BFD_RELOC_16_GOTOFF);
+ rel->sym_ptr_ptr = iname_pp;
}
else
{
- sec->reloc_count = 1;
- memset (si->data, 0, si->size);
- rel = xmalloc (sizeof (arelent));
- rpp = xmalloc (sizeof (arelent *) * 2);
- rpp[0] = rel;
- rpp[1] = 0;
- rel->address = 0;
- rel->addend = 0;
- rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_RVA);
- rel->sym_ptr_ptr = secdata[IDATA6].sympp;
- sec->orelocation = rpp;
+ rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
+ rel->sym_ptr_ptr = secdata[IDATA5].sympp;
}
+ sec->orelocation = rpp;
+ sec->reloc_count = 1;
+ }
+ break;
+ case IDATA4:
+ case IDATA5:
+ /* An idata$4 or idata$5 is one word long, and has an
+ rva to idata$6. */
- break;
+ si->data = xmalloc (4);
+ si->size = 4;
- case IDATA6:
- if (!exp->noname)
- {
- /* This used to add 1 to exp->hint. I don't know
- why it did that, and it does not match what I see
- in programs compiled with the MS tools. */
- int idx = exp->hint;
- si->size = strlen (xlate (exp->import_name)) + 3;
- si->data = xmalloc (si->size);
- si->data[0] = idx & 0xff;
- si->data[1] = idx >> 8;
- strcpy (si->data + 2, xlate (exp->import_name));
- }
- break;
- case IDATA7:
- si->size = 4;
- si->data = xmalloc (4);
+ if (exp->noname)
+ {
+ si->data[0] = exp->ordinal ;
+ si->data[1] = exp->ordinal >> 8;
+ si->data[2] = exp->ordinal >> 16;
+ si->data[3] = 0x80;
+ }
+ else
+ {
+ sec->reloc_count = 1;
memset (si->data, 0, si->size);
rel = xmalloc (sizeof (arelent));
rpp = xmalloc (sizeof (arelent *) * 2);
rpp[0] = rel;
+ rpp[1] = 0;
rel->address = 0;
rel->addend = 0;
rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_RVA);
- rel->sym_ptr_ptr = iname_lab_pp;
+ rel->sym_ptr_ptr = secdata[IDATA6].sympp;
sec->orelocation = rpp;
- sec->reloc_count = 1;
- break;
-
-#ifdef DLLTOOL_PPC
- case PDATA:
- {
- /* The .pdata section is 5 words long.
- Think of it as:
- struct
- {
- bfd_vma BeginAddress, [0x00]
- EndAddress, [0x04]
- ExceptionHandler, [0x08]
- HandlerData, [0x0c]
- PrologEndAddress; [0x10]
- }; */
-
- /* So this pdata section setups up this as a glue linkage to
- a dll routine. There are a number of house keeping things
- we need to do:
-
- 1. In the name of glue trickery, the ADDR32 relocs for 0,
- 4, and 0x10 are set to point to the same place:
- "..function_name".
- 2. There is one more reloc needed in the pdata section.
- The actual glue instruction to restore the toc on
- return is saved as the offset in an IMGLUE reloc.
- So we need a total of four relocs for this section.
-
- 3. Lastly, the HandlerData field is set to 0x03, to indicate
- that this is a glue routine. */
- arelent *imglue, *ba_rel, *ea_rel, *pea_rel;
-
- /* Alignment must be set to 2**2 or you get extra stuff. */
- bfd_set_section_alignment(abfd, sec, 2);
-
- si->size = 4 * 5;
- si->data = xmalloc (si->size);
- memset (si->data, 0, si->size);
- rpp = xmalloc (sizeof (arelent *) * 5);
- rpp[0] = imglue = xmalloc (sizeof (arelent));
- rpp[1] = ba_rel = xmalloc (sizeof (arelent));
- rpp[2] = ea_rel = xmalloc (sizeof (arelent));
- rpp[3] = pea_rel = xmalloc (sizeof (arelent));
- rpp[4] = 0;
-
- /* Stick the toc reload instruction in the glue reloc. */
- bfd_put_32(abfd, ppc_glue_insn, (char *) &imglue->address);
-
- imglue->addend = 0;
- imglue->howto = bfd_reloc_type_lookup (abfd,
- BFD_RELOC_32_GOTOFF);
- imglue->sym_ptr_ptr = fn_pp;
-
- ba_rel->address = 0;
- ba_rel->addend = 0;
- ba_rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
- ba_rel->sym_ptr_ptr = fn_pp;
-
- bfd_put_32 (abfd, 0x18, si->data + 0x04);
- ea_rel->address = 4;
- ea_rel->addend = 0;
- ea_rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
- ea_rel->sym_ptr_ptr = fn_pp;
-
- /* Mark it as glue. */
- bfd_put_32 (abfd, 0x03, si->data + 0x0c);
-
- /* Mark the prolog end address. */
- bfd_put_32 (abfd, 0x0D, si->data + 0x10);
- pea_rel->address = 0x10;
- pea_rel->addend = 0;
- pea_rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
- pea_rel->sym_ptr_ptr = fn_pp;
-
- sec->orelocation = rpp;
- sec->reloc_count = 4;
- break;
- }
- case RDATA:
- /* Each external function in a PowerPC PE file has a two word
- descriptor consisting of:
- 1. The address of the code.
- 2. The address of the appropriate .toc
- We use relocs to build this. */
- si->size = 8;
- si->data = xmalloc (8);
- memset (si->data, 0, si->size);
-
- rpp = xmalloc (sizeof (arelent *) * 3);
- rpp[0] = rel = xmalloc (sizeof (arelent));
- rpp[1] = xmalloc (sizeof (arelent));
- rpp[2] = 0;
-
- rel->address = 0;
- rel->addend = 0;
- rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
- rel->sym_ptr_ptr = fn_pp;
+ }
- rel = rpp[1];
+ break;
- rel->address = 4;
- rel->addend = 0;
- rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
- rel->sym_ptr_ptr = toc_pp;
+ case IDATA6:
+ if (!exp->noname)
+ {
+ /* This used to add 1 to exp->hint. I don't know
+ why it did that, and it does not match what I see
+ in programs compiled with the MS tools. */
+ int idx = exp->hint;
+ si->size = strlen (xlate (exp->import_name)) + 3;
+ si->data = xmalloc (si->size);
+ si->data[0] = idx & 0xff;
+ si->data[1] = idx >> 8;
+ strcpy (si->data + 2, xlate (exp->import_name));
+ }
+ break;
+ case IDATA7:
+ si->size = 4;
+ si->data = xmalloc (4);
+ memset (si->data, 0, si->size);
+ rel = xmalloc (sizeof (arelent));
+ rpp = xmalloc (sizeof (arelent *) * 2);
+ rpp[0] = rel;
+ rel->address = 0;
+ rel->addend = 0;
+ rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_RVA);
+ rel->sym_ptr_ptr = iname_lab_pp;
+ sec->orelocation = rpp;
+ sec->reloc_count = 1;
+ break;
- sec->orelocation = rpp;
- sec->reloc_count = 2;
- break;
+#ifdef DLLTOOL_PPC
+ case PDATA:
+ {
+ /* The .pdata section is 5 words long.
+ Think of it as:
+ struct
+ {
+ bfd_vma BeginAddress, [0x00]
+ EndAddress, [0x04]
+ ExceptionHandler, [0x08]
+ HandlerData, [0x0c]
+ PrologEndAddress; [0x10]
+ }; */
+
+ /* So this pdata section setups up this as a glue linkage to
+ a dll routine. There are a number of house keeping things
+ we need to do:
+
+ 1. In the name of glue trickery, the ADDR32 relocs for 0,
+ 4, and 0x10 are set to point to the same place:
+ "..function_name".
+ 2. There is one more reloc needed in the pdata section.
+ The actual glue instruction to restore the toc on
+ return is saved as the offset in an IMGLUE reloc.
+ So we need a total of four relocs for this section.
+
+ 3. Lastly, the HandlerData field is set to 0x03, to indicate
+ that this is a glue routine. */
+ arelent *imglue, *ba_rel, *ea_rel, *pea_rel;
+
+ /* Alignment must be set to 2**2 or you get extra stuff. */
+ bfd_set_section_alignment(abfd, sec, 2);
+
+ si->size = 4 * 5;
+ si->data = xmalloc (si->size);
+ memset (si->data, 0, si->size);
+ rpp = xmalloc (sizeof (arelent *) * 5);
+ rpp[0] = imglue = xmalloc (sizeof (arelent));
+ rpp[1] = ba_rel = xmalloc (sizeof (arelent));
+ rpp[2] = ea_rel = xmalloc (sizeof (arelent));
+ rpp[3] = pea_rel = xmalloc (sizeof (arelent));
+ rpp[4] = 0;
+
+ /* Stick the toc reload instruction in the glue reloc. */
+ bfd_put_32(abfd, ppc_glue_insn, (char *) &imglue->address);
+
+ imglue->addend = 0;
+ imglue->howto = bfd_reloc_type_lookup (abfd,
+ BFD_RELOC_32_GOTOFF);
+ imglue->sym_ptr_ptr = fn_pp;
+
+ ba_rel->address = 0;
+ ba_rel->addend = 0;
+ ba_rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
+ ba_rel->sym_ptr_ptr = fn_pp;
+
+ bfd_put_32 (abfd, 0x18, si->data + 0x04);
+ ea_rel->address = 4;
+ ea_rel->addend = 0;
+ ea_rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
+ ea_rel->sym_ptr_ptr = fn_pp;
+
+ /* Mark it as glue. */
+ bfd_put_32 (abfd, 0x03, si->data + 0x0c);
+
+ /* Mark the prolog end address. */
+ bfd_put_32 (abfd, 0x0D, si->data + 0x10);
+ pea_rel->address = 0x10;
+ pea_rel->addend = 0;
+ pea_rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
+ pea_rel->sym_ptr_ptr = fn_pp;
+
+ sec->orelocation = rpp;
+ sec->reloc_count = 4;
+ break;
+ }
+ case RDATA:
+ /* Each external function in a PowerPC PE file has a two word
+ descriptor consisting of:
+ 1. The address of the code.
+ 2. The address of the appropriate .toc
+ We use relocs to build this. */
+ si->size = 8;
+ si->data = xmalloc (8);
+ memset (si->data, 0, si->size);
+
+ rpp = xmalloc (sizeof (arelent *) * 3);
+ rpp[0] = rel = xmalloc (sizeof (arelent));
+ rpp[1] = xmalloc (sizeof (arelent));
+ rpp[2] = 0;
+
+ rel->address = 0;
+ rel->addend = 0;
+ rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
+ rel->sym_ptr_ptr = fn_pp;
+
+ rel = rpp[1];
+
+ rel->address = 4;
+ rel->addend = 0;
+ rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32);
+ rel->sym_ptr_ptr = toc_pp;
+
+ sec->orelocation = rpp;
+ sec->reloc_count = 2;
+ break;
#endif /* DLLTOOL_PPC */
- }
}
+ }
+ {
+ bfd_vma vma = 0;
+ /* Size up all the sections. */
+ for (i = 0; i < NSECS; i++)
{
- bfd_vma vma = 0;
- /* Size up all the sections. */
- for (i = 0; i < NSECS; i++)
- {
- sinfo *si = secdata + i;
-
- bfd_set_section_size (abfd, si->sec, si->size);
- bfd_set_section_vma (abfd, si->sec, vma);
+ sinfo *si = secdata + i;
-/* vma += si->size;*/
- }
+ bfd_set_section_size (abfd, si->sec, si->size);
+ bfd_set_section_vma (abfd, si->sec, vma);
}
- /* Write them out. */
- for (i = 0; i < NSECS; i++)
- {
- sinfo *si = secdata + i;
-
- if (i == IDATA5 && no_idata5)
- continue;
+ }
+ /* Write them out. */
+ for (i = 0; i < NSECS; i++)
+ {
+ sinfo *si = secdata + i;
- if (i == IDATA4 && no_idata4)
- continue;
+ if (i == IDATA5 && no_idata5)
+ continue;
- bfd_set_section_contents (abfd, si->sec,
- si->data, 0,
- si->size);
- }
+ if (i == IDATA4 && no_idata4)
+ continue;
- bfd_set_symtab (abfd, ptrs, oidx);
- bfd_close (abfd);
- abfd = bfd_openr (outname, HOW_BFD_READ_TARGET);
- return abfd;
+ bfd_set_section_contents (abfd, si->sec,
+ si->data, 0,
+ si->size);
}
-#endif
+
+ bfd_set_symtab (abfd, ptrs, oidx);
+ bfd_close (abfd);
+ abfd = bfd_openr (outname, HOW_BFD_READ_TARGET);
+ return abfd;
}
static bfd *
diff --git a/binutils/filemode.c b/binutils/filemode.c
index 8b438a9..687b787 100644
--- a/binutils/filemode.c
+++ b/binutils/filemode.c
@@ -59,18 +59,6 @@ static void setst (unsigned long, char *);
otherwise.
'T' if the file is sticky but not executable. */
-#if 0
-
-/* This is not used; only mode_string is used. */
-
-void
-filemodestring (struct stat *statp, char *str)
-{
- mode_string ((unsigned long) statp->st_mode, str);
-}
-
-#endif
-
/* Get definitions for the file permission bits. */
#ifndef S_IRWXU
diff --git a/binutils/size.c b/binutils/size.c
index 4beb0a3..aeb7994 100644
--- a/binutils/size.c
+++ b/binutils/size.c
@@ -66,9 +66,6 @@ static void display_file (char *);
static void display_bfd (bfd *);
static void display_archive (bfd *);
static int size_number (bfd_size_type);
-#if 0
-static void lprint_number (int, bfd_size_type);
-#endif
static void rprint_number (int, bfd_size_type);
static void print_berkeley_format (bfd *);
static void sysv_internal_sizer (bfd *, asection *, void *);
@@ -382,25 +379,6 @@ size_number (bfd_size_type num)
return strlen (buffer);
}
-#if 0
-
-/* This is not used. */
-
-static void
-lprint_number (int width, bfd_size_type num)
-{
- char buffer[40];
-
- sprintf (buffer,
- (radix == decimal ? "%lu" :
- ((radix == octal) ? "0%lo" : "0x%lx")),
- (unsigned long) num);
-
- printf ("%-*s", width, buffer);
-}
-
-#endif
-
static void
rprint_number (int width, bfd_size_type num)
{
@@ -451,14 +429,8 @@ print_berkeley_format (bfd *abfd)
bfd_map_over_sections (abfd, berkeley_sum, NULL);
if (files_seen++ == 0)
-#if 0
- /* Intel doesn't like bss/stk because they don't have core files. */
- puts ((radix == octal) ? " text\t data\tbss/stk\t oct\t hex\tfilename" :
- " text\t data\tbss/stk\t dec\t hex\tfilename");
-#else
puts ((radix == octal) ? " text\t data\t bss\t oct\t hex\tfilename" :
" text\t data\t bss\t dec\t hex\tfilename");
-#endif
total = textsize + datasize + bsssize;
diff --git a/binutils/srconv.c b/binutils/srconv.c
index 1517b1c..6f6fc5c 100644
--- a/binutils/srconv.c
+++ b/binutils/srconv.c
@@ -317,12 +317,8 @@ wr_un (struct coff_ofile *ptr, struct coff_sfile *sfile, int first,
un.format = FORMAT_OM;
un.spare1 = 0;
-#if 1
- un.nsections = ptr->nsections - 1; /* Don't count the abs section. */
-#else
- /*NEW - only count sections with size. */
- un.nsections = nsecs;
-#endif
+ /* Don't count the abs section. */
+ un.nsections = ptr->nsections - 1;
un.nextdefs = 0;
un.nextrefs = 0;
@@ -1208,11 +1204,6 @@ wr_du (struct coff_ofile *p, struct coff_sfile *sfile, int n)
{
struct IT_du du;
int lim;
-#if 0
- struct coff_symbol *symbol;
- static int incit = 0x500000;
- int used = 0;
-#endif
int i;
int j;
unsigned int *lowest = (unsigned *) nints (p->nsections);
@@ -1234,47 +1225,6 @@ wr_du (struct coff_ofile *p, struct coff_sfile *sfile, int n)
highest[i] = 0;
}
- /* Look through all the symbols and try and work out the extents in this
- source file. */
-#if 0
- for (symbol = sfile->scope->vars_head;
- symbol;
- symbol = symbol->next)
- {
- if (symbol->type->type == coff_secdef_type)
- {
- unsigned int low = symbol->where->offset;
- unsigned int high = symbol->where->offset + symbol->type->size - 1;
- struct coff_section *section = symbol->where->section;
-
- int sn = section->number;
- if (low < lowest[sn])
- lowest[sn] = low;
- if (high > highest[sn])
- highest[sn] = high;
- }
- }
-
- for (i = 0; i < du.sections; i++)
- {
- if (highest[i] == 0)
- lowest[i] = highest[i] = incit;
-
- du.san[used] = i;
- du.length[used] = highest[i] - lowest[i];
- du.address[used] = bfd_get_file_flags (abfd) & EXEC_P ? lowest[i] : 0;
-
- if (debug)
- {
- printf (" section %6s 0x%08x..0x%08x\n",
- p->sections[i + 1].name,
- lowest[i],
- highest[i]);
- }
- used++;
- }
-#endif
-
lim = du.sections;
for (j = 0; j < lim; j++)
{
@@ -1328,22 +1278,8 @@ wr_dus (struct coff_ofile *p ATTRIBUTE_UNUSED, struct coff_sfile *sfile)
dus.spare = nints (dus.ns);
dus.ndir = 0;
/* Find the filenames. */
-#if 0
- i = 0;
-
- for (sfile = p->source_head;
- sfile;
- sfile = sfile->next)
- {
- dus.drb[i] = 0;
- dus.spare[i] = 0;
- dus.fname[i] = sfile->name;
- i++;
- }
-#else
dus.drb[0] = 0;
dus.fname[0] = sfile->name;
-#endif
sysroff_swap_dus_out (file, &dus);
@@ -1362,69 +1298,6 @@ static void
wr_dln (struct coff_ofile *p ATTRIBUTE_UNUSED, struct coff_sfile *sfile,
int n ATTRIBUTE_UNUSED)
{
-#if 0
- if (n == 0)
- {
- /* Count up all the linenumbers */
- struct coff_symbol *sy;
- int lc = 0;
- struct IT_dln dln;
-
- int idx;
-
- for (sy = p->symbol_list_head;
- sy;
- sy = sy->next_in_ofile_list)
- {
- struct coff_type *t = sy->type;
- if (t->type == coff_function_type)
- {
- struct coff_line *l = t->u.function.lines;
- lc += l->nlines;
- }
- }
-
- dln.sfn = nints (lc);
- dln.sln = nints (lc);
- dln.lln = nints (lc);
- dln.section = nints (lc);
-
- dln.from_address = nints (lc);
- dln.to_address = nints (lc);
-
-
- dln.neg = 0x1001;
-
- dln.nln = lc;
-
- /* Run through once more and fill up the structure */
- idx = 0;
- for (sy = p->symbol_list_head;
- sy;
- sy = sy->next_in_ofile_list)
- {
- if (sy->type->type == coff_function_type)
- {
- int i;
- struct coff_line *l = sy->type->u.function.lines;
- for (i = 0; i < l->nlines; i++)
- {
- dln.section[idx] = sy->where->section->number;
- dln.sfn[idx] = n;
- dln.sln[idx] = l->lines[i];
- dln.from_address[idx] = l->addresses[i];
- if (idx)
- dln.to_address[idx - 1] = dln.from_address[idx];
- idx++;
- }
- }
- n++;
- }
- sysroff_swap_dln_out (file, &dln);
- }
-
-#endif
-#if 1
/* Count up all the linenumbers */
struct coff_symbol *sy;
@@ -1491,7 +1364,6 @@ wr_dln (struct coff_ofile *p ATTRIBUTE_UNUSED, struct coff_sfile *sfile,
}
if (lc)
sysroff_swap_dln_out (file, &dln);
-#endif
}
/* Write the global symbols out to the debug info. */
@@ -1692,16 +1564,9 @@ wr_sc (struct coff_ofile *ptr, struct coff_sfile *sfile)
{
sc.contents = CONTENTS_CODE;
}
-#if 0
- /* NEW */
- if (sc.length)
- {
-#endif
- sysroff_swap_sc_out (file, &sc);
- scount++;
-#if 0
- }
-#endif
+
+ sysroff_swap_sc_out (file, &sc);
+ scount++;
}
return scount;
}
diff --git a/binutils/sysdump.c b/binutils/sysdump.c
index a1df1e0..e75de84 100644
--- a/binutils/sysdump.c
+++ b/binutils/sysdump.c
@@ -515,48 +515,6 @@ opt (int x)
return getone (x);
}
-#if 0
-
-/* This is no longer used. */
-
-static void
-unit_info_list (void)
-{
- while (opt (IT_un_CODE))
- {
- getone (IT_us_CODE);
-
- while (getone (IT_sc_CODE))
- getone (IT_ss_CODE);
-
- while (getone (IT_er_CODE))
- ;
-
- while (getone (IT_ed_CODE))
- ;
- }
-}
-
-#endif
-
-#if 0
-
-/* This is no longer used. */
-
-static void
-object_body_list (void)
-{
- while (getone (IT_sh_CODE))
- {
- while (getone (IT_ob_CODE))
- ;
- while (getone (IT_rl_CODE))
- ;
- }
-}
-
-#endif
-
static void
must (int x)
{
@@ -649,45 +607,6 @@ derived_type (void)
tab (-1, "");
}
-#if 0
-
-/* This is no longer used. */
-
-static void
-program_structure (void)
-{
- tab (1, "PROGRAM STRUCTURE");
- while (opt (IT_dps_CODE))
- {
- must (IT_dso_CODE);
- opt (IT_dss_CODE);
- dump_symbol_info ();
- must (IT_dps_CODE);
- }
- tab (-1, "");
-}
-
-#endif
-
-#if 0
-
-/* This is no longer used. */
-
-static void
-debug_list (void)
-{
- tab (1, "DEBUG LIST");
-
- must (IT_du_CODE);
- opt (IT_dus_CODE);
- program_structure ();
- must (IT_dln_CODE);
-
- tab (-1, "");
-}
-
-#endif
-
static void
module (void)
{
@@ -705,17 +624,6 @@ module (void)
}
while (getone (c) && c != IT_tr_CODE);
-#if 0
- must (IT_cs_CODE);
- must (IT_hd_CODE);
- opt (IT_hs_CODE);
-
- unit_info_list ();
- object_body_list ();
- debug_list ();
-
- must (IT_tr_CODE);
-#endif
tab (-1, "");
c = getc (file);