OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 403 to Rev 404
    Reverse comparison

Rev 403 → Rev 404

/openrisc/trunk/gnu-src/gcc-4.5.1/libgcc/config.host
448,7 → 448,7
or32-*-elf)
;;
or32-*linux*)
tmake_file="${cpu_type}/t-${cpu_type} or32/t-or32"
tmake_file="${cpu_type}/t-${cpu_type} or32/t-linux"
extra_parts="$extra_parts crti.o crtn.o"
;;
pdp11-*-*)
/openrisc/trunk/gnu-src/gcc-4.5.1/libgcc/config/or32/t-linux
0,0 → 1,11
MULTILIB_DIRNAMES = be
EXTRA_MULTILIB_PARTS = crti.o crtbegin.o crtend.o crtn.o
 
# hack:
# the non-shared uclibc-0.9.31/libc/misc/internals/__uClibc_main.c
# already defines __dso_handle. To avoid a duplicate definition,
# we rename the crtbegin one.
# amend gcc Makefile CLFAGS variable
$(T)crtbegin.o: CRTSTUFF_CFLAGS += '-D__dso_handle=__dso_handle_dummy'
# amend libgcc Makefile CLFAGS variable
crtbegin$(objext): CRTSTUFF_T_CFLAGS += '-D__dso_handle=__dso_handle_dummy'
/openrisc/trunk/gnu-src/gcc-4.5.1/libgcc/ChangeLog.or32
1,3 → 1,8
2010-11-01 Joern Rennecke <joern.rennecke@embecosm.com>
 
* config.host (or32-*linux*): Remove duplicate t-or32; add t-linux.
* config/or32/t-linux: New file.
 
2010-10-30 Joern Rennecke <joern.rennecke@embecosm.com>
 
* config.host (or32-*linux*): Handle new config.
/openrisc/trunk/gnu-src/gcc-4.5.1/gcc/ChangeLog.or32
2,6 → 2,10
 
* config/or32/or32.h (HANDLE_PRAGMA_PACK_PUSH_POP): Define.
 
* config/or32/t-linux ($(T)crtbegin.o): Rename __dso_handle.
 
(crtbegin$(objext)): Likewise.
 
2010-10-31 Joern Rennecke <joern.rennecke@embecosm.com>
 
* config/or32/or32.c (or32_struct_alignment): Refine rules to
/openrisc/trunk/gnu-src/gcc-4.5.1/gcc/config/or32/t-linux
1,2 → 1,11
MULTILIB_DIRNAMES = be
EXTRA_MULTILIB_PARTS = crti.o crtbegin.o crtend.o crtn.o
 
# hack:
# the non-shared uclibc-0.9.31/libc/misc/internals/__uClibc_main.c
# already defines __dso_handle. To avoid a duplicate definition,
# we rename the crtbegin one.
# amend gcc Makefile CLFAGS variable
$(T)crtbegin.o: CRTSTUFF_CFLAGS += '-D__dso_handle=__dso_handle_dummy'
# amend libgcc Makefile CLFAGS variable
crtbegin$(objext): CRTSTUFF_T_CFLAGS += '-D__dso_handle=__dso_handle_dummy'
/openrisc/trunk/gnu-src/gdb-7.2/sim/or32/Makefile.in
33,3 → 33,4
 
## COMMON_POST_CONFIG_FRAG
 
wrapper.o: targ-vals.h
/openrisc/trunk/gnu-src/gdb-7.2/sim/or32/ChangeLog
1,3 → 1,7
2010-11-02 Joern Rennecke <joern.rennecke@embecosm.com>
 
* Makefile.in (wrapper.o): Depend on targ-vals.h .
 
2010-09-20 Jeremy Bennett <jeremy.bennett@embecosm.com>
 
* wrapper.c (sim_read, sim_write). Corrected pointer print format.
/openrisc/trunk/gnu-src/gdb-7.2/bfd/elf32-or32.c
1,6 → 1,10
/* OR32-specific support for 32-bit ELF
Copyright 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
Copyright (C) 2010 Embecosm Limited
Contributed by Ivan Guzvinec <ivang@opencores.org>
Modified by Gyorgy Jeney <nog@sdf.lonestar.org> and
Balint Cristian <rezso@rdsor.ro>
Changed from Rel to Rela by Joern Rennecke <joern.rennecke@embecosm.com>.
 
This file is part of BFD, the Binary File Descriptor library.
 
24,11 → 28,16
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/or32.h"
#include "elf/common.h"
#include "libiberty.h"
 
/* We need RELA in order to handle highpart relocations independent of
the presence and/or location and/or value of a lowpart relocation. */
#if 0
/* Try to minimize the amount of space occupied by relocation tables
on the ROM (not that the ROM won't be swamped by other ELF overhead). */
#define USE_REL 1
#endif
 
/* Set the right machine number for an OR32 ELF file. */
 
46,11 → 55,19
or32_elf_final_write_processing (bfd *abfd,
bfd_boolean linker ATTRIBUTE_UNUSED)
{
/* Pad the output file so that the aligned reloc section addresses aren't
* outside the file */
unsigned long zero = 0;
if (bfd_seek (abfd, elf_tdata (abfd)->next_file_pos, SEEK_SET) != 0
|| bfd_bwrite (&zero, sizeof(zero), abfd) != sizeof(zero))
(*_bfd_error_handler) (_("%B: failed to ensure that reloc sections aren't outside file"), abfd);
 
elf_elfheader (abfd)->e_flags &=~ EF_OR32_MACH;
}
 
#if 0 /* Not needed for RELA. */
static bfd_reloc_status_type
or32_elf_32_reloc (bfd *abfd,
or32_elf_generic_reloc (bfd *abfd,
arelent *reloc_entry,
asymbol *symbol,
void * data,
58,81 → 75,64
bfd *output_bfd,
char **error_message ATTRIBUTE_UNUSED)
{
if (output_bfd != NULL)
{
unsigned long insn;
bfd_size_type addr = reloc_entry->address;
bfd_signed_vma val;
bfd_reloc_status_type status;
bfd_boolean relocatable;
 
reloc_entry->address += input_section->output_offset;
if (bfd_is_und_section (symbol->section) /*RGD fix linker undefined miss*/
&& output_bfd == (bfd *) NULL)
return bfd_reloc_undefined;
 
insn = bfd_get_32 (abfd, (bfd_byte *) data + addr);
insn += symbol->section->output_section->vma;
insn += symbol->section->output_offset;
insn += symbol->value;
bfd_put_32 (abfd, insn, (bfd_byte *) data + addr);
relocatable = (output_bfd != NULL);
 
return bfd_reloc_ok;
}
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
 
return bfd_reloc_continue;
}
/* Build up the field adjustment in VAL. */
val = 0;
if (!relocatable || (symbol->flags & BSF_SECTION_SYM) != 0)
{
/* Either we're calculating the final field value or we have a
relocation against a section symbol. Add in the section's
offset or address. */
val += symbol->section->output_section->vma;
val += symbol->section->output_offset;
}
if (!relocatable)
{
/* We're calculating the final field value. Add in the symbol's value
and, if pc-relative, subtract the address of the field itself. */
val += symbol->value;
if (reloc_entry->howto->pc_relative)
val -= input_section->output_section->vma;
}
 
static bfd_reloc_status_type
or32_elf_16_reloc (bfd *abfd,
arelent *reloc_entry,
asymbol *symbol,
void * data,
asection *input_section,
bfd *output_bfd,
char **error_message ATTRIBUTE_UNUSED)
{
if (output_bfd != NULL)
{
unsigned short insn;
bfd_size_type addr = reloc_entry->address;
if (reloc_entry->howto->pc_relative)
val -= input_section->output_offset;
/* VAL is now the final adjustment. If we're keeping this relocation
in the output file, and if the relocation uses a separate addend,
we just need to add VAL to that addend. Otherwise we need to add
VAL to the relocation field itself. */
if (relocatable && !reloc_entry->howto->partial_inplace)
reloc_entry->addend += val;
else
{
/* Add in the separate addend, if any. */
val += reloc_entry->addend;
/* Add VAL to the relocation field. */
status = _bfd_relocate_contents (reloc_entry->howto, abfd, val,
(bfd_byte *) data
+ reloc_entry->address);
if (status != bfd_reloc_ok)
return status;
}
if (relocatable)
reloc_entry->address += input_section->output_offset;
 
reloc_entry->address += input_section->output_offset;
 
insn = bfd_get_16 (abfd, (bfd_byte *) data + addr);
insn += symbol->section->output_section->vma;
insn += symbol->section->output_offset;
insn += symbol->value;
bfd_put_16 (abfd, insn, (bfd_byte *) data + addr);
 
return bfd_reloc_ok;
}
 
return bfd_reloc_continue;
return bfd_reloc_ok;
}
 
static bfd_reloc_status_type
or32_elf_8_reloc (bfd *abfd ATTRIBUTE_UNUSED,
arelent *reloc_entry,
asymbol *symbol,
void * data,
asection *input_section,
bfd *output_bfd,
char **error_message ATTRIBUTE_UNUSED)
{
if (output_bfd != NULL)
{
unsigned char insn;
bfd_size_type addr = reloc_entry->address;
 
reloc_entry->address += input_section->output_offset;
 
insn = bfd_get_8 (abfd, (bfd_byte *) data + addr);
insn += symbol->section->output_section->vma;
insn += symbol->section->output_offset;
insn += symbol->value;
bfd_put_8 (abfd, insn, (bfd_byte *) data + addr);
 
return bfd_reloc_ok;
}
 
return bfd_reloc_continue;
}
 
/* Do a R_OR32_CONSTH relocation. This has to be done in combination
with a R_OR32_CONST reloc, because there is a carry from the LO16 to
the HI16. Here we just save the information we need; we do the
145,8 → 145,9
struct or32_consth
{
struct or32_consth *next;
bfd_byte *addr;
bfd_vma addend;
bfd_byte *data;
asection *input_section;
arelent rel;
};
 
/* FIXME: This should not be a static variable. */
156,31 → 157,14
static bfd_reloc_status_type
or32_elf_consth_reloc (bfd *abfd ATTRIBUTE_UNUSED,
arelent *reloc_entry,
asymbol *symbol,
asymbol *symbol ATTRIBUTE_UNUSED,
void * data,
asection *input_section,
bfd *output_bfd,
char **error_message ATTRIBUTE_UNUSED)
{
bfd_reloc_status_type ret;
bfd_vma relocation;
struct or32_consth *n;
 
ret = bfd_reloc_ok;
 
if (bfd_is_und_section (symbol->section)
&& output_bfd == NULL)
ret = bfd_reloc_undefined;
 
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation = symbol->value;
 
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
relocation += reloc_entry->addend;
 
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
 
188,15 → 172,18
n = bfd_malloc (sizeof *n);
if (n == NULL)
return bfd_reloc_outofrange;
n->addr = (bfd_byte *) data + reloc_entry->address;
n->addend = relocation;
 
/* Push this reloc on the list of pending relocations */
n->next = or32_consth_list;
n->data = data;
n->input_section = input_section;
n->rel = *reloc_entry;
or32_consth_list = n;
 
if (output_bfd != NULL)
reloc_entry->address += input_section->output_offset;
 
return ret;
return bfd_reloc_ok;
}
 
/* Do a R_OR32_CONST relocation. This is a straightforward 16 bit
212,89 → 199,37
bfd *output_bfd,
char **error_message)
{
if (or32_consth_list != NULL)
{
struct or32_consth *l;
bfd_vma vallo;
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) & 0xffff;
while (or32_consth_list != NULL)
{
bfd_reloc_status_type ret;
struct or32_consth *hi;
 
l = or32_consth_list;
while (l != NULL)
{
unsigned long insn;
unsigned long val;
unsigned long vallo;
struct or32_consth *next;
hi = or32_consth_list;
 
/* Do the HI16 relocation. Note that we actually don't need
to know anything about the LO16 itself, except where to
find the low 16 bits of the addend needed by the LO16. */
insn = bfd_get_32 (abfd, l->addr);
vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address)
& 0xffff);
val = ((insn & 0xffff) << 16) + vallo;
val += l->addend;
/* VALLO is a signed 16-bit number. Bias it by 0x8000 so that any
carry or borrow will induce a change of +1 or -1 in the high part. */
hi->rel.addend += vallo;
 
insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
bfd_put_32 (abfd, insn, l->addr);
ret = or32_elf_generic_reloc (abfd, &hi->rel, symbol, hi->data,
hi->input_section, output_bfd,
error_message);
if (ret != bfd_reloc_ok)
return ret;
 
next = l->next;
free (l);
l = next;
}
 
or32_consth_list = NULL;
}
 
if (output_bfd != NULL)
{
unsigned long insn, tmp;
bfd_size_type addr = reloc_entry->address;
 
reloc_entry->address += input_section->output_offset;
 
insn = bfd_get_32 (abfd, (bfd_byte *) data + addr);
tmp = insn & 0x0000ffff;
tmp += symbol->section->output_section->vma;
tmp += symbol->section->output_offset;
tmp += symbol->value;
insn = (insn & 0xffff0000) | (tmp & 0x0000ffff);
bfd_put_32 (abfd, insn, (bfd_byte *) data + addr);
 
return bfd_reloc_ok;
}
 
/* Now do the LO16 reloc in the usual way. */
return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
or32_consth_list = hi->next;
free (hi);
}
return or32_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd,
error_message);
}
#endif
 
static bfd_reloc_status_type
or32_elf_jumptarg_reloc (bfd *abfd,
arelent *reloc_entry,
asymbol *symbol ATTRIBUTE_UNUSED,
void * data,
asection *input_section,
bfd *output_bfd,
char **error_message ATTRIBUTE_UNUSED)
{
if (output_bfd != NULL)
{
unsigned long insn, tmp;
bfd_size_type addr = reloc_entry->address;
 
reloc_entry->address += input_section->output_offset;
 
insn = bfd_get_32 (abfd, (bfd_byte *) data + addr);
tmp = insn | 0xfc000000;
tmp -= (input_section->output_offset >> 2);
insn = (insn & 0xfc000000) | (tmp & 0x03ffffff);
bfd_put_32 (abfd, insn, (bfd_byte *) data + addr);
 
return bfd_reloc_ok;
}
 
return bfd_reloc_continue;
}
 
static reloc_howto_type elf_or32_howto_table[] =
{
/* This reloc does nothing. */
320,10 → 255,10
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
or32_elf_32_reloc, /* special_function */
bfd_elf_generic_reloc, /* special_function */
"R_OR32_32", /* name */
FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
 
335,10 → 270,10
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
or32_elf_16_reloc, /* special_function */
bfd_elf_generic_reloc, /* special_function */
"R_OR32_16", /* name */
FALSE, /* partial_inplace */
0x0000ffff, /* src_mask */
FALSE, /* partial_inplace */
0, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
 
350,10 → 285,10
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
or32_elf_8_reloc, /* special_function */
bfd_elf_generic_reloc, /* special_function */
"R_OR32_8", /* name */
FALSE, /* partial_inplace */
0x000000ff, /* src_mask */
FALSE, /* partial_inplace */
0, /* src_mask */
0x000000ff, /* dst_mask */
FALSE), /* pcrel_offset */
 
365,10 → 300,10
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
or32_elf_const_reloc, /* special_function */
bfd_elf_generic_reloc, /* special_function */
"R_OR32_CONST", /* name */
FALSE, /* partial_inplace */
0x0000ffff, /* src_mask */
0, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
 
377,13 → 312,13
16, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
or32_elf_consth_reloc, /* special_function */
bfd_elf_generic_reloc, /* special_function */
"R_OR32_CONSTH", /* name */
FALSE, /* partial_inplace */
0xffff0000, /* src_mask */
0, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
 
394,13 → 329,13
28, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
or32_elf_jumptarg_reloc,/* special_function */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_OR32_JUMPTARG", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0x03ffffff, /* dst_mask */
TRUE), /* pcrel_offset */
FALSE), /* pcrel_offset */
 
/* GNU extension to record C++ vtable hierarchy. */
HOWTO (R_OR32_GNU_VTINHERIT, /* type */
433,6 → 368,104
FALSE), /* pcrel_offset */
};
 
static bfd_boolean
or32_relocate_section (bfd * output_bfd,
struct bfd_link_info *info,
bfd * input_bfd,
asection * input_section,
bfd_byte * contents,
Elf_Internal_Rela * relocs,
Elf_Internal_Sym * local_syms,
asection ** local_sections)
{
Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
Elf_Internal_Rela *rel= rel = relocs;
Elf_Internal_Rela *relend = relocs + input_section->reloc_count;
 
for (; rel < relend; rel++)
{
int r_type = ELF32_R_TYPE (rel->r_info);
reloc_howto_type *howto;
unsigned long r_symndx;
struct elf_link_hash_entry *h = NULL;
Elf_Internal_Sym *sym = NULL;
asection *sec = NULL;
bfd_vma relocation = 0;
bfd_reloc_status_type r;
const char *name = NULL;
 
if ((unsigned) r_type >= ARRAY_SIZE (elf_or32_howto_table))
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
 
if (r_type == R_OR32_GNU_VTENTRY
|| r_type == R_OR32_GNU_VTINHERIT)
continue;
 
howto = &elf_or32_howto_table[r_type];
r_symndx = ELF32_R_SYM (rel->r_info);
 
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
 
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
}
else
{
bfd_boolean unresolved_reloc, warned;
 
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h, sec, relocation,
unresolved_reloc, warned);
}
 
if (sec != NULL && elf_discarded_section (sec))
{
/* For relocs against symbols from removed linkonce sections,
or sections discarded by a linker script, we just want the
section contents zeroed. Avoid any special processing. */
_bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
rel->r_info = 0;
rel->r_addend = 0;
continue;
}
 
if (info->relocatable)
continue;
 
r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents,
rel->r_offset, relocation, rel->r_addend);
if (r != bfd_reloc_ok)
{
const char *msg = NULL;
 
switch (r)
{
/* FIXME: give useful messages for possible errors. */
default:
msg = _("internal error: unknown error");
break;
}
if (msg)
r = info->callbacks->warning
(info, msg, name, input_bfd, input_section, rel->r_offset);
 
if (!r)
return FALSE;
}
}
return TRUE;
}
 
/* Map BFD reloc types to OR32 ELF reloc types. */
 
struct or32_reloc_map
449,7 → 482,7
{ BFD_RELOC_8, R_OR32_8 },
{ BFD_RELOC_LO16, R_OR32_CONST },
{ BFD_RELOC_HI16, R_OR32_CONSTH },
{ BFD_RELOC_32_GOT_PCREL, R_OR32_JUMPTARG },
{ BFD_RELOC_28_PCREL_S2, R_OR32_JUMPTARG },
{ BFD_RELOC_VTABLE_INHERIT, R_OR32_GNU_VTINHERIT },
{ BFD_RELOC_VTABLE_ENTRY, R_OR32_GNU_VTENTRY },
};
495,6 → 528,10
r_type = ELF32_R_TYPE (dst->r_info);
BFD_ASSERT (r_type < (unsigned int) R_OR32_max);
cache_ptr->howto = &elf_or32_howto_table[r_type];
 
asymbol *s = *(cache_ptr->sym_ptr_ptr);
if (ELF32_R_SYM(dst->r_info) && (s->flags & BSF_SECTION_SYM))
cache_ptr->sym_ptr_ptr = s->section->symbol_ptr_ptr;
}
 
#define TARGET_LITTLE_SYM bfd_elf32_or32_little_vec
502,8 → 539,9
#define TARGET_BIG_SYM bfd_elf32_or32_big_vec
#define TARGET_BIG_NAME "elf32-or32"
#define ELF_ARCH bfd_arch_or32
#define ELF_MACHINE_CODE EM_OR32
#define ELF_MAXPAGESIZE 0x1000
#define ELF_MACHINE_CODE EM_OPENRISC
#define ELF_MACHINE_ALT1 EM_OR32
#define ELF_MAXPAGESIZE 0x2000
 
#define elf_info_to_howto 0
#define elf_info_to_howto_rel or32_info_to_howto_rel
510,5 → 548,7
#define elf_backend_object_p or32_elf_object_p
#define elf_backend_final_write_processing \
or32_elf_final_write_processing
#define elf_backend_rela_normal 1
#define elf_backend_relocate_section or32_relocate_section
 
#include "elf32-target.h"
/openrisc/trunk/gnu-src/gdb-7.2/bfd/config.bfd
1057,7 → 1057,7
targ_underscore=yes
;;
 
or32-*-elf)
or32-*-elf| or32-*-*linux* | or32-*-rtems)
targ_defvec=bfd_elf32_or32_big_vec
;;
 
/openrisc/trunk/gnu-src/gdb-7.2/bfd/ChangeLog.or32
0,0 → 1,18
2010-11-02 Jeremy Bennett <jeremy.bennett@embecosm.com>
 
* reloc.c: Add BFD_RELOC_28_PCREL_S2.
* config.bfd: Also match or32-*-*linux* and or32-*-rtems.
 
2010-10-29 Joern Rennecke <joern.rennecke@embecosm.com>
 
* elf32-or32.c: Add Embecosm Copyright notice.
 
2010-10-28 Joern Rennecke <joern.rennecke@embecosm.com>
 
* elf32-or32.c (USE_REL): Don't define.
(or32_elf_generic_reloc, struct or32_consth): Enclose in #if 0.
(or32_elf_consth_reloc, or32_elf_const_reloc): Likewise.
(elf_or32_howto_table): Change entries to reflect switch to RELA.
 
* elf32-or32.c (or32_relocate_section): New function.
(elf_backend_rela_normal, elf_backend_relocate_section): Define.
/openrisc/trunk/gnu-src/gdb-7.2/bfd/bfd-in2.h
2451,6 → 2451,7
BFD_RELOC_32_PCREL_S2,
BFD_RELOC_16_PCREL_S2,
BFD_RELOC_23_PCREL_S2,
BFD_RELOC_28_PCREL_S2,
 
/* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
the target word. These are used on the SPARC. */
/openrisc/trunk/gnu-src/gdb-7.2/bfd/reloc.c
1794,6 → 1794,8
BFD_RELOC_16_PCREL_S2
ENUMX
BFD_RELOC_23_PCREL_S2
ENUMX
BFD_RELOC_28_PCREL_S2
ENUMDOC
These PC-relative relocations are stored as word displacements --
i.e., byte displacements shifted right two bits. The 30-bit word
/openrisc/trunk/gnu-src/gdb-7.2/bfd/libbfd.h
931,6 → 931,7
"BFD_RELOC_32_PCREL_S2",
"BFD_RELOC_16_PCREL_S2",
"BFD_RELOC_23_PCREL_S2",
"BFD_RELOC_28_PCREL_S2",
"BFD_RELOC_HI22",
"BFD_RELOC_LO10",
"BFD_RELOC_GPREL16",
/openrisc/trunk/gnu-src/bld++.sh
0,0 → 1,442
#!/bin/bash
 
# Copyright (C) 2009, 2010 Embecosm Limited
# Copyright (C) 2010 ORSoC AB
 
# Contributor Joern Rennecke <joern.rennecke@embecosm.com>
# Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
# Contributor Julius Baxter <julius.baxter@orsoc.se>
 
# This file is a script to build key elements of the OpenRISC tool chain
 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option)
# any later version.
 
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
 
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
 
# The current version of GDB (7.1) is incompatible with the current version of
# binutils, so is built on its own.
component_dirs='binutils-2.20.1 newlib-1.18.0 gcc-4.5.1'
gdb_dir='gdb-7.2'
unified_src=srcw
build_dir=bld-or32
gdb_build_dir=bld-gdb
install_dir=/opt/or32-elf-new
or1ksim_dir=/opt/or1ksim-new
 
# Sanity check!
case ${unified_src} in
"")
prefix='.'
;;
 
*/*)
echo "/ in <dest> not implemented"
exit 1
;;
 
*..*)
echo ".. in <dest> not implemented"
exit 1
;;
*)
prefix='..'
;;
esac
 
# Assume we have hardware multiply and divide. OK for Or1ksim, not the default
# for the Verilog.
export CFLAGS_FOR_TARGET='-mhard-mul -mhard-div -O2 -g'
 
# If /proc/cpuinfo is avaliable, limit load to launch extra jobs to
# number of processors + 1. If /proc/cpuinfo is not available, we use a
# constant of 2.
make_n_jobs=`(echo processor;cat /proc/cpuinfo 2>/dev/null || \
echo processor) | grep -c processor`
make_load="-j $make_n_jobs -l $make_n_jobs"
 
# Parse options
 
# --force: Ensure the unified source directory and build directory are
# recreated.
# --prefix: Specify the install directory
# --scdir: Specify the unified source directory
# --builddir: Specify the build directory
# --gdb-builddir: Specify the build directory
# --or1ksim: Specify the or1ksim installation directory
# --no-newlib: Don't build newlib
# --nolink: Don't build the unified source directory
# --noconfig: Don't run configure
# --check: Run DejaGnu tests
# --noinstall: Don't run install
# --help: List these options and exit
doforce="false";
nolink="false";
noconfig="false";
docheck="false";
noinstall="false";
newlibconfigure="--with-newlib";
newlibmake="all-target-newlib all-target-libgloss";
newlibcheck="check-target-newlib check-target-libgloss";
newlibinstall="install-target-newlib install-target-libgloss";
 
until
opt=$1
case ${opt}
in
--force)
doforce="true";
;;
 
--prefix)
install_dir=$2;
shift;
;;
 
--srcdir)
unified_src=$2;
shift;
;;
 
--builddir)
build_dir=$2;
shift;
;;
 
--gdb-builddir)
gdb_build_dir=$2;
shift;
;;
 
--or1ksim)
or1ksim_dir=$2;
shift;
;;
 
--no-newlib)
newlibconfigure=;
newlibmake=;
newlibcheck=;
newlibinstall=;
;;
--nolink)
nolink="true";
;;
 
--noconfig)
noconfig="true";
;;
 
--check)
docheck="true";
;;
 
--noinstall)
noinstall="true";
;;
 
--help)
echo "Usage: sh bld.sh [options]"
echo ""
echo "Options:"
echo " --force Ensure the unified source directory and"
echo " build directory are recreated."
echo " --prefix <dir>: Specify the install directory"
echo " --scdir <dir: Specify the unified source directory"
echo " --builddir <dir>: Specify the build directory"
echo " --gdb-builddir <dir>: Specify the build directory"
echo " --or1ksim <dir>: Specify the Or1ksim installation"
echo " directory"
echo " --no-newlib Don't build newlib"
echo " --nolink Don't build the unified source"
echo " directory"
echo " --noconfig Don't run configure"
echo " --check: Run DejaGnu tests"
echo " --noinstall Don't run install"
echo " --help List these options and exit"
exit 0
;;
 
--*)
echo "unrecognized option \"$1\""
exit 1
;;
 
*)
opt=""
;;
esac;
[ -z "${opt}" ]
do
shift
done
 
# If --force was specified, delete the unified source and build directories
if [ "x$doforce" == "xtrue" ]
then
rm -rf ${unified_src} ${build_dir} ${gdb_build_dir}
fi
 
# ------------------------------------------------------------------------------
# Create a unified source directory. Currently we have to leave out GDB.
if [ "x$nolink" == "xfalse" ]
then
if [ -n "${unified_src}" ]
then
if [ ! -d ${unified_src} ]
then
if [ -e ${unified_src} ]
then
echo "${unified_src} is not a directory";
exit 1
fi
mkdir ${unified_src}
fi
fi
cd ${unified_src}
ignore_list=". .. CVS .svn"
for srcdir in ${component_dirs}
do
echo "Component: $srcdir"
case srcdir
in
/* | [A-Za-z]:[\\/]*)
;;
*)
srcdir="${prefix}/${srcdir}"
;;
esac
files=`ls -a ${srcdir}`
for f in ${files}
do
found=
for i in ${ignore_list}
do
if [ "$f" = "$i" ]
then
found=yes
fi
done
if [ -z "${found}" ]
then
echo "$f ..linked"
ln -s ${srcdir}/$f .
fi
done
 
ignore_list="${ignore_list} ${files}"
done
 
if [ $? != 0 ]
then
echo "failed to create ${unified_src}"
exit 1
fi
 
cd ..
fi
 
 
# ------------------------------------------------------------------------------
# Configure everything
if [ "x$noconfig" == "xfalse" ]
then
mkdir -p ${build_dir} && cd ${build_dir} && \
../${unified_src}/configure --target=or32-elf \
--with-pkgversion="OpenRISC 32-bit toolchain (built `date +%Y%m%d`)" \
--with-bugurl=http://www.opencores.org/ \
--with-or1ksim=${or1ksim_dir} \
${newlibconfigure} \
--enable-fast-install=N/A --disable-libssp \
--enable-languages=c,c++ --prefix=${install_dir}
 
if [ $? != 0 ]
then
echo "configure failed."
exit 1
fi
 
cd ..
 
# GDB has to be separately configured at present.
mkdir -p ${gdb_build_dir} && cd ${gdb_build_dir} && \
../${gdb_dir}/configure --target=or32-elf \
--with-pkgversion="OpenRISC 32-bit toolchain (built `date +%Y%m%d`)" \
--with-bugurl=http://www.opencores.org/ \
--with-or1ksim=${or1ksim_dir} \
${newlibconfigure} \
--enable-fast-install=N/A --disable-libssp \
--enable-languages=c --prefix=${install_dir}
 
if [ $? != 0 ]
then
echo "GDB configure failed."
exit 1
fi
 
cd ..
 
fi
 
# ------------------------------------------------------------------------------
# Make everything. GCC can handle parallel make, the others can't
cd ${build_dir}
 
make all-build all-binutils all-gas all-ld
if [ $? != 0 ]
then
echo "make (binutils) failed."
exit 1
fi
 
# Actually GCC seems to have minor problems at 4.5.1 with parallel make. We
# leave the structure here, since we'll reinstate it on a future release.
#make_load=""
 
make $make_load all-gcc
if [ $? != 0 ]
then
echo "make (GCC) failed."
exit 1
fi
 
make $make_load all-target-libgcc all-target-libstdc++-v3 ${newlibmake}
if [ $? != 0 ]
then
echo "make (libgcc and Newlib) failed."
exit 1
fi
 
# GDB and simulator have to be built separately at present.
cd ..
cd ${gdb_build_dir}
 
#parallel make for all-sim fails with:
#../../../gdb-7.2/sim/or32/wrapper.c:45:23: error: targ-vals.h: No such file or d
#make $make_load all-build all-sim all-gdb
make all-build all-sim all-gdb
if [ $? != 0 ]
then
echo "make (GDB) failed."
exit 1
fi
 
cd ..
 
# ------------------------------------------------------------------------------
# Optionally check everything. We do each target in turn and don't blow out
# here if the RC is not zero. Most of the test suites fail somewhere.
if [ "x${docheck}" == "xtrue" ]
then
export DEJAGNU=`pwd`/site.exp
 
cd {build_dir}
 
for tool_check in check-binutils check-gas check-ld check-gcc \
check-target-libgcc ${newlibcheck}
do
make ${tool_check}
 
if [ $? != 0 ];
then
echo "make ${tool_check} failed."
fi
done
 
# GDB has to be checked separately at present.
cd ..
cd ${gdb_build_dir}
 
make check-sim check-gdb
 
if [ $? != 0 ];
then
echo "make check-gdb failed."
fi
 
cd ..
fi
 
# ------------------------------------------------------------------------------
# Install everything
if [ "x${noinstall}" == "xfalse" ]
then
cd ${build_dir}
 
make install-binutils install-gas install-ld install-gcc \
install-target-libgcc install-target-libstdc++-v3 ${newlibinstall}
 
if [ $? != 0 ];
then
echo "make install failed."
exit 1
fi
 
# GDB has to be installed separately at present.
cd ..
cd ${gdb_build_dir}
 
make install-sim install-gdb
 
if [ $? != 0 ];
then
echo "make install (GDB) failed."
exit 1
fi
 
cd ..
fi
 
# ------------------------------------------------------------------------------
# If we have built newlib, move it. This means the target specific include
# directory and the crt0.o and libraries from the target specific lib
# directory.
 
# There is a catch here. If we are doing a rebuild, some of these files may
# have already been moved, and some no. So we check for their existence before
# doing the move.
if [ "x${newlibconfigure}" != "x" ]
then
mkdir -p ${install_dir}/or32-elf/newlib
rm -rf ${install_dir}/or32-elf/newlib-include
 
if [ -d ${install_dir}/or32-elf/include ]
then
mv ${install_dir}/or32-elf/include \
${install_dir}/or32-elf/newlib-include
fi
 
if [ -d ${install_dir}/or32-elf/lib ]
then
afiles=`ls -1 ${install_dir}/or32-elf/lib | grep '\.a' | head -1`
 
if [ "x$afiles" != "x" ]
then
mv ${install_dir}/or32-elf/lib/*.a ${install_dir}/or32-elf/newlib
fi
fi
 
if [ -f ${install_dir}/or32-elf/lib/crt0.o ]
then
mv ${install_dir}/or32-elf/lib/crt0.o ${install_dir}/or32-elf/newlib
fi
fi
 
# uClibc could be safely built and installed now
openrisc/trunk/gnu-src/bld++.sh Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: openrisc/trunk/gnu-src/bld-all.sh =================================================================== --- openrisc/trunk/gnu-src/bld-all.sh (nonexistent) +++ openrisc/trunk/gnu-src/bld-all.sh (revision 404) @@ -0,0 +1,939 @@ +#!/bin/bash + +# Copyright (C) 2009, 2010 Embecosm Limited +# Copyright (C) 2010 ORSoC AB + +# Contributor Joern Rennecke +# Contributor Jeremy Bennett +# Contributor Julius Baxter + +# This file is a script to build key elements of the OpenRISC tool chain + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3 of the License, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +# ------------------------------------------------------------------------------ +# This script builds two GNU C/C++ tool chains: + +# 1. With target or32-elf (fully or32-unknown-elf-newlib) for use on bare +# metal targets + +# 2. With target or32-linux (fully or32-unknown-linux-uclibc) for use with +# OpenRISC linux. + +# In both cases the binutils, gcc and C/C++ libraries are built using a +# unified source directory created by linking the top level directories from +# binutils and gcc. For the first tool chain, newlib and libgloss are also +# linked into the unified source directory. + +# GDB 7.2 does not have fully compatible binutils directories, so is built +# separately. + +# For the or32-linux tool chain, the system headers are needed to bootstrap +# the building of libgcc. This is achieved by a 2 stage process + +# 1. Configure, build and install gcc for C only for or32-linux using the host +# system's headers, installing into a temporary prefix. + +# 2. Clean the gcc build directory and reconfigure, build and install gcc for +# C and C++ using the headers from the temporary prefix. + +# Once this is complete, the Linux headers are installed and uClibc can be +# built. + +# The following arguments control how the script runs: + +# --force +# Ensure the unified source directory and build directories are recreated. + +# --prefix +# Specify the install directory (default /opt/or32-new) + +# --prefix-tmp +# Specify the temporary install directory (default /tmp/or32-tmp-${USER}). +# Incorporating the user name avoid name clashes with other users + +# --unisrc-dir +# Specify the unified source directory (default unisrc) + +# --build-dir-elf +# Specify the build directory for the newlib (or32-elf) tool chain +# (default bd-elf). + +# --build-dir-elf-gdb +# Specify the build directory for the newlib (or32-elf) GDB (default +# bd-elf-gdb). + +# --build-dir-linux +# Specify the build directory for the uClibc (or32-linux) tool chain +# (default bd-linux) + +# --build-dir-linux-gdb +# Specify the build directory for the uClibc (or32-linux) GDB (default +# bd-linux-gdb) + +# --or1ksim-dir +# Specify the Or1ksim installation directory. Used by GDB, which links in +# the Or1ksim simulator (default /opt/or1ksim-new) + +# --binutils-dir +# Source directory for binutils (default binutils-2.20.1) + +# --gcc-dir +# Source directory for gcc (default gcc-4.5.1') + +# --newlib-dir +# Source directory for newlib (default newlib-1.18.0) + +# --uclibc_dir +# Source directory for uClibc (default uclibc-0.9.31) + +# --gdb_dir +# Source directory for gdb (default gdb-7.2) + +# --linux_dir +# Source directory for Linux (default linux-2.6.35) + +# --no-or32-elf +# Don't configure, build and install the newlib (or32-elf) tool chain. + +# --no-or32-linux +# Don't configure, build and install the uClibc (or32-linux) tool chain. + +# --nolink +# Don't build the unified source directory (default is to build it) + +# --noconfig +# Don't run configure. Note that this will break the two stage build of +# gcc for Linux, so it should only be used if at least one of the uClibc +# stages is being omitted (default is to configure) + +# --nobuild +# Don't build any tools. Useful just to reinstall stuff (default is to +# build). + +# --check +# Run DejaGnu tests using the or32-elf tool chain (default do not run). + +# --noinstall +# Don't run install. Beware that this will omit the installation of Linux +# headers, required for uClibc building and the installation of headers +# from stage1 of gcc for Linux, required for stage2 of gcc for Linux. So +# only use if at least one of the uClibc stages is being omitted (default +# is to install). + +# --no-newlib +# Don't build newlib (default is to build newlib) + +# --no-uclibc +# Don't build uClibc (default is to build uClibc) + +# --no-uclibc-stage1 +# Don't do the stage1 build of gcc for Linux (default is to build stage1). + +# --no-uclibc-stage2 +# Don't do the stage2 build of gcc for Linux (default is to build stage2). + +# --help +# List these options and exit + +# In general global variables track each of these options. In addition the +# following global variables are used: + +# target - the current target (or32-elf or or32-linux). + + +# ------------------------------------------------------------------------------ +# Set the default values of all parameters +function set_defaults { + # Public params + force_flag="false" + prefix="/opt/or32-new" + prefix_tmp="/tmp/or32-tmp-${USER}" + unisrc_dir="unisrc" + bd_elf="bd-elf" + bd_elf_gdb="bd-elf-gdb" + bd_linux="bd-linux" + bd_linux_gdb="bd-linux-gdb" + or1ksim_dir="/opt/or1ksim-new" + binutils_dir="binutils-2.20.1" + gcc_dir="gcc-4.5.1" + newlib_dir="newlib-1.18.0" + uclibc_dir="uclibc-0.9.31" + gdb_dir="gdb-7.2" + linux_dir="linux-2.6.35" + or32_elf_flag="true" + or32_linux_flag="true" + link_flag="true" + config_flag="true" + build_flag="true" + check_flag="false" + install_flag="true" + newlib_flag="true" + uclibc_flag="true" + uclibc_stage1_flag="true" + uclibc_stage2_flag="true" + + # Consequential params + newlib_config="--with-newlib" + newlib_build="all-target-newlib all-target-libgloss" + newlib_check="check-target-newlib check-target-libgloss" + newlib_install="install-target-newlib install-target-libgloss" + + # Determine how many processes to use in parallel building. If + # /proc/cpuinfo is avaliable, limit load to launch extra jobs to number of + # processors + 1. If /proc/cpuinfo is not available, we use a constant of + # 2. + make_n_jobs=`(echo processor;cat /proc/cpuinfo 2>/dev/null || \ + echo processor) | grep -c processor` + make_load="-j $make_n_jobs -l $make_n_jobs" + unset make_n_jobs + +} # set_defaults () + + +# ------------------------------------------------------------------------------ +# Parse the arguments +function parse_args { + until + opt=$1 + case ${opt} + in + --force) + force_flag="true"; + ;; + + --prefix) + prefix=$2; + shift; + ;; + + --prefix-tmp) + prefix_tmp=$2; + shift; + ;; + + --unisrc_dir) + unisrc_dir=$2; + shift; + ;; + + --bd-elf) + bd_elf=$2; + shift; + ;; + + --bd-elf-gdb) + bd_elf_gdb=$2; + shift; + ;; + + --bd-linux) + bd_linux=$2; + shift; + ;; + + --bd-linux-gdb) + bd_linux_gdb=$2; + shift; + ;; + + --or1ksim-dir) + or1ksim_dir=$2; + shift; + ;; + + --binutils-dir) + binutils_dir=$2; + shift; + ;; + + --gcc-dir) + gcc_dir=$2; + shift; + ;; + + --newlib-dir) + newlib_dir=$2; + shift; + ;; + + --uclibc-dir) + uclibc_dir=$2; + shift; + ;; + + --gdb-dir) + gdb_dir=$2; + shift; + ;; + + --linux-dir) + linux_dir=$2; + shift; + ;; + + --no-or32-elf) + or32_elf_flag="false" + ;; + + --no-or32-linux) + or32_linux_flag="false" + ;; + + --nolink) + link_flag="false"; + ;; + + --noconfig) + config_flag="false"; + ;; + + --nobuild) + build_flag="false"; + ;; + + --check) + check_flag="true"; + ;; + + --noinstall) + install_flag="false"; + ;; + + --no-newlib) + newlib_flag="false"; + + newlib_config=""; + newlib_build=""; + newlib_check=""; + newlib_install=""; + ;; + + --no-uclibc) + uclibc_flag="false"; + ;; + + --no-uclibc-stage1) + uclibc_stage1_flag="false"; + ;; + + --no-uclibc-stage2) + uclibc_stage2_flag="false"; + ;; + + --help) + cat < + Specify the install directory (default /opt/or32-new) + +--prefix-tmp + Specify the temporary install directory (default /tmp/or32-tmp-${USER}). + Incorporating the user name avoid name clashes with other users + +--unisrc-dir + Specify the unified source directory (default unisrc) + +--build-dir-elf + Specify the build directory for the newlib (or32-elf) tool chain + (default bd-elf). + +--build-dir-elf-gdb + Specify the build directory for the newlib (or32-elf) GDB (default + bd-elf-gdb). + +--build-dir-linux + Specify the build directory for the uClibc (or32-linux) tool chain + (default bd-linux) + +--build-dir-linux-gdb + Specify the build directory for the uClibc (or32-linux) GDB (default + bd-linux-gdb) + +--or1ksim-dir + Specify the Or1ksim installation directory. Used by GDB, which links in + the Or1ksim simulator (default /opt/or1ksim-new) + +--binutils-dir + Source directory for binutils (default binutils-2.20.1) + +--gcc-dir + Source directory for gcc (default gcc-4.5.1') + +--newlib-dir + Source directory for newlib (default newlib-1.18.0) + +--uclibc_dir + Source directory for uClibc (default uclibc-0.9.31) + +--gdb_dir + Source directory for gdb (default gdb-7.2) + +--linux_dir + Source directory for Linux (default linux-2.6.35) + +--no-or32-elf + Don't configure, build and install the newlib (or32-elf) tool chain. + +--no-or32-linux + Don't configure, build and install the uClibc (or32-linux) tool chain. + +--nolink + Don't build the unified source directory (default is to build it) + +--noconfig + Don't run configure. Note that this will break the two stage build of + gcc for Linux, so it should only be used if at least one of the uClibc + stages is being omitted (default is to configure) + +--nobuild + Don't build any tools. Useful just to reinstall stuff (default is to + build). + +--check + Run DejaGnu tests using the or32-elf tool chain (default do not run). + +--noinstall + Don't run install. Beware that this will omit the installation of Linux + headers, required for uClibc building and the installation of headers + from stage1 of gcc for Linux, required for stage2 of gcc for Linux. So + only use if at least one of the uClibc stages is being omitted (default + is to install). + +--no-newlib + Don't build newlib (default is to build newlib) + +--no-uclibc + Don't build uClibc (default is to build uClibc) + +--no-uclibc-stage1 + Don't do the stage1 build of gcc for Linux (default is to build stage1). + +--no-uclibc-stage2 + Don't do the stage2 build of gcc for Linux (default is to build stage2). + +--help + List these options and exit +EOF + exit 0 + ;; + + --*) + echo "unrecognized option \"$1\"" + exit 1 + ;; + + *) + opt="" + ;; + esac; + [ -z "${opt}" ] + do + shift + done + +} # parse_args + + +# ------------------------------------------------------------------------------ +# Sanity check argument values +function sanity_check { + # Check unified source directory is meaningful if we are linking and that + # we can create it. + if [ "true" == "${link_flag}" ] + then + # Is it meaninful + case ${unisrc_dir} + in + "") + unisrc_prefix='.' + ;; + + */*) + echo "/ in unified source directory not implemented" + exit 1 + ;; + + *..*) + echo ".. in unified source directory not implemented" + exit 1 + ;; + *) + unisrc_prefix='..' + ;; + esac + + # Check it's a directory, and if it doesn't exist that we can create + # it. + if [ -n "${unisrc_dir}" ] + then + if [ ! -d ${unisrc_dir} ] + then + if [ -e ${unisrc_dir} ] + then + echo "${unisrc_dir} is not a directory"; + exit 1 + fi + + mkdir ${unisrc_dir} + fi + fi + fi +} # sanity_check + + +# ------------------------------------------------------------------------------ +# Conditionally build the unified source directory. We know by now it's a +# viable and extant directory. +function link_unified { + if [ "true" == "${link_flag}" ] + then + mkdir -p ${unisrc_dir} + cd ${unisrc_dir} + ignore_list=". .. CVS .svn" + component_dirs="${binutils_dir} ${gcc_dir} ${newlib_dir}" + + for srcdir in ${component_dirs} + do + echo "Component: $srcdir" + case srcdir + in + /* | [A-Za-z]:[\\/]*) + ;; + + *) + srcdir="${unisrc_prefix}/${srcdir}" + ;; + esac + + files=`ls -a ${srcdir}` + + for f in ${files} + do + found= + + for i in ${ignore_list} + do + if [ "$f" = "$i" ] + then + found=yes + fi + done + + if [ -z "${found}" ] + then + echo "$f ..linked" + ln -s ${srcdir}/$f . + fi + done + + ignore_list="${ignore_list} ${files}" + done + + if [ $? != 0 ] + then + echo "failed to create ${unisrc_dir}" + exit 1 + fi + + unset component_dirs + unset ignore_list + cd .. + fi +} # link_unified + + +# ------------------------------------------------------------------------------ +# Conditionally configure a GNU source directory (could be the unified +# directory, or GDB) + +# @param[in] $1 "true" if we should execute this function +# @param[in] $2 The prefix to use for installation. +# @param[in] $3 The build directory to configure in. +# @param[in] $4 The source directory containing configure (relative to $1) +# @param[in] $5 The languages to configure for. +# @param[in] $6, ... Additional configure args. +function gnu_config { + cond=$1 + shift + + if [ "true" == ${cond} ] + then + this_prefix=$1 + shift + top_builddir=$1 + shift + top_srcdir=$1 + shift + langs=$1 + shift + + echo "bld-all.sh: gnu_config ${top_builddir} ${top_srcdir} ${langs} $*" + + verstr="OpenRISC 32-bit toolchain for ${target} (built `date +%Y%m%d`)" + + mkdir -p ${top_builddir} && \ + cd ${top_builddir} && \ + ${top_srcdir}/configure --target=${target} \ + --with-pkgversion="${verstr}" \ + --with-bugurl=http://www.opencores.org/ \ + --with-or1ksim=${or1ksim_dir} \ + --enable-fast-install=N/A --disable-libssp \ + --enable-languages=${langs} --prefix=${this_prefix} $* + + if [ $? != 0 ] + then + echo "configure failed." + exit 1 + fi + + cd .. + + unset verstr + unset langs + unset top_srcdir + unset top_builddir + unset this_prefix + fi + + unset cond + +} # gnu_config + + +# ------------------------------------------------------------------------------ +# Conditionally run make and check the result. + +# @param[in] $1 "true" if we should execute this function +# @param[in] $2 The build directory to make in +# @param[in] $3, ... The targets to make +function gnu_make { + cond=$1 + shift + + if [ "true" == ${cond} ] + then + echo "bld-all.sh: gnu_make $*" + + cd $1 + shift + + make $make_load $* + + if [ $? != 0 ] + then + echo "make ($*) failed." + exit 1 + fi + + cd .. + fi + + unset cond + +} # gnu_make + + +# ------------------------------------------------------------------------------ +# Conditionally relocate the newlib headers and libraries. +function relocate_newlib { + if [ "true" == "${newlib_flag}" ] + then + echo "bld-all.sh: Relocating newlib" + + mkdir -p ${prefix}/or32-elf/newlib + rm -rf ${prefix}/or32-elf/newlib-include + + if [ -d ${prefix}/or32-elf/include ] + then + mv ${prefix}/or32-elf/include \ + ${prefix}/or32-elf/newlib-include + fi + + if [ -d ${prefix}/or32-elf/lib ] + then + afiles=`ls -1 ${prefix}/or32-elf/lib | grep '\.a' | head -1` + + if [ "x$afiles" != "x" ] + then + mv ${prefix}/or32-elf/lib/*.a ${prefix}/or32-elf/newlib + fi + fi + + if [ -f ${prefix}/or32-elf/lib/crt0.o ] + then + mv ${prefix}/or32-elf/lib/crt0.o ${prefix}/or32-elf/newlib + fi + fi +} # relocate_newlib + + +# ------------------------------------------------------------------------------ +# Conditionally configure and install the Linux headers + +# @param[in] $1 The prefix to use for installation. +function install_linux_headers { + this_prefix=$1 + + cd $linux_dir + + if [ "true" == "${config_flag}" ] + then + echo "bld-all.sh: Configuring Linux headers" + + make ARCH=or32 defconfig + + if [ $? != 0 ]; + then + echo "Linux configure failed" + exit 1 + fi + fi + + # This is a bit iffy. We do rely on the headers being installed for uClibc + # to build, so not installing the first time would be a bit dodgy. + if [ "true" == "${install_flag}" ] + then + echo "bld-all.sh: Installing Linux headers" + + make INSTALL_HDR_PATH=${this_prefix}/or32-linux headers_install + + if [ $? != 0 ]; + then + echo "Linux header installation failed" + exit 1 + fi + + unset this_prefix + fi + + cd .. + +} # install_linux_headers + + +# ------------------------------------------------------------------------------ +# Conditionally configure uClibc + +# @param[in] $1 The prefix to use for installation. +function uclibc_config { + + if [ "true" == "${config_flag}" ] + then + this_prefix=$1 + echo "bld-all.sh: Configuring uClibc" + + cd ${uclibc_dir} + + kheaders="KERNEL_HEADERS=\\\"${this_prefix}\\/or32-linux\\/include\\\"" + devprefix="DEVEL_PREFIX=\\\"${this_prefix}\\/or32-linux\\\"" + ccprefix="CROSS_COMPILER_PREFIX=\\\"or32-linux-\\\"" + + sed -i extra/Configs/defconfigs/or32 \ + -e "s|KERNEL_HEADERS.*|${kheaders}|g" \ + -e "s|DEVEL_PREFIX.*|${devprefix}|g" \ + -e "s|CROSS_COMPILER_PREFIX.*|${ccprefix}|g" + + if [ $? != 0 ]; + then + echo "uClibc sed failed" + exit 1 + fi + + make ARCH=or32 defconfig + + if [ $? != 0 ]; + then + echo "uClibc configure failed" + exit 1 + fi + + unset this_prefix + unset ccprefix + unset devprefix + unset kheaders + + cd .. + fi +} # uclibc_config + + +# ------------------------------------------------------------------------------ +# Conditionally build and install uClibc +function uclibc_build_install { + cd ${uclibc_dir} + + if [ "true" == "${build_flag}" ] + then + echo "bld-all.sh: Building uClibc" + + make ARCH=or32 all + + if [ $? != 0 ]; + then + echo "uClibc build failed" + exit 1 + fi + fi + + if [ "true" == "${install_flag}" ] + then + echo "bld-all.sh: Installing uClibc" + + make ARCH=or32 install + + if [ $? != 0 ]; + then + echo "uClibc install failed" + exit 1 + fi + fi + + cd .. + +} # uclibc_build_install + + +# ------------------------------------------------------------------------------ +# Main program +set_defaults +parse_args $* +sanity_check + +if [ "true" == "${force_flag}" ] +then + echo -n "bld-all.sh: removing ${unisrc_dir} ${bd_elf} ${bd_elf_gdb} " + echo "${bd_linux} ${bd_linux_gdb}" + rm -rf ${unisrc_dir} ${bd_elf} ${bd_elf_gdb} ${bd_linux} ${bd_linux_gdb} +fi + +link_unified + +# Build the newlib (or32-elf) tool chain. +if [ "true" == "${or32_elf_flag}" ] +then + target="or32-elf" + + echo "bld-all.sh: or32-elf toolchain" + + # Configure all + gnu_config ${config_flag} ${prefix} ${bd_elf} ../${unisrc_dir} "c,c++" \ + "${newlib_config}" + gnu_config ${config_flag} ${prefix} ${bd_elf_gdb} ../${gdb_dir} "c,c++" + + # Build all + gnu_make ${build_flag} ${bd_elf} all-build all-binutils all-gas all-ld + gnu_make ${build_flag} ${bd_elf} all-gcc + gnu_make ${build_flag} ${bd_elf} all-target-libgcc all-target-libstdc++-v3 \ + ${newlib_build} + gnu_make ${build_flag} ${bd_elf_gdb} all-build all-sim all-gdb + + # Check all + gnu_make ${check_flag} ${bd_elf} check-binutils check-gas check-ld \ + check-gcc check-target-libgcc check-target-libstdc++-v3 ${newlib_check} + gnu_make ${check_flag} ${bd_elf_gdb} check-sim check-gdb + + # Install all + gnu_make ${install_flag} ${bd_elf} install-binutils install-gas install-ld \ + install-gcc install-target-libgcc install-target-libstdc++-v3 \ + ${newlib_install} + gnu_make ${install_flag} ${bd_elf_gdb} install-sim install-gdb + relocate_newlib +fi + +# Build the uClibc (or32-linux) tool chain +if [ "true" == "${or32_linux_flag}" ] +then + target="or32-linux" + + echo "bld-all.sh: or32-linux toolchain" + + # Stage 1 binutils/GCC build uses no headers and only C + # language. This is just to create the libc headers, which we put in the + # temporary prefix directory. + if [ "true" == "${uclibc_stage1_flag}" ] + then + echo "bld-all.sh: uClibc GCC stage 1" + + # Make a clean temporary install directory. + rm -rf ${prefix_tmp} + mkdir ${prefix_tmp} + + gnu_config ${config_flag} ${prefix_tmp} ${bd_linux} ../${unisrc_dir} \ + "c" "--without-headers --enable-threads=single" + gnu_make ${build_flag} ${bd_linux} all-build all-binutils all-gas all-ld + gnu_make ${build_flag} ${bd_linux} all-gcc + gnu_make ${build_flag} ${bd_linux} all-target-libgcc + gnu_make ${install_flag} ${bd_linux} install-binutils install-gas \ + install-ld + gnu_make ${install_flag} ${bd_linux} install-gcc install-target-libgcc + + # Create the headers using our temporary tool chain + save_path="${PATH}" + export PATH="${prefix_tmp}/bin:${PATH}" + install_linux_headers ${prefix_tmp} + uclibc_config ${prefix_tmp} + uclibc_build_install + PATH="${save_path}" + unset save_path + fi + + # If we are doing both stage 1 and stage 2, then we need to completely + # clean gcc and target libraries. Just blow the entire directory away. + if [ "truetrue" == "${uclibc_stage1_flag}${uclibc_stage2_flag}" ] + then + echo "bld-all.sh: uClibc GCC inter-stage cleaning" + rm -rf ${bd_linux}/gcc ${bd_linux}/or32-linux + fi + + # Stage 2 GCC uses the headers installed from stage 1. + if [ "true" == "${uclibc_stage2_flag}" ] + then + echo "bld-all.sh: uClibc GCC stage 2" + + # FIXME: uclibc is supposed to provide thread support, but doesn't. + thread_hack="--disable-threads --disable-libgomp" + + gnu_config ${config_flag} ${prefix} ${bd_linux} ../${unisrc_dir} \ + "c,c++" \ + "--with-headers=${prefix_tmp}/or32-linux/include $thread_hack" + gnu_make ${build_flag} ${bd_linux} all-build all-binutils all-gas all-ld + gnu_make ${build_flag} ${bd_linux} all-gcc + gnu_make ${build_flag} ${bd_linux} all-target-libgcc + gnu_make ${install_flag} ${bd_linux} install-binutils install-gas \ + install-ld + gnu_make ${install_flag} ${bd_linux} install-gcc install-target-libgcc + + unset thread_hack + + # We need to build uClibc before building the C++ libraries, which in + # turn needs the Linux headers + export PATH=${prefix}/bin:${PATH} + install_linux_headers ${prefix} + uclibc_config ${prefix} + uclibc_build_install + + # Finish building the C++ library + gnu_make ${build_flag} ${bd_linux} all-target-libstdc++-v3 + gnu_make ${install_flag} ${bd_linux} install-target-libstdc++-v3 + fi + + # Configure, build and install GDB (note we need to reconfigure in case + # only stage1 has been run previously). + gnu_config ${config_flag} ${prefix} ${bd_linux_gdb} ../${gdb_dir} "c,c++" + gnu_make ${build_flag} ${bd_linux_gdb} all-build all-sim all-gdb + gnu_make ${install_flag} ${bd_linux_gdb} install-sim install-gdb +fi
openrisc/trunk/gnu-src/bld-all.sh Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: openrisc/trunk/gnu-src/binutils-2.20.1/ld/ldlex.c =================================================================== --- openrisc/trunk/gnu-src/binutils-2.20.1/ld/ldlex.c (revision 403) +++ openrisc/trunk/gnu-src/binutils-2.20.1/ld/ldlex.c (revision 404) @@ -1,5 +1,5 @@ -#line 3 "../../srcw/ld/ldlex.c" +#line 3 "../../unisrc/ld/ldlex.c" #define YY_INT_ALIGNED short int @@ -1655,7 +1655,7 @@ -#line 1659 "../../srcw/ld/ldlex.c" +#line 1659 "../../unisrc/ld/ldlex.c" #define INITIAL 0 #define SCRIPT 1 @@ -1752,7 +1752,7 @@ /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1864,7 +1864,7 @@ } } -#line 1868 "../../srcw/ld/ldlex.c" +#line 1868 "../../unisrc/ld/ldlex.c" if ( !(yy_init) ) { @@ -3031,7 +3031,7 @@ #line 463 "ldlex.l" ECHO; YY_BREAK -#line 3035 "../../srcw/ld/ldlex.c" +#line 3035 "../../unisrc/ld/ldlex.c" case YY_END_OF_BUFFER: {

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.