Index: gnu/binutils/configure diff -c gnu/binutils/configure:1.1.1.15 gnu/binutils/configure:1.8 *** gnu/binutils/configure:1.1.1.15 Wed Jul 17 00:07:28 1996 --- gnu/binutils/configure Thu Jul 18 00:42:25 1996 *************** *** 80,86 **** target_alias=NOTARGET target_makefile_frag= undefs=NOUNDEFS ! version="$Revision: 1.224 $" x11=default ### we might need to use some other shell than /bin/sh for running subshells --- 80,86 ---- target_alias=NOTARGET target_makefile_frag= undefs=NOUNDEFS ! version="$Revision: 1.1.1.15 $" x11=default ### we might need to use some other shell than /bin/sh for running subshells Index: gnu/binutils/bfd/VERSION diff -c gnu/binutils/bfd/VERSION:1.1.1.7 gnu/binutils/bfd/VERSION:1.18 *** gnu/binutils/bfd/VERSION:1.1.1.7 Wed Jul 17 00:07:45 1996 --- gnu/binutils/bfd/VERSION Tue Aug 13 11:39:36 1996 *************** *** 1 **** ! 2.7 --- 1 ---- ! 2.7.0.3 Index: gnu/binutils/bfd/bfd.c diff -c gnu/binutils/bfd/bfd.c:1.1.1.11 gnu/binutils/bfd/bfd.c:1.11 *** gnu/binutils/bfd/bfd.c:1.1.1.11 Sat Apr 6 09:39:24 1996 --- gnu/binutils/bfd/bfd.c Wed Apr 17 00:12:31 1996 *************** *** 672,677 **** --- 672,691 ---- } + void + bfd_assert_symbol(file, line, symbol) + const char *file; + int line; + const char *symbol; + { + if (symbol && *symbol) + (*_bfd_error_handler) ("bfd assertion fail %s:%d due to symbol: `%s'. possible cause:\n\tmismatched types in library and program.", + file,line,symbol); + else + (*_bfd_error_handler) ("bfd assertion fail %s:%d",file,line); + } + + /* FUNCTION bfd_set_start_address Index: gnu/binutils/bfd/configure.in diff -c gnu/binutils/bfd/configure.in:1.1.1.17 gnu/binutils/bfd/configure.in:1.14 *** gnu/binutils/bfd/configure.in:1.1.1.17 Wed Jul 17 00:07:55 1996 --- gnu/binutils/bfd/configure.in Thu Jul 18 00:42:30 1996 *************** *** 377,382 **** --- 377,397 ---- *) f="$f $i" ;; esac done + + # Lynx is a very different animal. We cannot support straight a.out + # nor coff anymore. We have to strip them out. + for cpu in i386 m68k sparc + do + for fmt in aout coff + do + case $f in + *${cpu}lynx_${fmt}_vec*) + f=`echo $f | sed -e "s/${cpu}${fmt}_vec//g"` + ;; + esac + done + done + selvecs="$f" # uniq the architectures in all the configured targets. Index: gnu/binutils/bfd/elf.c diff -c gnu/binutils/bfd/elf.c:1.1.1.14 gnu/binutils/bfd/elf.c:1.13 *** gnu/binutils/bfd/elf.c:1.1.1.14 Wed Jul 17 00:07:57 1996 --- gnu/binutils/bfd/elf.c Wed Jul 24 19:23:38 1996 *************** *** 2661,2666 **** --- 2661,2668 ---- struct elf_segment_map **pm; Elf_Internal_Phdr *p; unsigned int i, c; + struct elf_segment_map *m; + asection *s; if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour || bfd_get_flavour (obfd) != bfd_target_elf_flavour) *************** *** 2678,2685 **** for (i = 0, p = elf_tdata (ibfd)->phdr; i < c; i++, p++) { unsigned int csecs; - asection *s; - struct elf_segment_map *m; unsigned int isec; csecs = 0; --- 2680,2685 ---- *************** *** 2748,2753 **** --- 2748,2797 ---- *pm = m; pm = &m->next; } + + /* Minimum sanity check. It may not mean anything. */ + c = 0; + for (s = ibfd->sections; s != NULL; s = s->next) + { + int found; + + /* We don't check those sections. */ + if ((s->vma == 0 && s->lma == 0) || (s->flags & SEC_ALLOC) == 0) + continue; + + found = 0; + for (m = mfirst; m != NULL && found == 0; m = m->next) + { + for (i = 0; i < m->count; i++) + { + if (m->sections [i] == s->output_section) + { + found = 1; + break; + } + } + } + + if (found == 0) + { + /* Not found */ + ((*_bfd_error_handler) + ("%s: error: section `%s' not in segment", + bfd_get_filename (ibfd), + (s->output_section == NULL + ? "*unknown*" : s->output_section->name))); + c++; + } + } + + if (c) + { + /* That is very bad. */ + ((*_bfd_error_handler) + ("%s: fatal error: missing sections", + bfd_get_filename (ibfd))); + abort (); + } elf_tdata (obfd)->segment_map = mfirst; Index: gnu/binutils/bfd/elf32-i386.c diff -c gnu/binutils/bfd/elf32-i386.c:1.1.1.8 gnu/binutils/bfd/elf32-i386.c:1.12 *** gnu/binutils/bfd/elf32-i386.c:1.1.1.8 Tue Feb 6 21:02:38 1996 --- gnu/binutils/bfd/elf32-i386.c Tue Feb 6 23:19:36 1996 *************** *** 476,482 **** dynobj = elf_hash_table (info)->dynobj; /* Make sure we know what is going on here. */ ! BFD_ASSERT (dynobj != NULL && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) || h->weakdef != NULL || ((h->elf_link_hash_flags --- 476,482 ---- dynobj = elf_hash_table (info)->dynobj; /* Make sure we know what is going on here. */ ! BFD_ASSERT_SYMBOL (dynobj != NULL && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) || h->weakdef != NULL || ((h->elf_link_hash_flags *************** *** 484,490 **** && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0 && (h->elf_link_hash_flags ! & ELF_LINK_HASH_DEF_REGULAR) == 0))); /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later, --- 484,491 ---- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0 && (h->elf_link_hash_flags ! & ELF_LINK_HASH_DEF_REGULAR) == 0)), ! h->root.root.string); /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later, Index: gnu/binutils/bfd/elflink.h diff -c gnu/binutils/bfd/elflink.h:1.1.1.11 gnu/binutils/bfd/elflink.h:1.11 *** gnu/binutils/bfd/elflink.h:1.1.1.11 Wed Jul 17 00:08:01 1996 --- gnu/binutils/bfd/elflink.h Tue Aug 13 11:39:37 1996 *************** *** 867,876 **** weaks = hlook->weakdef; hlook->weakdef = NULL; ! BFD_ASSERT (hlook->root.type == bfd_link_hash_defined || hlook->root.type == bfd_link_hash_defweak || hlook->root.type == bfd_link_hash_common ! || hlook->root.type == bfd_link_hash_indirect); slook = hlook->root.u.def.section; vlook = hlook->root.u.def.value; --- 867,877 ---- weaks = hlook->weakdef; hlook->weakdef = NULL; ! BFD_ASSERT_SYMBOL (hlook->root.type == bfd_link_hash_defined || hlook->root.type == bfd_link_hash_defweak || hlook->root.type == bfd_link_hash_common ! || hlook->root.type == bfd_link_hash_indirect, ! hlook->root.root.string); slook = hlook->root.u.def.section; vlook = hlook->root.u.def.value; *************** *** 1320,1326 **** static const size_t elf_buckets[] = { ! 1, 3, 17, 37, 67, 97, 131, 197, 263, 521, 0 }; /* Set up the sizes and contents of the ELF dynamic sections. This is --- 1321,1328 ---- static const size_t elf_buckets[] = { ! 1, 3, 17, 37, 67, 97, 131, 197, 263, 521, 1031, 2053, 4099, 8209, ! 16411, 32771, 0 }; /* Set up the sizes and contents of the ELF dynamic sections. This is *************** *** 1790,1795 **** --- 1792,1799 ---- dynamic = elf_hash_table (info)->dynamic_sections_created; dynobj = elf_hash_table (info)->dynobj; + if (dynamic) + BFD_ASSERT (dynobj); /* FIXME */ finfo.info = info; finfo.output_bfd = abfd; Index: gnu/binutils/bfd/libbfd-in.h diff -c gnu/binutils/bfd/libbfd-in.h:1.1.1.12 gnu/binutils/bfd/libbfd-in.h:1.10 *** gnu/binutils/bfd/libbfd-in.h:1.1.1.12 Wed Jul 17 00:08:05 1996 --- gnu/binutils/bfd/libbfd-in.h Thu Jul 18 00:42:32 1996 *************** *** 473,480 **** --- 473,485 ---- void bfd_assert PARAMS ((const char*,int)); + void bfd_assert_symbol PARAMS ((const char*,int,const char*)); + #define BFD_ASSERT(x) \ { if (!(x)) bfd_assert(__FILE__,__LINE__); } + + #define BFD_ASSERT_SYMBOL(x,s) \ + { if (!(x)) bfd_assert_symbol(__FILE__,__LINE__,s); } #define BFD_FAIL() \ { bfd_assert(__FILE__,__LINE__); } Index: gnu/binutils/bfd/libbfd.h diff -c gnu/binutils/bfd/libbfd.h:1.1.1.2 gnu/binutils/bfd/libbfd.h:1.3 *** gnu/binutils/bfd/libbfd.h:1.1.1.2 Wed Jul 17 00:08:05 1996 --- gnu/binutils/bfd/libbfd.h Thu Jul 18 00:42:34 1996 *************** *** 473,480 **** --- 473,485 ---- void bfd_assert PARAMS ((const char*,int)); + void bfd_assert_symbol PARAMS ((const char*,int,const char*)); + #define BFD_ASSERT(x) \ { if (!(x)) bfd_assert(__FILE__,__LINE__); } + + #define BFD_ASSERT_SYMBOL(x,s) \ + { if (!(x)) bfd_assert_symbol(__FILE__,__LINE__,s); } #define BFD_FAIL() \ { bfd_assert(__FILE__,__LINE__); } Index: gnu/binutils/bfd/doc/bfd.texinfo diff -c gnu/binutils/bfd/doc/bfd.texinfo:1.1.1.4 gnu/binutils/bfd/doc/bfd.texinfo:1.3 *** gnu/binutils/bfd/doc/bfd.texinfo:1.1.1.4 Mon Nov 27 20:18:58 1995 --- gnu/binutils/bfd/doc/bfd.texinfo Thu Jan 18 22:22:24 1996 *************** *** 1,6 **** \input texinfo.tex @setfilename bfd.info ! @c $Id: bfd.texinfo,v 1.28 1995/11/10 20:04:12 victoria Exp $ @tex % NOTE LOCAL KLUGE TO AVOID TOO MUCH WHITESPACE \global\long\def\example{% --- 1,6 ---- \input texinfo.tex @setfilename bfd.info ! @c $Id: bfd.texinfo,v 1.1.1.4 1995/11/28 04:18:58 hjl Exp $ @tex % NOTE LOCAL KLUGE TO AVOID TOO MUCH WHITESPACE \global\long\def\example{% *************** *** 67,73 **** @tex \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ ! \xdef\manvers{\$Revision: 1.28 $} % For use in headers, footers too {\parskip=0pt \hfill Cygnus Support\par \hfill sac\@cygnus.com\par --- 67,73 ---- @tex \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ ! \xdef\manvers{\$Revision: 1.1.1.4 $} % For use in headers, footers too {\parskip=0pt \hfill Cygnus Support\par \hfill sac\@cygnus.com\par Index: gnu/binutils/binutils/Makefile.in diff -c gnu/binutils/binutils/Makefile.in:1.1.1.36 gnu/binutils/binutils/Makefile.in:1.21 *** gnu/binutils/binutils/Makefile.in:1.1.1.36 Wed Jul 17 00:07:30 1996 --- gnu/binutils/binutils/Makefile.in Thu Jul 18 00:42:39 1996 *************** *** 106,114 **** SRCONV_PROG=srconv sysdump coffdump MANPAGES= ar nm objdump ranlib size strings strip objcopy nlmconv ! PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ STAGESTUFF = $(PROGS) *.o # Files that can be generated, but should be in the distribution. # Don't build $(DEMANGLER_PROG).1, since its name may vary with the --- 106,116 ---- SRCONV_PROG=srconv sysdump coffdump + ENCAPS_PROG=encaps + MANPAGES= ar nm objdump ranlib size strings strip objcopy nlmconv ! PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) $(ENCAPS_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ STAGESTUFF = $(PROGS) *.o # Files that can be generated, but should be in the distribution. # Don't build $(DEMANGLER_PROG).1, since its name may vary with the *************** *** 320,325 **** --- 322,330 ---- -rm -f $(STRIP_PROG) -ln $(OBJCOPY_PROG) $(STRIP_PROG) + $(ENCAPS_PROG): encaps.o $(BFD) + $(CC) $(CFLAGS) $(LDFLAGS) -o $(ENCAPS_PROG) encaps.o $(ADDL_LIBS) $(EXTRALIBS) + sysroff.c: sysinfo sysroff.info ./sysinfo -c <$(srcdir)/sysroff.info >sysroff.c ./sysinfo -i <$(srcdir)/sysroff.info >>sysroff.c *************** *** 744,748 **** --- 749,754 ---- nlmheader.o: nlmheader.c ../bfd/bfd.h $(INCDIR)/obstack.h \ bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h \ $(INCDIR)/nlm/internal.h nlmconv.h + encaps.o: encaps.c ../bfd/bfd.h $(INCDIR)/ansidecl.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY Index: gnu/binutils/binutils/encaps.c diff -c /dev/null gnu/binutils/binutils/encaps.c:1.4 *** /dev/null Fri Oct 4 17:46:48 1996 --- gnu/binutils/binutils/encaps.c Thu Jan 18 22:22:26 1996 *************** *** 0 **** --- 1,267 ---- + /* encaps.c */ + /* Copyright (C) 1994 Yggdrasil Computing, Incorporated + 4880 Stevens Creek Blvd. Suite 205 + San Jose, CA 95129-1034 + USA + Tel (408) 261-6630 + Fax (408) 261-6631 + + Encaps 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 2, or (at your option) + any later version. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + + /* Written by Ross Biro Nov 94 */ + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #include "ansidecl.h" + #include + + #define obstack_chunk_alloc malloc + #define obstack_chunk_free free + + #define DEF_SEC_FLAGS SEC_ALLOC|SEC_LOAD|SEC_RELOC|SEC_HAS_CONTENTS + + /* This is the routine that does most of the work. */ + /* file is the name of the output file + target is the target type "a.out-i386-linux" for example + secflags is ored with DEFAULT_SEC_FLAGS and then applied. + It is used to say if the section is data or code. (Normally + SEC_DATA. + format is the file format to write (Normally bfd_object) + symname is the name to give the symbol. + secname is the name of the section (.data is good) + fd is the file descriptor for the data to be put in the file. + */ + + int + encapsulate (const char *file, const char *target, unsigned long secflags, + bfd_format format, const char *symname, char *lengthname, + const char *secname, + int fd) { + bfd *abfd; + asection *sec; + size_t length; + unsigned char *ptr; + struct stat st; + asymbol *syms[3]; + asymbol *new; + + bfd_init(); + + abfd = bfd_openw(file, target); + + if (abfd == NULL) { + fprintf (stderr, "Error Openning %s file %s: %s\n",target, file, + bfd_errmsg (bfd_get_error())); + return (bfd_get_error()<<16| errno); + } + + #ifdef __i386__ + /* This wonderful poorly document call is absolutely necessary. */ + /* The linker deals with this in a much better way. Perhaps the + code should be borowed. */ + bfd_default_set_arch_mach (abfd, bfd_arch_i386, 0); + #endif + + if (!bfd_set_format (abfd, format)) { + fprintf (stderr, "Error settting format: %s\n", + bfd_errmsg (bfd_get_error())); + return (bfd_get_error()<<16| errno); + } + + sec = bfd_make_section (abfd, secname); + + if (sec == NULL) { + fprintf (stderr, "Error Making Section: %s\n", + bfd_errmsg (bfd_get_error())); + return (bfd_get_error()<<16| errno); + } + + if (!bfd_set_section_flags(abfd, sec, DEF_SEC_FLAGS | secflags)) { + fprintf (stderr, "Error settting section flags %s\n", + bfd_errmsg (bfd_get_error())); + return (bfd_get_error()<<16| errno); + } + + /* We are ready for the data. */ + if (fstat (fd, &st)) { + fprintf (stderr, "Error Stating Data File: %s\n", + strerror (errno)); + return (errno); + } + + length = st.st_size; + + /* create a new symbol */ + + new = bfd_make_empty_symbol (abfd); + if ((unsigned long)new < 4096) { + fprintf (stderr, "Error allocating symbol: %s\n", + bfd_errmsg (bfd_get_error())); + return (bfd_get_error()<<16| errno); + } + + new->name = symname; + new->section = sec; + new->flags = BSF_EXPORT; + new->value =sizeof (char *); + syms[0]=new; + + + new = bfd_make_empty_symbol (abfd); + if ((unsigned long)new < 4096) { + fprintf (stderr, "Error allocating symbol: %s\n", + bfd_errmsg (bfd_get_error())); + return (bfd_get_error()<<16| errno); + } + + new->name = lengthname; + new->section = sec; + new->flags = BSF_EXPORT; + new->value =0; + syms[1]=new; + + syms[2]=NULL; + + if (!bfd_set_symtab (abfd, syms, 2)) { + fprintf (stderr, "Error setting symbol table: %s\n", + bfd_errmsg (bfd_get_error())); + return (bfd_get_error()<<16| errno); + } + + /* mmap would be good here, but if I do it, I can't easily + add the length info. Oh well + ptr = mmap (0, length, PROT_READ, MAP_FILE|MAP_SHARED, fd, 0); + + if (ptr == NULL) { + fprintf (stderr, "Error mmapping Data File: %s\n", + strerror (errno)); + return (errno); + } + */ + ptr = malloc (length + sizeof (char *)); + + if (ptr == NULL) { + fprintf (stderr, "Error allocating memory for data file: %s\n", + strerror (errno)); + return (errno); + } + + /* this is technically a bug. For example a ctrl-z bg may break this. */ + if (read (fd, ptr+sizeof (char *), length) != length) { + fprintf (stderr, "Error reading file: %s\n", + strerror (errno)); + return (errno); + } + *(unsigned long*)ptr = length; + + if (! bfd_set_section_size (abfd, sec, length+sizeof(char *))) { + fprintf (stderr, "Error settting section size %s:\n", + bfd_errmsg (bfd_get_error())); + return (bfd_get_error()<<16| errno); + } + + if (! bfd_set_section_contents (abfd, sec, ptr, 0, length+sizeof (char *))) { + fprintf (stderr, "Error settting section contents: %s\n", + bfd_errmsg (bfd_get_error())); + return (bfd_get_error()<<16| errno); + } + + /* write out everything. */ + bfd_close (abfd); + return (0); + } + + void + usage (char *name) { + fprintf (stderr, "usage %s: [-f format] [-n secname] [-t target] [-s secflags] output-file input-file symbol-name length-name\n", name); + fprintf (stderr," --format format file format to write.\n"); + fprintf (stderr," --section_name name of the section (normally .data)\n"); + fprintf (stderr," --target target target name (a.out-linux-i386 elf32-i386)\n"); + fprintf (stderr," --sectionflags flags flags to put in section header\n"); + exit (1); + + } + + + int main (int argc, char *argv[]) { + int c; + char *outfile=NULL; + char *infile=NULL; + char *target="a.out-i386-linux"; + int secflags = SEC_DATA; + bfd_format format = bfd_object; + char *symname = NULL; + char *lengthname = NULL; + char *secname = ".data"; + int fd = -1; + + int option_index; + static struct option long_options[] = { + {"help", 0, 0, 'h'}, + {"format", 1, 0, 'f'}, + {"section-name", 1, 0, 'n'}, + {"target", 1, 0, 't'}, + {"sectionflags", 1, 0, 's'}, + }; + + while ((c = getopt_long (argc, argv, "hf:t:n:s:", + long_options, &option_index)) > 0) { + switch (c) { + case 'h': + case '?': + default: + usage(argv[0]); + + case 'f': + format = atoi(optarg); + break; + + case 'n': + secname = optarg; + break; + + case 't': + target = optarg; + break; + + case 's': + secflags=atoi (optarg); + break; + + } + } + if (argc - optind != 4) usage(argv[0]); + + outfile = argv[optind]; + infile= argv[optind+1]; + symname = argv[optind+2]; + lengthname = argv[optind+3]; + fd = open (infile, O_RDONLY); + if (fd < 0) { + fprintf (stderr, "error opening infile %s: %s\n", infile, + strerror(errno)); + exit (1); + } + + if (encapsulate (outfile, target, secflags, format, symname, lengthname, + secname, fd)) + return (1); + + return (0); + } Index: gnu/binutils/binutils/objdump.1 diff -c gnu/binutils/binutils/objdump.1:1.1.1.5 gnu/binutils/binutils/objdump.1:1.5 *** gnu/binutils/binutils/objdump.1:1.1.1.5 Wed Jul 17 00:07:35 1996 --- gnu/binutils/binutils/objdump.1 Thu Jul 18 00:42:40 1996 *************** *** 35,40 **** --- 35,41 ---- .I section\c .RB " | " "\-\-section="\c .I section\c + .RB "[\|" \-k | \-\-raw "\|]" \&\|] .RB "[\|" \-l | \-\-line\-numbers "\|]" .RB "[\|" "\-m\ "\c *************** *** 42,47 **** --- 43,54 ---- .RB " | " "\-\-architecture="\c .I machine\c \&\|] + .RB "[\|" "\-o\ "\c + .I offset\c + .RB " | " "\-\-offset="\c + .I offset\c + \&\|] + .RB "[\|" \-q | \-\-quiet "\|]" .RB "[\|" \-r | \-\-reloc "\|]" .RB "[\|" \-R | \-\-dynamic\-reloc "\|]" .RB "[\|" \-s | \-\-full\-contents "\|]" *************** *** 208,213 **** --- 215,229 ---- \&. .TP + .B \-k + .TP + .B \-\-raw + Dump all the loadable section contents as raw data on stdout. + Useful for making + boot images or turning an executable into raw data. Some architectures + (such as elf) require that stdout be seekable for this to work. + + .TP .B \-l .TP .B \-\-line\-numbers *************** *** 223,228 **** --- 239,257 ---- can be useful when disasembling object files which do not describe architecture information, such as S-records. You can list the available architectures with the \fB\-i\fP option. + + .TP + .BI "\-o " "offset"\c + .TP + .BI "\-\-offset=" "offset"\c + \& + The offset to make byte 0 of a raw dump. + + .TP + .B \-q + .TP + .B \-\-quiet + Supress most informational messages, useful with \fB\-k\fP. .TP .B \-r Index: gnu/binutils/binutils/objdump.c diff -c gnu/binutils/binutils/objdump.c:1.1.1.16 gnu/binutils/binutils/objdump.c:1.12 *** gnu/binutils/binutils/objdump.c:1.1.1.16 Wed Jul 17 00:07:35 1996 --- gnu/binutils/binutils/objdump.c Thu Jul 18 00:42:40 1996 *************** *** 17,22 **** --- 17,26 ---- along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + /* Added -k, -o, -q options for use with the Linux kernel + * 11/94 Ross Biro biro@yggdrasil.com + */ + #include "bfd.h" #include "getopt.h" #include "progress.h" *************** *** 48,53 **** --- 52,60 ---- static int show_version = 0; /* show the version number */ static int dump_section_contents; /* -s */ + static int dump_section_raw = 0; /* -k */ + static int raw_offset = 0; /* -o */ + static int quiet = 0; /* -q */ static int dump_section_headers; /* -h */ static boolean dump_file_header; /* -f */ static int dump_symtab; /* -t */ *************** *** 141,147 **** int status; { fprintf (stream, "\ ! Usage: %s [-ahifdDprRtTxsSlw] [-b bfdname] [-m machine] [-j section-name]\n\ [--archive-headers] [--target=bfdname] [--debugging] [--disassemble]\n\ [--disassemble-all] [--file-headers] [--section-headers] [--headers]\n\ [--info] [--section=section-name] [--line-numbers] [--source]\n", --- 148,154 ---- int status; { fprintf (stream, "\ ! Usage: %s [-ahifdDprkoqRtTxsSlw] [-b bfdname] [-m machine] [-j section-name]\n\ [--archive-headers] [--target=bfdname] [--debugging] [--disassemble]\n\ [--disassemble-all] [--file-headers] [--section-headers] [--headers]\n\ [--info] [--section=section-name] [--line-numbers] [--source]\n", *************** *** 151,157 **** [--syms] [--all-headers] [--dynamic-syms] [--dynamic-reloc]\n\ [--wide] [--version] [--help] [--private-headers]\n\ [--start-address=addr] [--stop-address=addr]\n\ ! [--show-raw-insn] [-EB|-EL] [--endian={big|little}] objfile...\n\ at least one option besides -l (--line-numbers) must be given\n"); list_supported_targets (program_name, stream); exit (status); --- 158,165 ---- [--syms] [--all-headers] [--dynamic-syms] [--dynamic-reloc]\n\ [--wide] [--version] [--help] [--private-headers]\n\ [--start-address=addr] [--stop-address=addr]\n\ ! [--show-raw-insn] [-EB|-EL] [--endian={big|little}]\n\ ! [--offset=offset] [--raw] [--quiet] objfile...\n\ at least one option besides -l (--line-numbers) must be given\n"); list_supported_targets (program_name, stream); exit (status); *************** *** 181,186 **** --- 189,197 ---- {"help", no_argument, NULL, 'H'}, {"info", no_argument, NULL, 'i'}, {"line-numbers", no_argument, NULL, 'l'}, + {"offset", required_argument, NULL, 'o'}, + {"quiet", no_argument, NULL, 'q'}, + {"raw", no_argument, NULL, 'k'/* k for kernel */}, {"reloc", no_argument, NULL, 'r'}, {"section", required_argument, NULL, 'j'}, {"section-headers", no_argument, NULL, 'h'}, *************** *** 1433,1441 **** } return; } ! ! printf ("\n%s: file format %s\n", bfd_get_filename (abfd), ! abfd->xvec->name); if (dump_ar_hdrs) print_arelt_descr (stdout, abfd, true); if (dump_file_header) --- 1444,1452 ---- } return; } ! if (!quiet) ! printf ("\n%s: file format %s\n", bfd_get_filename (abfd), ! abfd->xvec->name); if (dump_ar_hdrs) print_arelt_descr (stdout, abfd, true); if (dump_file_header) *************** *** 1508,1515 **** if (bfd_check_format (file, bfd_archive) == true) { bfd *last_arfile = NULL; ! ! printf ("In archive %s:\n", bfd_get_filename (file)); for (;;) { bfd_set_error (bfd_error_no_error); --- 1519,1526 ---- if (bfd_check_format (file, bfd_archive) == true) { bfd *last_arfile = NULL; ! if (!quiet) ! printf ("In archive %s:\n", bfd_get_filename (file)); for (;;) { bfd_set_error (bfd_error_no_error); *************** *** 1551,1556 **** --- 1562,1568 ---- bfd_size_type datasize = 0; bfd_size_type i; bfd_size_type start, stop; + int err; for (section = abfd->sections; section != NULL; section = section->next) *************** *** 1562,1568 **** { if (section->flags & SEC_HAS_CONTENTS) { ! printf ("Contents of section %s:\n", section->name); if (bfd_section_size (abfd, section) == 0) continue; --- 1574,1581 ---- { if (section->flags & SEC_HAS_CONTENTS) { ! if (!quiet) ! printf ("Contents of section %s:\n", section->name); if (bfd_section_size (abfd, section) == 0) continue; *************** *** 1572,1577 **** --- 1585,1606 ---- bfd_get_section_contents (abfd, section, (PTR) data, 0, bfd_section_size (abfd, section)); + if (dump_section_raw) { + if (section->vma < raw_offset) continue; + + if (fseek (stdout, section->vma-raw_offset, SEEK_SET)) { + perror ("fseek"); + } + + err =fwrite (data,1, bfd_section_size (abfd, section), stdout); + if (err != bfd_section_size (abfd, section)) { + perror ("fwrite"); + return; + } + + } + else + { if (start_address == (bfd_vma) -1 || start_address < section->vma) start = 0; *************** *** 1613,1618 **** --- 1642,1648 ---- } putchar ('\n'); } + } free (data); } } *************** *** 2065,2071 **** bfd_init (); ! while ((c = getopt_long (argc, argv, "pib:m:VdDlfahrRtTxsSj:wE:", long_options, (int *) 0)) != EOF) { --- 2095,2101 ---- bfd_init (); ! while ((c = getopt_long (argc, argv, "kqo:pib:m:VdDlfahrRtTxsSj:wE:", long_options, (int *) 0)) != EOF) { *************** *** 2119,2124 **** --- 2149,2164 ---- case 'S': disassemble = true; with_source_code = true; + break; + case 'q': + quiet = 1; + break; + case 'k': + dump_section_raw = 1; + dump_section_contents = 1; + break; + case 'o': + raw_offset = strtoul (optarg, NULL, 0); break; case 's': dump_section_contents = 1; Index: gnu/binutils/gas/symbols.c diff -c gnu/binutils/gas/symbols.c:1.1.1.12 gnu/binutils/gas/symbols.c:1.3 *** gnu/binutils/gas/symbols.c:1.1.1.12 Wed Jul 17 00:08:17 1996 --- gnu/binutils/gas/symbols.c Wed Jul 24 19:23:39 1996 *************** *** 1379,1385 **** --- 1379,1390 ---- { if ((s->bsym->flags & BSF_WEAK) != 0) { + #if 0 as_bad ("%s already declared as weak", S_GET_NAME (s)); + #else + /* We ignore global on weak. H.J. */ + s->bsym->flags &= ~(BSF_GLOBAL|BSF_LOCAL); + #endif return; } s->bsym->flags |= BSF_GLOBAL; *************** *** 1403,1413 **** --- 1408,1420 ---- S_SET_WEAK (s) symbolS *s; { + #if 0 if ((s->bsym->flags & BSF_GLOBAL) != 0) { as_bad ("%s already declared as global", S_GET_NAME (s)); return; } + #endif s->bsym->flags |= BSF_WEAK; s->bsym->flags &= ~(BSF_GLOBAL|BSF_LOCAL); } Index: gnu/binutils/ld/Makefile.in diff -c gnu/binutils/ld/Makefile.in:1.1.1.17 gnu/binutils/ld/Makefile.in:1.15 *** gnu/binutils/ld/Makefile.in:1.1.1.17 Wed Jul 17 00:09:38 1996 --- gnu/binutils/ld/Makefile.in Thu Jul 18 00:42:59 1996 *************** *** 342,348 **** # These all start with e so 'make clean' can find them. ! GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ ${EMUL} "@NATIVE_LIB_DIRS@" GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed @TDIRS@ --- 342,348 ---- # These all start with e so 'make clean' can find them. ! GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ ${EMUL} "@NATIVE_LIB_DIRS@" "${LIB_PATH}" GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed @TDIRS@ Index: gnu/binutils/ld/genscripts.sh diff -c gnu/binutils/ld/genscripts.sh:1.1.1.7 gnu/binutils/ld/genscripts.sh:1.9 *** gnu/binutils/ld/genscripts.sh:1.1.1.7 Sat Mar 30 22:07:11 1996 --- gnu/binutils/ld/genscripts.sh Wed Apr 17 00:13:04 1996 *************** *** 16,22 **** target_alias=$5 DEFAULT_EMULATION=$6 NATIVE_LIB_DIRS=$7 ! EMULATION_NAME=$8 tool_lib=`echo ${libdir} | sed -e 's|/lib$||'`/${9-$target_alias}/lib # Include the emulation-specific parameters: --- 16,23 ---- target_alias=$5 DEFAULT_EMULATION=$6 NATIVE_LIB_DIRS=$7 ! LIB_PATH=$8 ! EMULATION_NAME=$9 tool_lib=`echo ${libdir} | sed -e 's|/lib$||'`/${9-$target_alias}/lib # Include the emulation-specific parameters: *************** *** 60,66 **** fi # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib. ! LIB_PATH=${LIB_PATH}:${tool_lib} LIB_SEARCH_DIRS=`echo ${LIB_PATH} | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g'` --- 61,73 ---- fi # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib. ! if [ $DEFAULT_EMULATION = $EMULATION_NAME ]; then ! LIB_PATH=${LIB_PATH}:${tool_lib} ! else ! # This is not correct one since this is for a different target. ! # LIB_PATH=${LIB_PATH}:${tool_lib} ! LIB_PATH=${tool_lib} ! fi LIB_SEARCH_DIRS=`echo ${LIB_PATH} | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g'` Index: gnu/binutils/ld/ldint.texinfo diff -c gnu/binutils/ld/ldint.texinfo:1.1.1.5 gnu/binutils/ld/ldint.texinfo:1.3 *** gnu/binutils/ld/ldint.texinfo:1.1.1.5 Mon Nov 27 20:23:05 1995 --- gnu/binutils/ld/ldint.texinfo Thu Jan 18 22:22:33 1996 *************** *** 43,49 **** @tex \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ ! \xdef\manvers{\$Revision: 1.8 $} % For use in headers, footers too {\parskip=0pt \hfill Cygnus Support\par \hfill \manvers\par --- 43,49 ---- @tex \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ ! \xdef\manvers{\$Revision: 1.1.1.5 $} % For use in headers, footers too {\parskip=0pt \hfill Cygnus Support\par \hfill \manvers\par Index: gnu/binutils/ld/emultempl/elf32.em diff -c gnu/binutils/ld/emultempl/elf32.em:1.1.1.12 gnu/binutils/ld/emultempl/elf32.em:1.18 *** gnu/binutils/ld/emultempl/elf32.em:1.1.1.12 Wed Jul 17 00:09:53 1996 --- gnu/binutils/ld/emultempl/elf32.em Thu Jul 18 00:43:05 1996 *************** *** 539,546 **** --- 539,560 ---- f = soname; if (strncmp (f, global_needed->name, suffix - global_needed->name) == 0) + EOF + case ${target} in + *linux*) + cat >>e${EMULATION_NAME}.c <name, global_needed->by, f); + EOF + ;; + *) + cat >>e${EMULATION_NAME}.c <name, global_needed->by, f); + EOF + ;; + esac + cat >>e${EMULATION_NAME}.c <