From: Ian Lance Taylor Date: Fri, 23 Oct 1992 15:28:15 +0000 (+0000) Subject: Fri Oct 23 08:15:56 1992 Ian Lance Taylor (ian@cygnus.com) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b26059aa449b61de921a90e76e8efcd75dd772a6;p=binutils-gdb.git Fri Oct 23 08:15:56 1992 Ian Lance Taylor (ian@cygnus.com) * changes to support i386-sysv with shared libraries: * coffcode.h (sec_to_styp_flags): if TWO_DATA_SECS is defined, check for .data2; if _LIB is defined, check for it; map SEC_NEVER_LOAD to STYP_NOLOAD. (styp_to_sec_flags): map STYP_NOLOAD to SEC_NEVER_LOAD. (make_a_section_from_file): if TWO_DATA_SECS, accept .data2. (coff_write_object_contents): force vaddr of .lib to 0; set scnptr if section has contents, not just if it is loadable; if TWO_DATA_SECS, check for .data2 (coff_set_section_contents): set vma of .lib section to number of .lib sections. * coff-i386.c: define TWO_DATA_SECS; use a special CALC_ADDEND; don't define coff_write_armap to bsd_write_armap. * hosts/i386v.h: don't include , since it is not provided by SVR3.2. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 820a64b7eba..8f08a881816 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,30 @@ +Fri Oct 23 08:15:56 1992 Ian Lance Taylor (ian@cygnus.com) + + * changes to support i386-sysv with shared libraries: + * coffcode.h (sec_to_styp_flags): if TWO_DATA_SECS is defined, + check for .data2; if _LIB is defined, check for it; map + SEC_NEVER_LOAD to STYP_NOLOAD. + (styp_to_sec_flags): map STYP_NOLOAD to SEC_NEVER_LOAD. + (make_a_section_from_file): if TWO_DATA_SECS, accept .data2. + (coff_write_object_contents): force vaddr of .lib to 0; set scnptr + if section has contents, not just if it is loadable; if + TWO_DATA_SECS, check for .data2 + (coff_set_section_contents): set vma of .lib section to number of + .lib sections. + * coff-i386.c: define TWO_DATA_SECS; use a special CALC_ADDEND; + don't define coff_write_armap to bsd_write_armap. + * hosts/i386v.h: don't include , since it is not provided + by SVR3.2. + +Thu Oct 22 22:40:20 1992 Brendan Kehoe (brendan@lisa.cygnus.com) + + * solaris2.h: Get the definition of alloca from alloca.h if we + aren't using gcc. + +Thu Oct 22 03:07:28 1992 John Gilmore (gnu@cygnus.com) + + * configure.in (i960-*-{aout,bout}): Support these. + Wed Oct 21 03:46:34 1992 John Gilmore (gnu@cygnus.com) * config/a29k-aout.mt (DEFAULT_TARGET): Set to one that exists. diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 1fef14854b5..af9cef65e12 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1,5 +1,5 @@ /* Support for the generic parts of most COFF variants, for BFD. - Copyright (C) 1990-1991 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -343,12 +343,20 @@ DEFUN(sec_to_styp_flags, (sec_name, sec_flags), return((long)STYP_TEXT); } else if (!strcmp(sec_name, _DATA)) { return((long)STYP_DATA); +#ifdef TWO_DATA_SECS + } else if (!strcmp(sec_name, ".data2")) { + return((long)STYP_DATA); +#endif /* TWO_DATA_SECS */ } else if (!strcmp(sec_name, _BSS)) { return((long)STYP_BSS); #ifdef _COMMENT } else if (!strcmp(sec_name, _COMMENT)) { return((long)STYP_INFO); #endif /* _COMMENT */ +#ifdef _LIB + } else if (!strcmp(sec_name, _LIB)) { + return((long)STYP_LIB); +#endif /* _LIB */ } /* Try and figure out what it should be */ @@ -364,6 +372,11 @@ DEFUN(sec_to_styp_flags, (sec_name, sec_flags), if (styp_flags == 0) styp_flags = STYP_BSS; +#ifdef STYP_NOLOAD + if (sec_flags & SEC_NEVER_LOAD) + styp_flags |= STYP_NOLOAD; +#endif + return(styp_flags); } /* @@ -379,22 +392,30 @@ DEFUN(styp_to_sec_flags, (styp_flags), { flagword sec_flags=0; +#ifdef STYP_NOLOAD + if (styp_flags & STYP_NOLOAD) + { + sec_flags |= SEC_NEVER_LOAD; + } +#endif /* STYP_NOLOAD */ + if ((styp_flags & STYP_TEXT) || (styp_flags & STYP_DATA)) { - sec_flags = SEC_LOAD | SEC_ALLOC; + sec_flags |= SEC_LOAD | SEC_ALLOC; } else if (styp_flags & STYP_BSS) { - sec_flags = SEC_ALLOC; + sec_flags |= SEC_ALLOC; } else if (styp_flags & STYP_INFO) { - sec_flags = SEC_NEVER_LOAD; + sec_flags |= SEC_NEVER_LOAD; } else { - sec_flags = SEC_ALLOC | SEC_LOAD; + sec_flags |= SEC_ALLOC | SEC_LOAD; } + #ifdef STYP_LIT /* A29k readonly text/data section type */ if ((styp_flags & STYP_LIT) == STYP_LIT) { @@ -937,6 +958,12 @@ DEFUN(make_a_section_from_file,(abfd, hdr, target_index), name[sizeof (hdr->s_name)] = 0; return_section = bfd_make_section(abfd, name); +#ifdef TWO_DATA_SECS + /* On SCO a file created by the Microsoft assembler can have two + .data sections. We use .data2 for the second one. */ + if (return_section == NULL && strcmp(name, _DATA) == 0) + return_section = bfd_make_section(abfd, ".data2"); +#endif /* TWO_DATA_SECS */ if (return_section == NULL) return false; @@ -2497,7 +2524,14 @@ DEFUN(coff_write_object_contents,(abfd), { internal_f.f_nscns ++; strncpy(&(section.s_name[0]), current->name, 8); - section.s_vaddr = current->vma + pad; +#ifdef _LIB + /* Always set s_vaddr of .lib to 0. This is right for SVR3.2 + Ian Taylor . */ + if (strcmp (current->name, _LIB) == 0) + section.s_vaddr = 0; + else +#endif + section.s_vaddr = current->vma + pad; section.s_paddr = current->vma + pad; section.s_size = current->_raw_size - pad; /* @@ -2505,7 +2539,7 @@ DEFUN(coff_write_object_contents,(abfd), will be 0 too */ if (current->_raw_size - pad == 0 || - (current->flags & SEC_LOAD) == 0) { + (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) { section.s_scnptr = 0; } else { @@ -2526,6 +2560,10 @@ DEFUN(coff_write_object_contents,(abfd), text_sec = current; } else if (!strcmp(current->name, _DATA)) { data_sec = current; +#ifdef TWO_DATA_SECS + } else if (!strcmp(current->name, ".data2")) { + data_sec = current; +#endif /* TWO_DATA_SECS */ } else if (!strcmp(current->name, _BSS)) { bss_sec = current; } @@ -2747,6 +2785,15 @@ DEFUN(coff_set_section_contents,(abfd, section, location, offset, count), if (abfd->output_has_begun == false) /* set by bfd.c handler */ coff_compute_section_file_positions(abfd); +#ifdef _LIB + /* If this is a .lib section, bump the vma address so that it + winds up being the number of .lib sections output. This is + right for SVR3.2. Shared libraries should probably get more + generic support. Ian Taylor . */ + if (strcmp (section->name, _LIB) == 0) + ++section->vma; +#endif + bfd_seek(abfd, (file_ptr) (section->filepos + offset), SEEK_SET); if (count != 0) { diff --git a/bfd/hosts/i386v.h b/bfd/hosts/i386v.h index 66dfd6b8102..4ffebd7dc00 100644 --- a/bfd/hosts/i386v.h +++ b/bfd/hosts/i386v.h @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include