From b066f445bb1e19ac6bab4e352497c5476138925d Mon Sep 17 00:00:00 2001 From: Sean Eric Fagan Date: Tue, 22 Sep 1992 20:07:55 +0000 Subject: [PATCH] Tue Sep 22 13:02:07 1992 Sean Eric Fagan (sef@cygnus.com) * obj-coffbfd.c (do_relocs_for,fill_section): now allocate all sections starting from zero, rather than making them consecutive. This makes subsequent reloc calculations easier, esp if the object format doesn't understand addends. (obj_coff_lcomm): (maybe temporarily) allocate lcomm in .data rather than in .bss. It seems that some tools can't cope with a non-zero sized bss before linkage. --- gas/config/ChangeLog | 9 ++++ gas/config/obj-coffbfd.c | 94 +++++++++++++++++++++++++--------------- 2 files changed, 68 insertions(+), 35 deletions(-) diff --git a/gas/config/ChangeLog b/gas/config/ChangeLog index fac76bdba38..772da900ed0 100644 --- a/gas/config/ChangeLog +++ b/gas/config/ChangeLog @@ -1,3 +1,12 @@ +Tue Sep 22 13:02:07 1992 Sean Eric Fagan (sef@cygnus.com) + + * obj-coffbfd.c (do_relocs_for,fill_section): now allocate all + sections starting from zero, rather than making them consecutive. + This makes subsequent reloc calculations easier, esp if the object + format doesn't understand addends. (obj_coff_lcomm): (maybe temporarily) + allocate lcomm in .data rather than in .bss. It seems that some + tools can't cope with a non-zero sized bss before linkage. + Tue Sep 22 15:10:51 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) * tc-m68k.c: Replace "enum m68k_architecture" with "int" diff --git a/gas/config/obj-coffbfd.c b/gas/config/obj-coffbfd.c index b66269cca81..cab70ba5c54 100644 --- a/gas/config/obj-coffbfd.c +++ b/gas/config/obj-coffbfd.c @@ -436,7 +436,13 @@ 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 addr += segment_info[idx].scnhdr.s_size; +#else + addr = 0; +#endif } } @@ -544,7 +550,15 @@ static void DEFUN(fill_section,(abfd, filehdr, file_cursor), free(buffer); *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 } } @@ -2031,45 +2045,55 @@ symbolS *symbol_rootP) static void DEFUN_VOID(obj_coff_lcomm) { - char *name; - char c; - int temp; - char *p; - unsigned long vma; + char *name; + char c; + int temp; + char *p; + unsigned long vma; - symbolS *symbolP; - name = input_line_pointer; + symbolS *symbolP; + name = input_line_pointer; + c = get_symbol_end(); + p = input_line_pointer; + *p = c; + SKIP_WHITESPACE(); + if (*input_line_pointer != ',') { + as_bad("Expected comma after name"); + ignore_rest_of_line(); + return; + } + if (*input_line_pointer == '\n') { + as_bad("Missing size expression"); + return; + } + input_line_pointer++; + if ((temp = get_absolute_expression ()) < 0) { + as_warn("lcomm length (%d.) <0! Ignored.", temp); + ignore_rest_of_line(); + return; + } + *p = 0; - c = get_symbol_end(); - p = input_line_pointer; - *p = c; - SKIP_WHITESPACE(); - if (*input_line_pointer != ',') { - as_bad("Expected comma after name"); - ignore_rest_of_line(); - return; - } - if (*input_line_pointer == '\n') { - as_bad("Missing size expression"); - return; - } - input_line_pointer++; - if ((temp = get_absolute_expression ()) < 0) { - as_warn("lcomm length (%d.) <0! Ignored.", temp); - ignore_rest_of_line(); - return; - } - *p = 0; - symbolP = symbol_find_or_make(name); - vma = segment_info[SEG_E2].scnhdr.s_size; - vma += relax_align(vma, MIN(8, temp)); - S_SET_VALUE(symbolP,vma); - S_SET_SEGMENT(symbolP, SEG_E2); - segment_info[SEG_E2].scnhdr.s_size = vma + temp; - S_SET_STORAGE_CLASS(symbolP, C_STAT); - demand_empty_rest_of_line(); + { + /* Allocate zero static local data in the .data section now + instead of the bss section as a symbol with a value */ + char *x; + segT oldseg = now_seg; + int oldsubseg = now_subseg; + + subseg_new(SEG_DATA, 10); + colon(name); + frag_align(2,0); + record_alignment(SEG_DATA, 4); + x = frag_var (rs_fill, 1, 1, (relax_substateT)0, (symbolS *)0, + temp, (char *)0); + * x= 0; + + subseg_new(oldseg, oldsubseg); + } + demand_empty_rest_of_line(); } static void DEFUN(fixup_mdeps,(frags), -- 2.30.2