* binutils cleanups
@ 2005-01-21 4:51 Ben Elliston
2005-01-21 4:57 ` Ian Lance Taylor
0 siblings, 1 reply; 3+ messages in thread
From: Ben Elliston @ 2005-01-21 4:51 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 19147 bytes --]
This removes a handful of #if 0 chunks from the binutils directory.
I've used diff -w here because one function collapsed to a single C
block, whose surrounding braces I removed and reindented.
Okay for mainline?
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.
Index: ar.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/ar.c,v
retrieving revision 1.36
diff -u -p -w -r1.36 ar.c
--- ar.c 26 Oct 2004 08:08:21 -0000 1.36
+++ ar.c 21 Jan 2005 04:50:28 -0000
@@ -65,11 +65,6 @@ static void map_over_members (bfd *, voi
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);
@@ -624,39 +619,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]);
@@ -944,125 +906,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)
Index: dlltool.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/dlltool.c,v
retrieving revision 1.57
diff -u -p -w -r1.57 dlltool.c
--- dlltool.c 16 Jan 2005 09:25:06 -0000 1.57
+++ dlltool.c 21 Jan 2005 04:50:28 -0000
@@ -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,59 +2173,6 @@ make_imp_label (const char *prefix, cons
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;
@@ -2641,8 +2554,6 @@ make_one_lib_file (export_type *exp, int
bfd_set_section_size (abfd, si->sec, si->size);
bfd_set_section_vma (abfd, si->sec, vma);
-
-/* vma += si->size;*/
}
}
/* Write them out. */
@@ -2665,8 +2576,6 @@ make_one_lib_file (export_type *exp, int
bfd_close (abfd);
abfd = bfd_openr (outname, HOW_BFD_READ_TARGET);
return abfd;
- }
-#endif
}
static bfd *
Index: filemode.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/filemode.c,v
retrieving revision 1.6
diff -u -p -w -r1.6 filemode.c
--- filemode.c 6 Dec 2003 00:06:12 -0000 1.6
+++ filemode.c 21 Jan 2005 04:50:28 -0000
@@ -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
Index: size.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/size.c,v
retrieving revision 1.19
diff -u -p -w -r1.19 size.c
--- size.c 15 Jun 2004 01:19:13 -0000 1.19
+++ size.c 21 Jan 2005 04:50:28 -0000
@@ -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;
Index: srconv.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/srconv.c,v
retrieving revision 1.13
diff -u -p -w -r1.13 srconv.c
--- srconv.c 18 Oct 2004 14:04:40 -0000 1.13
+++ srconv.c 21 Jan 2005 04:50:28 -0000
@@ -317,12 +317,8 @@ wr_un (struct coff_ofile *ptr, struct co
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
{
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
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_U
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_U
}
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 co
{
sc.contents = CONTENTS_CODE;
}
-#if 0
- /* NEW */
- if (sc.length)
- {
-#endif
+
sysroff_swap_sc_out (file, &sc);
scount++;
-#if 0
- }
-#endif
}
return scount;
}
Index: sysdump.c
===================================================================
RCS file: /home/bje/src-cvs/src/binutils/sysdump.c,v
retrieving revision 1.11
diff -u -p -w -r1.11 sysdump.c
--- sysdump.c 14 Sep 2003 12:20:17 -0000 1.11
+++ sysdump.c 21 Jan 2005 04:50:28 -0000
@@ -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);
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: binutils cleanups
2005-01-21 4:51 binutils cleanups Ben Elliston
@ 2005-01-21 4:57 ` Ian Lance Taylor
2005-01-21 5:34 ` Ben Elliston
0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2005-01-21 4:57 UTC (permalink / raw)
To: Ben Elliston; +Cc: binutils
"Ben Elliston" <bje@au1.ibm.com> writes:
> -#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. */
Keep this comment.
Otherwise OK.
Thanks.
Ian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: binutils cleanups
2005-01-21 4:57 ` Ian Lance Taylor
@ 2005-01-21 5:34 ` Ben Elliston
0 siblings, 0 replies; 3+ messages in thread
From: Ben Elliston @ 2005-01-21 5:34 UTC (permalink / raw)
To: binutils; +Cc: ian
[-- Attachment #1: Type: text/plain, Size: 117 bytes --]
On Thu, Jan 20, 2005 at 11:56:49PM -0500, Ian Lance Taylor wrote:
> Otherwise OK.
Thanks; committing shortly.
Ben
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-01-21 5:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-21 4:51 binutils cleanups Ben Elliston
2005-01-21 4:57 ` Ian Lance Taylor
2005-01-21 5:34 ` Ben Elliston
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).