Fix score bugs

This commit is contained in:
Nick Clifton 2006-10-19 15:47:34 +00:00
parent 6870500c04
commit b354976135
8 changed files with 62 additions and 58 deletions

View File

@ -1,3 +1,12 @@
2006-10-19 Mei Ligang <ligang@sunnorth.com.cn>
* elf32-score.c (score_elf_rel_dyn_section): Replace
bfd_make_section with bfd_make_section_with_flags.
(_bfd_score_elf_create_dynamic_sections): Ditto.
(score_elf_create_got_section): Ditto.
(score_elf_final_link_relocate): Delete referrence to
EF_SCORE_HASENTRY.
2006-10-19 Richard Sandiford <richard@codesourcery.com>
* elfxx-mips.c (sort_dynamic_relocs): Sort relocations against the

View File

@ -1141,20 +1141,19 @@ score_elf_rel_dyn_section (bfd *dynobj, bfd_boolean create_p)
sreloc = bfd_get_section_by_name (dynobj, dname);
if (sreloc == NULL && create_p)
{
sreloc = bfd_make_section (dynobj, dname);
sreloc = bfd_make_section_with_flags (dynobj, dname,
(SEC_ALLOC
| SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY
| SEC_LINKER_CREATED
| SEC_READONLY));
if (sreloc == NULL
|| ! bfd_set_section_flags (dynobj, sreloc,
(SEC_ALLOC
| SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY
| SEC_LINKER_CREATED
| SEC_READONLY))
|| ! bfd_set_section_alignment (dynobj, sreloc, SCORE_ELF_LOG_FILE_ALIGN (dynobj)))
|| ! bfd_set_section_alignment (dynobj, sreloc,
SCORE_ELF_LOG_FILE_ALIGN (dynobj)))
return NULL;
}
return sreloc;
return sreloc;
}
static void
@ -1350,9 +1349,8 @@ score_elf_create_got_section (bfd *abfd,
/* We have to use an alignment of 2**4 here because this is hardcoded
in the function stub generation and in the linker script. */
s = bfd_make_section (abfd, ".got");
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags)
s = bfd_make_section_with_flags (abfd, ".got", flags);
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 4))
return FALSE;
@ -1929,15 +1927,6 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
r_type = ELF32_R_TYPE (rel->r_info);
rel_addr = (input_section->output_section->vma + input_section->output_offset + rel->r_offset);
/* If the start address has been set, then set the EF_SCORE_HASENTRY
flag. Setting this more than once is redundant, but the cost is
not too high, and it keeps the code simple.
The test is done here, rather than somewhere else, because the
start address is only set just before the final link commences.
Note - if the user deliberately sets a start address of 0, the flag will not be set. */
if (bfd_get_start_address (output_bfd) != 0)
elf_elfheader (output_bfd)->e_flags |= EF_SCORE_HASENTRY;
if (r_type == R_SCORE_GOT15)
{
const Elf_Internal_Rela *relend;
@ -3173,9 +3162,9 @@ _bfd_score_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
/* Create .stub section. */
if (bfd_get_section_by_name (abfd, SCORE_ELF_STUB_SECTION_NAME) == NULL)
{
s = bfd_make_section (abfd, SCORE_ELF_STUB_SECTION_NAME);
s = bfd_make_section_with_flags (abfd, SCORE_ELF_STUB_SECTION_NAME,
flags | SEC_CODE);
if (s == NULL
|| !bfd_set_section_flags (abfd, s, flags | SEC_CODE)
|| !bfd_set_section_alignment (abfd, s, 2))
return FALSE;

View File

@ -1,3 +1,8 @@
2006-10-19 Mei Ligang <ligang@sunnorth.com.cn>
* config/tc-score.c (build_relax_frag): Compute correct
tc_frag_data.fixp.
2006-10-18 Roy Marples <uberlord@gentoo.org>
* config/tc-sparc.c (md_parse_option): Treat any target starting with

View File

@ -691,7 +691,7 @@ void
md_show_usage (stream)
FILE *stream;
{
fprintf (stream, _("MN10300 options:\n\
fprintf (stream, _("MN10300 assembler options:\n\
none yet\n"));
}

View File

@ -3602,7 +3602,7 @@ build_relax_frag (struct score_it fix_insts[RELAX_INST_NUM], int fix_num ATTRIBU
int i;
char *p;
fixS *fixp = NULL;
fixS *head_fixp = NULL;
fixS *cur_fixp = NULL;
long where;
struct score_it inst_main;
@ -3638,19 +3638,11 @@ build_relax_frag (struct score_it fix_insts[RELAX_INST_NUM], int fix_num ATTRIBU
md_number_to_chars (p, inst_main.instruction, inst_main.size);
if (inst_main.reloc.type != BFD_RELOC_NONE)
{
fixp = fix_new_score (frag_now, p - frag_now->fr_literal, inst_main.size,
&inst_main.reloc.exp, inst_main.reloc.pc_rel, inst_main.reloc.type);
}
fixp = fix_new_score (frag_now, p - frag_now->fr_literal, inst_main.size,
&inst_main.reloc.exp, inst_main.reloc.pc_rel, inst_main.reloc.type);
head_fixp = xmalloc (sizeof (fixS *));
frag_now->tc_frag_data.fixp = head_fixp;
if (fixp)
{
head_fixp->fx_next = fixp;
head_fixp = head_fixp->fx_next;
}
frag_now->tc_frag_data.fixp = fixp;
cur_fixp = frag_now->tc_frag_data.fixp;
#ifdef OBJ_ELF
dwarf2_emit_insn (inst_main.size);
@ -3669,16 +3661,20 @@ build_relax_frag (struct score_it fix_insts[RELAX_INST_NUM], int fix_num ATTRIBU
var_insts[i].reloc.type);
if (fixp)
{
head_fixp->fx_next = fixp;
head_fixp = head_fixp->fx_next;
if (cur_fixp)
{
cur_fixp->fx_next = fixp;
cur_fixp = cur_fixp->fx_next;
}
else
{
frag_now->tc_frag_data.fixp = fixp;
cur_fixp = frag_now->tc_frag_data.fixp;
}
}
}
}
head_fixp = frag_now->tc_frag_data.fixp;
frag_now->tc_frag_data.fixp = head_fixp->fx_next;
free (head_fixp);
p = frag_var (rs_machine_dependent, inst_main.relax_size + RELAX_PAD_BYTE, 0,
RELAX_ENCODE (inst_main.size, inst_main.relax_size, inst_main.type,
0, inst_main.size, 0), add_symbol, 0, NULL);

View File

@ -1,3 +1,9 @@
2006-10-19 Mei Ligang <ligang@sunnorth.com.cn>
* score.h (EF_SCORE_PIC): Redefine EF_SCORE_PIC as 0x80000000.
(EF_SCORE_FIXDEP): Redefine EF_SCORE_FIXDEP as 0x40000000.
(EF_SCORE_HASENTRY): Delete.
2006-09-17 Mei Ligang <ligang@sunnorth.com.cn>
* score.h: New file.

View File

@ -26,22 +26,21 @@
#include "elf/reloc-macros.h"
#define SCORE_SIMULATOR_ACTIVE 1
#define OPC_PTMASK 0xc0000000 /* Parity-bit Mask */
#define OPC_PTMASK 0xc0000000 /* Parity-bit Mask. */
#define OPC16_PTMASK 0x00008000
/* The parity-bit denotes. */
#define OPC_32 0xc0000000 /* denotes 32b instruction, (default) */
#define OPC_16 0x00000000 /* denotes 16b instruction */
#define OPC_PE 0x8000 /* denotes parallel-execution instructions */
#define EF_SCORE_HASENTRY 0x02
#define OPC_32 0xc0000000 /* Denotes 32b instruction, (default). */
#define OPC_16 0x00000000 /* Denotes 16b instruction. */
#define OPC_PE 0x8000 /* Denotes parallel-execution instructions. */
#define GP_DISP_LABEL "_gp_disp"
/* Processor specific flags for the ELF header e_flags field. */
/* Fix data dependency. */
#define EF_SCORE_FIXDEP 0x00000001
/* Processor specific flags for the ELF header e_flags field: */
/* File contains position independent code. */
#define EF_SCORE_PIC 0x00000002
#define EF_SCORE_PIC 0x80000000
/* Fix data dependency. */
#define EF_SCORE_FIXDEP 0x40000000
/* Defined and allocated common symbol. Value is virtual address. If
relocated, alignment must be preserved. */

View File

@ -1251,9 +1251,9 @@ it ends in a @code{.exe} suffix.
@itemx --no-gc-sections
Enable garbage collection of unused input sections. It is ignored on
targets that do not support this option. This option is not compatible
with @samp{-r}. The default behaviour (of not performing this garbage
collection) can be restored by specifying @samp{--no-gc-sections} on
the command line.
with @samp{-r} or @samp{--emit-relocs}. The default behaviour (of not
performing this garbage collection) can be restored by specifying
@samp{--no-gc-sections} on the command line.
@kindex --print-gc-sections
@kindex --no-print-gc-sections