diff options
author | Ian Lance Taylor <ian@airs.com> | 1992-10-20 20:10:34 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1992-10-20 20:10:34 +0000 |
commit | 6142210d1d7bcfafaa2a31327b97a354024719c1 (patch) | |
tree | febb27d4bf5a8681c2f6a75ed466de538c7929ea /gas | |
parent | 653912459d4f9ff97b6696f001b57473ba21cc7b (diff) | |
download | gdb-6142210d1d7bcfafaa2a31327b97a354024719c1.zip gdb-6142210d1d7bcfafaa2a31327b97a354024719c1.tar.gz gdb-6142210d1d7bcfafaa2a31327b97a354024719c1.tar.bz2 |
Tue Oct 20 13:02:25 1992 Ian Lance Taylor (ian@cygnus.com)
* Support for i386-sysv.
obj-coffbfd.c (do_relocs_for, write_object_file): set segment
addresses to reasonable sizes. New define ZERO_BASED_SEGMENTS can
be used to set them all to zero as was done before.
(fill_section): segment addresses now set in write_object_file.
(fill_section): Don't set STYP_NOLOAD for .bss section.
(fixup_segment): 386 uses strange common symbol format.
tc-i386.c (tc_coff_fix2rtype): use R_DIR32, not R_RELLONG, for
compatibility with SVR3.2 linker.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/config/ChangeLog | 12 | ||||
-rw-r--r-- | gas/config/obj-coffbfd.c | 64 |
2 files changed, 39 insertions, 37 deletions
diff --git a/gas/config/ChangeLog b/gas/config/ChangeLog index b77555a..ff153e2 100644 --- a/gas/config/ChangeLog +++ b/gas/config/ChangeLog @@ -1,3 +1,15 @@ +Tue Oct 20 13:02:25 1992 Ian Lance Taylor (ian@cygnus.com) + + * Support for i386-sysv. + obj-coffbfd.c (do_relocs_for, write_object_file): set segment + addresses to reasonable sizes. New define ZERO_BASED_SEGMENTS can + be used to set them all to zero as was done before. + (fill_section): segment addresses now set in write_object_file. + (fill_section): Don't set STYP_NOLOAD for .bss section. + (fixup_segment): 386 uses strange common symbol format. + tc-i386.c (tc_coff_fix2rtype): use R_DIR32, not R_RELLONG, for + compatibility with SVR3.2 linker. + Mon Oct 5 09:28:57 1992 Steve Chamberlain (sac@thepub.cygnus.com) fix i960+non-bfd coff bit rot. diff --git a/gas/config/obj-coffbfd.c b/gas/config/obj-coffbfd.c index 3e79b7b..5ed7656 100644 --- a/gas/config/obj-coffbfd.c +++ b/gas/config/obj-coffbfd.c @@ -436,12 +436,14 @@ void DEFUN(do_relocs_for,(abfd, file_cursor), *file_cursor += external_reloc_size; free( external_reloc_vec); } -#if OLDWAY - This should work, but causes problems with addends in relocs. - Disable it for the moment +#ifndef ZERO_BASED_SEGMENTS + /* Supposedly setting segment addresses non-zero causes problems + for some platforms, although it shouldn't. If you define + ZERO_BASED_SEGMENTS, all the segments will be based at 0. + Please don't make this the default, since some systems (e.g., + SVR3.2) require the segments to be non-zero based. Ian Taylor + <ian@cygnus.com>. */ addr += segment_info[idx].scnhdr.s_size; -#else - addr = 0; #endif } } @@ -457,7 +459,6 @@ static void DEFUN(fill_section,(abfd, filehdr, file_cursor), { unsigned int i; - unsigned int paddr = 0; for (i = SEG_E0; i < SEG_UNKNOWN; i++) { @@ -470,20 +471,9 @@ static void DEFUN(fill_section,(abfd, filehdr, file_cursor), fragS *frag = segment_info[i].frchainP->frch_root; char *buffer = malloc(s->s_size); if (s->s_size != 0) - { s->s_scnptr = *file_cursor; - s->s_paddr = paddr; - s->s_vaddr = paddr; - - } else - { s->s_scnptr = 0; - s->s_paddr = 0; - s->s_vaddr = 0; - - } - s->s_flags = STYP_REG; if (strcmp(s->s_name,".text")==0) @@ -491,7 +481,7 @@ static void DEFUN(fill_section,(abfd, filehdr, file_cursor), else if (strcmp(s->s_name,".data")==0) s->s_flags |= STYP_DATA; else if (strcmp(s->s_name,".bss")==0) - s->s_flags |= STYP_BSS | STYP_NOLOAD; + s->s_flags |= STYP_BSS; else if (strcmp(s->s_name,".lit")==0) s->s_flags = STYP_LIT | STYP_TEXT; @@ -551,14 +541,6 @@ static void DEFUN(fill_section,(abfd, filehdr, file_cursor), *file_cursor += s->s_size; -#if 0 - This should work, but causes problems with addends in relocs. - Disable it for the moment - - paddr += s->s_size; -#else - paddr = 0; -#endif } } @@ -1670,7 +1652,7 @@ extern void DEFUN_VOID(write_object_file) struct internal_aouthdr aouthdr; unsigned long file_cursor; bfd *abfd; - unsigned int addr = 0; + unsigned int addr; abfd = bfd_openw(out_file_name, TARGET_FORMAT); @@ -1709,31 +1691,34 @@ extern void DEFUN_VOID(write_object_file) { relax_segment(segment_info[i].frchainP->frch_root, i); } - - - - filehdr.f_nscns = 0; - /* Find out how big the sections are */ + /* Find out how big the sections are, and set the addresses. */ + addr = 0; for (i = SEG_E0; i < SEG_UNKNOWN; i++) { + segment_info[i].scnhdr.s_paddr = addr; + segment_info[i].scnhdr.s_vaddr = addr; if (segment_info[i].scnhdr.s_name[0]) { filehdr.f_nscns++; } +#ifndef ZERO_BASED_SEGMENTS + /* See the comment at the previous ZERO_BASED_SEGMENTS check. */ if (i == SEG_E2) { - /* THis is a special case, we leave the size alone, which will have */ - /* been made up from all and any lcomms seen */ + /* This is a special case, we leave the size alone, which + will have been made up from all and any lcomms seen. */ + addr += segment_info[i].scnhdr.s_size; } else { addr += size_section(abfd, i); } +#endif } @@ -2261,9 +2246,14 @@ segT this_segment_type) continue; } /* COBR */ #endif /* TC_I960 */ - - - +#ifdef TC_I386 + /* 386 COFF uses a peculiar format in + which the value of a common symbol is + stored in the .text segment (I've + checked this on SVR3.2 and SCO 3.2.2) + Ian Taylor <ian@cygnus.com>. */ + add_number += S_GET_VALUE(add_symbolP); +#endif break; |