summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Chamberlain <sac@cygnus>1992-05-05 01:59:04 +0000
committerSteve Chamberlain <sac@cygnus>1992-05-05 01:59:04 +0000
commitc58dbabf26596a2918885e4a68ae875b3585d732 (patch)
tree00b08f6de2377c3a4835b4f1a43dd679519e3520
parente0047d4930cf7b38fa7e7520ede6626d36157f28 (diff)
downloadppe42-binutils-c58dbabf26596a2918885e4a68ae875b3585d732.tar.gz
ppe42-binutils-c58dbabf26596a2918885e4a68ae875b3585d732.zip
* obj-coffbfd.c: use is a synonym for section, (do_relocs_for):
calc the base of relocs correctly. * tc-a29k.c (parse_operand): allow expressions to be in any section.
-rw-r--r--gas/config/ChangeLog7
-rw-r--r--gas/config/obj-coffbfd.c159
-rw-r--r--gas/config/tc-a29k.c41
3 files changed, 103 insertions, 104 deletions
diff --git a/gas/config/ChangeLog b/gas/config/ChangeLog
index 58bb340a9e..9a583f0ceb 100644
--- a/gas/config/ChangeLog
+++ b/gas/config/ChangeLog
@@ -1,3 +1,10 @@
+Mon May 4 18:56:19 1992 Steve Chamberlain (sac@thepub.cygnus.com)
+
+ * obj-coffbfd.c: use is a synonym for section, (do_relocs_for):
+ calc the base of relocs correctly.
+ * tc-a29k.c (parse_operand): allow expressions to be in any section.
+
+
Thu Mar 12 04:42:38 1992 K. Richard Pixley (rich@cygnus.com)
* tc-m68k.h, te-sun3.h: moved LOCAL_LABELS_FB definition from
diff --git a/gas/config/obj-coffbfd.c b/gas/config/obj-coffbfd.c
index 289b5fb2a5..25115fb98d 100644
--- a/gas/config/obj-coffbfd.c
+++ b/gas/config/obj-coffbfd.c
@@ -155,6 +155,7 @@ const pseudo_typeS obj_pseudo_table[] = {
{ "type", obj_coff_type, 0 },
{ "val", obj_coff_val, 0 },
{ "section", obj_coff_section, 0 },
+ { "use", obj_coff_section, 0 },
{ "sect", obj_coff_section, 0 },
{ "text", obj_coff_text, 0 },
{ "data", obj_coff_data, 0 },
@@ -317,7 +318,7 @@ void DEFUN(do_relocs_for,(abfd, file_cursor),
{
unsigned int nrelocs;
unsigned int idx;
-
+ unsigned int addr = 0;
for (idx = SEG_E0; idx < SEG_E9; idx++)
{
if (segment_info[idx].scnhdr.s_name[0])
@@ -327,7 +328,7 @@ void DEFUN(do_relocs_for,(abfd, file_cursor),
struct external_reloc *external_reloc_vec;
unsigned int external_reloc_size;
unsigned int count = 0;
- unsigned int base = segment_info[idx].scnhdr.s_paddr;
+ unsigned int base = addr;
fixS * fix_ptr = segment_info[idx].fix_root;
nrelocs = count_entries_in_chain(idx);
@@ -420,6 +421,7 @@ void DEFUN(do_relocs_for,(abfd, file_cursor),
*file_cursor += external_reloc_size;
free( external_reloc_vec);
}
+ addr += segment_info[idx].scnhdr.s_size;
}
}
@@ -433,89 +435,89 @@ static void DEFUN(fill_section,(abfd, filehdr, file_cursor),
unsigned long *file_cursor)
{
- unsigned int i;
- unsigned int paddr = 0;
+ unsigned int i;
+ unsigned int paddr = 0;
- for (i = SEG_E0; i < SEG_UNKNOWN; i++)
- {
- unsigned int offset = 0;
+ for (i = SEG_E0; i < SEG_UNKNOWN; i++)
+ {
+ unsigned int offset = 0;
- struct internal_scnhdr *s = &( segment_info[i].scnhdr);
+ struct internal_scnhdr *s = &( segment_info[i].scnhdr);
- if (s->s_name[0])
- {
- 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;
+ if (s->s_name[0])
+ {
+ 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;
+ }
+ 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)
- s->s_flags |= STYP_TEXT;
- 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;
-
- while (frag) {
- unsigned int fill_size;
- switch (frag->fr_type) {
-
- case rs_fill:
- case rs_align:
- case rs_org:
- if(frag->fr_fix)
- {
- memcpy(buffer + frag->fr_address,
- frag->fr_literal,
- frag->fr_fix);
- offset += frag->fr_fix;
- }
+ s->s_flags = STYP_REG;
+ if (strcmp(s->s_name,".text")==0)
+ s->s_flags |= STYP_TEXT;
+ 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;
+
+ while (frag) {
+ unsigned int fill_size;
+ switch (frag->fr_type) {
+
+ case rs_fill:
+ case rs_align:
+ case rs_org:
+ if(frag->fr_fix)
+ {
+ memcpy(buffer + frag->fr_address,
+ frag->fr_literal,
+ frag->fr_fix);
+ offset += frag->fr_fix;
+ }
- fill_size = frag->fr_var;
- if (fill_size)
- {
- unsigned int count ;
- unsigned int off = frag->fr_fix;
- for (count = frag->fr_offset; count; count--)
- {
- memcpy(buffer + frag->fr_address + off,
- frag->fr_literal + frag->fr_fix,
- fill_size);
- off += fill_size;
- offset += fill_size;
+ fill_size = frag->fr_var;
+ if (fill_size)
+ {
+ unsigned int count ;
+ unsigned int off = frag->fr_fix;
+ for (count = frag->fr_offset; count; count--)
+ {
+ memcpy(buffer + frag->fr_address + off,
+ frag->fr_literal + frag->fr_fix,
+ fill_size);
+ off += fill_size;
+ offset += fill_size;
- }
-
- }
- break;
- default:
- abort();
- }
- frag = frag->fr_next;
}
+
+ }
+ break;
+ default:
+ abort();
+ }
+ frag = frag->fr_next;
+ }
- bfd_write(buffer, s->s_size,1,abfd);
- free(buffer);
+ bfd_write(buffer, s->s_size,1,abfd);
+ free(buffer);
- *file_cursor += s->s_size;
- paddr += s->s_size;
- }
- }
+ *file_cursor += s->s_size;
+ paddr += s->s_size;
+ }
+ }
}
@@ -1684,9 +1686,10 @@ extern void DEFUN_VOID(write_object_file)
/* THis is a special case, we leave the size alone, which will have */
/* been made up from all and any lcomms seen */
}
- else {
- addr += size_section(abfd, i);
- }
+ else
+ {
+ addr += size_section(abfd, i);
+ }
}
@@ -1714,6 +1717,8 @@ extern void DEFUN_VOID(write_object_file)
fill_section(abfd,&filehdr, &file_cursor);
+
+
filehdr.f_magic = COFF_MAGIC;
filehdr.f_timdat = time(0);
filehdr.f_flags = COFF_FLAGS ;
@@ -1858,7 +1863,7 @@ DEFUN(c_line_new,(symbol, paddr, line_number, frag),
if (line_number == 0)
{
-last_line_symbol = symbol;
+ last_line_symbol = symbol;
new_line->line.l_addr.l_symndx = (long)symbol;
}
else
@@ -1878,7 +1883,7 @@ last_line_symbol = symbol;
{
s->lineno_list_tail->next = new_line;
}
- s->lineno_list_tail = new_line;
+ s->lineno_list_tail = new_line;
return LINESZ * s->scnhdr.s_nlnno ++;
}
diff --git a/gas/config/tc-a29k.c b/gas/config/tc-a29k.c
index 62b50634e0..c4165c486d 100644
--- a/gas/config/tc-a29k.c
+++ b/gas/config/tc-a29k.c
@@ -80,7 +80,10 @@ const pseudo_typeS
{ "reg", s_lsym, 0 }, /* Register equate, same as equ */
{ "space", s_ignore, 0 }, /* Listing control */
{ "sect", s_ignore, 0 }, /* Creation of coff sections */
+#ifndef OBJ_COFF
+ /* We can do this right with coff */
{ "use", s_use, 0 },
+#endif
{ "word", cons, 4 },
{ NULL, 0, 0 },
};
@@ -365,34 +368,18 @@ char *
char *s;
expressionS *operandp;
{
- char *save = input_line_pointer;
- char *new;
- segT seg;
-
- input_line_pointer = s;
- seg = expr (0, operandp);
- new = input_line_pointer;
- input_line_pointer = save;
+ char *save = input_line_pointer;
+ char *new;
+ segT seg;
- switch (seg) {
- case SEG_ABSOLUTE:
- case SEG_TEXT:
- case SEG_DATA:
- case SEG_BSS:
- case SEG_UNKNOWN:
- case SEG_DIFFERENCE:
- case SEG_BIG:
- case SEG_REGISTER:
- return new;
-
- case SEG_ABSENT:
- as_bad("Missing operand");
- return new;
-
- default:
- as_bad("Don't understand operand of type %s", segment_name (seg));
- return new;
- }
+ input_line_pointer = s;
+ seg = expr (0, operandp);
+ new = input_line_pointer;
+ input_line_pointer = save;
+
+ if (seg == SEG_ABSENT)
+ as_bad("Missing operand");
+ return new;
}
/* Instruction parsing. Takes a string containing the opcode.
OpenPOWER on IntegriCloud