aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorSteve Chamberlain <sac@cygnus>1992-01-24 22:49:24 +0000
committerSteve Chamberlain <sac@cygnus>1992-01-24 22:49:24 +0000
commitd20f480f8a9eb7ea0261b5343c02e88f5a3d6dff (patch)
treecedde9f993b3348605396fead8108e54b17e95ac /binutils
parente98e6ec1117b83defce2b1ccce6fd4ec3877bbfb (diff)
downloadfsf-binutils-gdb-d20f480f8a9eb7ea0261b5343c02e88f5a3d6dff.zip
fsf-binutils-gdb-d20f480f8a9eb7ea0261b5343c02e88f5a3d6dff.tar.gz
fsf-binutils-gdb-d20f480f8a9eb7ea0261b5343c02e88f5a3d6dff.tar.bz2
* copy.c, nm.c, objdump.c, size.c : changed to use the
new reloc scheme.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog12
-rw-r--r--binutils/copy.c5
-rw-r--r--binutils/nm.c6
-rw-r--r--binutils/objdump.c192
4 files changed, 117 insertions, 98 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 76d683b..74f6b3b 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,15 @@
+Fri Jan 24 14:47:53 1992 Steve Chamberlain (sac at rtl.cygnus.com)
+
+ * copy.c, nm.c, objdump.c, size.c : changed to use the
+ new reloc scheme.
+
+
+Mon Dec 30 18:34:41 1991 Per Bothner (bothner at cygnus.com)
+
+ * bucomm.c (print_arelt_descr): Tweek the output format
+ so that 'ar tv' output follows Posix 1003.2/D11.
+ Output is now also identical to Sun's (except __.SYMDEF).
+
Mon Dec 30 06:09:53 1991 John Gilmore (gnu at cygnus.com)
* Makefile.in: Make `make' output more readable.
diff --git a/binutils/copy.c b/binutils/copy.c
index b61d003..12d2f35 100644
--- a/binutils/copy.c
+++ b/binutils/copy.c
@@ -344,7 +344,7 @@ copy_sections(ibfd, isection, obfd)
osection = bfd_get_section_by_name(obfd,
bfd_section_name(ibfd, isection));
- size = isection->size;
+ size = bfd_get_section_size_before_reloc(isection);
if (size == 0)
return;
@@ -360,6 +360,9 @@ copy_sections(ibfd, isection, obfd)
bfd_set_reloc(obfd, osection, relpp, relcount);
}
+ isection->_cooked_size = isection->_raw_size;
+ isection->reloc_done =true;
+
if (bfd_get_section_flags(ibfd, isection) & SEC_HAS_CONTENTS)
{
diff --git a/binutils/nm.c b/binutils/nm.c
index f0636c3..e6ab17f 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -19,9 +19,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "sysdep.h"
+#include "bucomm.h"
#include "getopt.h"
#include "aout/stab_gnu.h"
-#include <ranlib.h>
+#include "aout/ranlib.h"
@@ -247,7 +248,7 @@ do_one_rel_file (abfd)
}
/* Symbol-sorting predicates */
-#define valueof(x) ((x)->section ? (x)->section->vma + (x)->value : (x)->value)
+#define valueof(x) (x)->section->vma + (x)->value
int
numeric_forward (x, y)
char *x;
@@ -336,7 +337,6 @@ print_symbols (abfd, syms, symcount)
unsigned long symcount;
{
asymbol **sym = syms, **end = syms + symcount;
- char class;
for (; sym < end; ++sym) {
if (file_on_each_line) printf("%s:", bfd_get_filename(abfd));
diff --git a/binutils/objdump.c b/binutils/objdump.c
index d8dcb3f..d8d52f2 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1,12 +1,11 @@
-/*** objdump.c -- dump information about an object file. */
-
-/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
+/* objdump.c -- dump information about an object file.
+ Copyright (C) 1990, 1991 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Diddler.
BFD is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
+the Free Software Foundation; either version 2, or (at your option)
any later version.
BFD is distributed in the hope that it will be useful,
@@ -26,8 +25,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
* the system 5 program's reference manual
*/
-#include "sysdep.h"
#include "bfd.h"
+#include "sysdep.h"
#include "getopt.h"
#include <stdio.h>
#include <ctype.h>
@@ -106,7 +105,7 @@ bfd *abfd;
printf("SECTION %d [%s]\t: size %08x",
section->index,
section->name,
- (unsigned) section->size);
+ (unsigned) bfd_get_section_size_before_reloc(section));
printf(" vma ");
printf_vma(section->vma);
printf(" align 2**%u\n ",
@@ -129,25 +128,26 @@ bfd *abfd;
}
static asymbol **
-slurp_symtab(abfd)
-bfd *abfd;
+DEFUN(slurp_symtab,(abfd),
+ bfd *abfd)
{
- asymbol **sy;
- if (!(bfd_get_file_flags (abfd) & HAS_SYMS)) {
- (void) printf ("No symbols in \"%s\".\n", bfd_get_filename (abfd));
- return(NULL);
- }
+ asymbol **sy = (asymbol **)NULL;
+
+ if (!(bfd_get_file_flags (abfd) & HAS_SYMS)) {
+ (void) printf ("No symbols in \"%s\".\n", bfd_get_filename (abfd));
+ return(NULL);
+ }
- storage = get_symtab_upper_bound (abfd);
- if (storage) {
- sy = (asymbol **) malloc (storage);
- if (sy == NULL) {
- fprintf (stderr, "%s: out of memory.\n", program_name);
- exit (1);
- }
- }
- symcount = bfd_canonicalize_symtab (abfd, sy);
- return sy;
+ storage = get_symtab_upper_bound (abfd);
+ if (storage) {
+ sy = (asymbol **) malloc (storage);
+ if (sy == NULL) {
+ fprintf (stderr, "%s: out of memory.\n", program_name);
+ exit (1);
+ }
+ }
+ symcount = bfd_canonicalize_symtab (abfd, sy);
+ return sy;
}
/* Sort symbols into value order */
static int comp(ap,bp)
@@ -221,12 +221,12 @@ FILE *stream;
match_name = syms[thisplace+1]->name;
/* Totally awesome! the exact right symbol */
fprintf_vma(stream, vma);
- fprintf(stream," (%s)", syms[thisplace]->name);
+ fprintf(stream," (%s+)0000", syms[thisplace]->name);
return;
}
}
- /* We've run out of places to look, print the symbol before this one */
- /* see if this or the symbol before describes this location the best */
+ /* We've run out of places to look, print the symbol before this one
+ see if this or the symbol before describes this location the best */
if (thisplace != 0) {
if (syms[thisplace-1]->value - vma >
@@ -235,16 +235,16 @@ FILE *stream;
thisplace --;
}
}
-
+
fprintf_vma(stream, vma);
if (syms[thisplace]->value > vma) {
fprintf(stream," (%s-)", syms[thisplace]->name);
- fprintf_vma(stream, syms[thisplace]->value - vma);
+ fprintf(stream,"%04x", syms[thisplace]->value - vma);
}
else {
fprintf(stream," (%s+)", syms[thisplace]->name);
- fprintf_vma(stream, vma - syms[thisplace]->value);
+ fprintf(stream, "%04x", vma - syms[thisplace]->value);
}
@@ -259,22 +259,20 @@ bfd *abfd;
bfd_arch_info_type *info ;
bfd_size_type datasize = 0;
bfd_size_type i;
- unsigned int (*print)() ;
+ unsigned int (*print)() =0;
unsigned int print_insn_m68k();
unsigned int print_insn_a29k();
unsigned int print_insn_i960();
unsigned int print_insn_sparc();
unsigned int print_insn_h8300();
enum bfd_architecture a;
- unsigned long m;
+
asection *section;
/* Replace symbol section relative values with abs values */
boolean done_dot = false;
for (i = 0; i < symcount; i++) {
- if (syms[i]->section != (asection *)NULL) {
syms[i]->value += syms[i]->section->vma;
- }
}
/* We keep a copy of the symbols in the original order */
@@ -343,21 +341,21 @@ bfd *abfd;
if (only == (char *)NULL || strcmp(only,section->name) == 0){
printf("Disassembly of section %s:\n", section->name);
- if (section->size == 0) continue;
+ if (bfd_get_section_size_before_reloc(section) == 0) continue;
- data = (bfd_byte *)malloc(section->size);
+ data = (bfd_byte *)malloc(bfd_get_section_size_before_reloc(section));
if (data == (bfd_byte *)NULL) {
fprintf (stderr, "%s: memory exhausted.\n", program_name);
exit (1);
}
- datasize = section->size;
+ datasize = bfd_get_section_size_before_reloc(section);
- bfd_get_section_contents (abfd, section, data, 0, section->size);
+ bfd_get_section_contents (abfd, section, data, 0, bfd_get_section_size_before_reloc(section));
i = 0;
- while (i <section->size) {
+ while (i <bfd_get_section_size_before_reloc(section)) {
if (data[i] ==0 && data[i+1] == 0 && data[i+2] == 0 &&
data[i+3] == 0) {
if (done_dot == false) {
@@ -501,7 +499,7 @@ dump_data (abfd)
bfd *abfd;
{
asection *section;
- bfd_byte *data ;
+ bfd_byte *data = 0;
bfd_size_type datasize = 0;
bfd_size_type i;
@@ -516,22 +514,22 @@ dump_data (abfd)
printf("Contents of section %s:\n", section->name);
- if (section->size == 0) continue;
- data = (bfd_byte *)malloc(section->size);
+ if (bfd_get_section_size_before_reloc(section) == 0) continue;
+ data = (bfd_byte *)malloc(bfd_get_section_size_before_reloc(section));
if (data == (bfd_byte *)NULL) {
fprintf (stderr, "%s: memory exhausted.\n", program_name);
exit (1);
}
- datasize = section->size;
+ datasize = bfd_get_section_size_before_reloc(section);
- bfd_get_section_contents (abfd, section, (PTR)data, 0, section->size);
+ bfd_get_section_contents (abfd, section, (PTR)data, 0, bfd_get_section_size_before_reloc(section));
- for (i= 0; i < section->size; i += onaline) {
+ for (i= 0; i < bfd_get_section_size_before_reloc(section); i += onaline) {
bfd_size_type j;
printf(" %04lx ", (unsigned long int)(i + section->vma));
for (j = i; j < i+ onaline; j++) {
- if (j < section->size)
+ if (j < bfd_get_section_size_before_reloc(section))
printf("%02x", (unsigned)(data[j]));
else
printf(" ");
@@ -540,7 +538,7 @@ dump_data (abfd)
printf(" ");
for (j = i; j < i+onaline ; j++) {
- if (j >= section->size)
+ if (j >= bfd_get_section_size_before_reloc(section))
printf(" ");
else
printf("%c", isprint(data[j]) ?data[j] : '.');
@@ -590,59 +588,65 @@ bfd *abfd;
unsigned int relcount;
asection *a;
for (a = abfd->sections; a != (asection *)NULL; a = a->next) {
- printf("RELOCATION RECORDS FOR [%s]:",a->name);
+ if (a == &bfd_abs_section) continue;
+ if (a == &bfd_und_section) continue;
+ if (a == &bfd_com_section) continue;
+
+ printf("RELOCATION RECORDS FOR [%s]:",a->name);
- if (get_reloc_upper_bound(abfd, a) == 0) {
- printf(" (none)\n\n");
- }
- else {
- arelent **p;
-
- relpp = (arelent **) xmalloc( get_reloc_upper_bound(abfd,a) );
- relcount = bfd_canonicalize_reloc(abfd,a,relpp, syms);
- if (relcount == 0) {
- printf(" (none)\n\n");
- }
+ if (bfd_get_reloc_upper_bound(abfd, a) == 0) {
+ printf(" (none)\n\n");
+ }
else {
- printf("\n");
- printf("OFFSET TYPE VALUE \n");
-
- for (p =relpp; relcount && *p != (arelent *)NULL; p++,
- relcount --) {
- arelent *q = *p;
- CONST char *sym_name;
- CONST char *section_name = q->section == (asection *)NULL ? "*abs" :
- q->section->name;
- if (q->sym_ptr_ptr && *q->sym_ptr_ptr) {
- sym_name = (*(q->sym_ptr_ptr))->name ;
- }
- else {
- sym_name = 0;
- }
- if (sym_name) {
- printf_vma(q->address);
- printf(" %-8s %s",
- q->howto->name,
- sym_name);
- }
+ arelent **p;
+
+ relpp = (arelent **) xmalloc( bfd_get_reloc_upper_bound(abfd,a) );
+ relcount = bfd_canonicalize_reloc(abfd,a,relpp, syms);
+ if (relcount == 0) {
+ printf(" (none)\n\n");
+ }
else {
- printf_vma(q->address);
- printf(" %-8s [%s]",
- q->howto->name,
- section_name);
- }
- if (q->addend) {
- printf("+0x");
- printf_vma(q->addend);
- }
- printf("\n");
+ printf("\n");
+ printf("OFFSET TYPE VALUE \n");
+
+ for (p =relpp; relcount && *p != (arelent *)NULL; p++,
+ relcount --) {
+ arelent *q = *p;
+ CONST char *sym_name;
+ /* CONST char *section_name = q->section == (asection *)NULL ? "*abs" :*/
+ /* q->section->name;*/
+ CONST char *section_name = (*( q->sym_ptr_ptr))->section->name;
+
+ if (q->sym_ptr_ptr && *q->sym_ptr_ptr) {
+ sym_name = (*(q->sym_ptr_ptr))->name ;
+ }
+ else {
+ sym_name = 0;
+ }
+ if (sym_name) {
+ printf_vma(q->address);
+ printf(" %-8s %s",
+ q->howto->name,
+ sym_name);
+ }
+ else {
+ printf_vma(q->address);
+ printf(" %-8s [%s]",
+ q->howto->name,
+ section_name);
+ }
+ if (q->addend) {
+ printf("+0x");
+ printf_vma(q->addend);
+ }
+ printf("\n");
+ }
+ printf("\n\n");
+ free(relpp);
+ }
}
- printf("\n\n");
- free(relpp);
- }
- }
- }
+ }
}
static void