mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 12:23:31 +08:00
* 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.
This commit is contained in:
@ -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)
|
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
|
* tc-m68k.h, te-sun3.h: moved LOCAL_LABELS_FB definition from
|
||||||
|
@ -155,6 +155,7 @@ const pseudo_typeS obj_pseudo_table[] = {
|
|||||||
{ "type", obj_coff_type, 0 },
|
{ "type", obj_coff_type, 0 },
|
||||||
{ "val", obj_coff_val, 0 },
|
{ "val", obj_coff_val, 0 },
|
||||||
{ "section", obj_coff_section, 0 },
|
{ "section", obj_coff_section, 0 },
|
||||||
|
{ "use", obj_coff_section, 0 },
|
||||||
{ "sect", obj_coff_section, 0 },
|
{ "sect", obj_coff_section, 0 },
|
||||||
{ "text", obj_coff_text, 0 },
|
{ "text", obj_coff_text, 0 },
|
||||||
{ "data", obj_coff_data, 0 },
|
{ "data", obj_coff_data, 0 },
|
||||||
@ -317,7 +318,7 @@ void DEFUN(do_relocs_for,(abfd, file_cursor),
|
|||||||
{
|
{
|
||||||
unsigned int nrelocs;
|
unsigned int nrelocs;
|
||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
|
unsigned int addr = 0;
|
||||||
for (idx = SEG_E0; idx < SEG_E9; idx++)
|
for (idx = SEG_E0; idx < SEG_E9; idx++)
|
||||||
{
|
{
|
||||||
if (segment_info[idx].scnhdr.s_name[0])
|
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;
|
struct external_reloc *external_reloc_vec;
|
||||||
unsigned int external_reloc_size;
|
unsigned int external_reloc_size;
|
||||||
unsigned int count = 0;
|
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;
|
fixS * fix_ptr = segment_info[idx].fix_root;
|
||||||
nrelocs = count_entries_in_chain(idx);
|
nrelocs = count_entries_in_chain(idx);
|
||||||
|
|
||||||
@ -420,6 +421,7 @@ void DEFUN(do_relocs_for,(abfd, file_cursor),
|
|||||||
*file_cursor += external_reloc_size;
|
*file_cursor += external_reloc_size;
|
||||||
free( external_reloc_vec);
|
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 long *file_cursor)
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int paddr = 0;
|
unsigned int paddr = 0;
|
||||||
|
|
||||||
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
|
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
|
||||||
|
{
|
||||||
|
unsigned int offset = 0;
|
||||||
|
|
||||||
|
struct internal_scnhdr *s = &( segment_info[i].scnhdr);
|
||||||
|
|
||||||
|
if (s->s_name[0])
|
||||||
{
|
{
|
||||||
unsigned int offset = 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;
|
||||||
|
|
||||||
struct internal_scnhdr *s = &( segment_info[i].scnhdr);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s->s_scnptr = 0;
|
||||||
|
s->s_paddr = 0;
|
||||||
|
s->s_vaddr = 0;
|
||||||
|
|
||||||
if (s->s_name[0])
|
}
|
||||||
{
|
|
||||||
fragS *frag = segment_info[i].frchainP->frch_root;
|
|
||||||
char *buffer = malloc(s->s_size);
|
s->s_flags = STYP_REG;
|
||||||
if (s->s_size != 0)
|
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)
|
||||||
{
|
{
|
||||||
s->s_scnptr = *file_cursor;
|
memcpy(buffer + frag->fr_address,
|
||||||
s->s_paddr = paddr;
|
frag->fr_literal,
|
||||||
s->s_vaddr = paddr;
|
frag->fr_fix);
|
||||||
|
offset += frag->fr_fix;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s->s_scnptr = 0;
|
|
||||||
s->s_paddr = 0;
|
|
||||||
s->s_vaddr = 0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
frag = frag->fr_next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
bfd_write(buffer, s->s_size,1,abfd);
|
break;
|
||||||
free(buffer);
|
default:
|
||||||
|
abort();
|
||||||
*file_cursor += s->s_size;
|
|
||||||
paddr += s->s_size;
|
|
||||||
}
|
}
|
||||||
|
frag = frag->fr_next;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bfd_write(buffer, s->s_size,1,abfd);
|
||||||
|
free(buffer);
|
||||||
|
|
||||||
|
*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 */
|
/* THis is a special case, we leave the size alone, which will have */
|
||||||
/* been made up from all and any lcomms seen */
|
/* been made up from all and any lcomms seen */
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
addr += size_section(abfd, i);
|
{
|
||||||
}
|
addr += size_section(abfd, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1714,6 +1717,8 @@ extern void DEFUN_VOID(write_object_file)
|
|||||||
|
|
||||||
fill_section(abfd,&filehdr, &file_cursor);
|
fill_section(abfd,&filehdr, &file_cursor);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
filehdr.f_magic = COFF_MAGIC;
|
filehdr.f_magic = COFF_MAGIC;
|
||||||
filehdr.f_timdat = time(0);
|
filehdr.f_timdat = time(0);
|
||||||
filehdr.f_flags = COFF_FLAGS ;
|
filehdr.f_flags = COFF_FLAGS ;
|
||||||
@ -1858,7 +1863,7 @@ DEFUN(c_line_new,(symbol, paddr, line_number, frag),
|
|||||||
|
|
||||||
if (line_number == 0)
|
if (line_number == 0)
|
||||||
{
|
{
|
||||||
last_line_symbol = symbol;
|
last_line_symbol = symbol;
|
||||||
new_line->line.l_addr.l_symndx = (long)symbol;
|
new_line->line.l_addr.l_symndx = (long)symbol;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1878,7 +1883,7 @@ last_line_symbol = symbol;
|
|||||||
{
|
{
|
||||||
s->lineno_list_tail->next = new_line;
|
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 ++;
|
return LINESZ * s->scnhdr.s_nlnno ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,10 @@ const pseudo_typeS
|
|||||||
{ "reg", s_lsym, 0 }, /* Register equate, same as equ */
|
{ "reg", s_lsym, 0 }, /* Register equate, same as equ */
|
||||||
{ "space", s_ignore, 0 }, /* Listing control */
|
{ "space", s_ignore, 0 }, /* Listing control */
|
||||||
{ "sect", s_ignore, 0 }, /* Creation of coff sections */
|
{ "sect", s_ignore, 0 }, /* Creation of coff sections */
|
||||||
|
#ifndef OBJ_COFF
|
||||||
|
/* We can do this right with coff */
|
||||||
{ "use", s_use, 0 },
|
{ "use", s_use, 0 },
|
||||||
|
#endif
|
||||||
{ "word", cons, 4 },
|
{ "word", cons, 4 },
|
||||||
{ NULL, 0, 0 },
|
{ NULL, 0, 0 },
|
||||||
};
|
};
|
||||||
@ -365,34 +368,18 @@ char *
|
|||||||
char *s;
|
char *s;
|
||||||
expressionS *operandp;
|
expressionS *operandp;
|
||||||
{
|
{
|
||||||
char *save = input_line_pointer;
|
char *save = input_line_pointer;
|
||||||
char *new;
|
char *new;
|
||||||
segT seg;
|
segT seg;
|
||||||
|
|
||||||
input_line_pointer = s;
|
input_line_pointer = s;
|
||||||
seg = expr (0, operandp);
|
seg = expr (0, operandp);
|
||||||
new = input_line_pointer;
|
new = input_line_pointer;
|
||||||
input_line_pointer = save;
|
input_line_pointer = save;
|
||||||
|
|
||||||
switch (seg) {
|
if (seg == SEG_ABSENT)
|
||||||
case SEG_ABSOLUTE:
|
as_bad("Missing operand");
|
||||||
case SEG_TEXT:
|
return new;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Instruction parsing. Takes a string containing the opcode.
|
/* Instruction parsing. Takes a string containing the opcode.
|
||||||
|
Reference in New Issue
Block a user