This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 06/12] Add support for microblaze little-endian
From: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Add microblazeel target support.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
---
ChangeLog | 4 +
bfd/ChangeLog | 6 ++
bfd/config.bfd | 6 ++
bfd/configure | 1 +
bfd/configure.in | 1 +
bfd/elf32-microblaze.c | 127 ++++++++++++++++++++++++------------
bfd/targets.c | 1 +
config.sub | 9 ++-
gas/ChangeLog | 6 ++
gas/config/tc-microblaze.c | 11 +++
gas/config/tc-microblaze.h | 4 +-
gas/configure.tgt | 3 +-
ld/ChangeLog | 8 ++
ld/Makefile.am | 7 ++
ld/Makefile.in | 7 ++
ld/configure.tgt | 15 ++++-
ld/emulparams/elf32mb_linux.sh | 2 +
ld/emulparams/elf32mbel_linux.sh | 18 +++++
ld/emulparams/elf32microblaze.sh | 2 +
ld/emulparams/elf32microblazeel.sh | 23 +++++++
20 files changed, 210 insertions(+), 51 deletions(-)
create mode 100644 ld/emulparams/elf32mbel_linux.sh
create mode 100644 ld/emulparams/elf32microblazeel.sh
diff --git a/ChangeLog b/ChangeLog
index c662948..8b19374 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-10-10 Edgar E. Iglesias <edgar.iglesias@gmail.com>
+
+ * config.sub: Add microblaze little endian support
+
2012-08-26 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/4970
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6a3dbd3..75d40c9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2012-10-10 Edgar E. Iglesias <edgar.iglesias@gmail.com>
+ * elf32-microblaze.c: Add microblaze little endian support
+ * target.c: Likewise
+ * config.bfd, configure, configure.in: Likewise
+
+2012-10-10 Edgar E. Iglesias <edgar.iglesias@gmail.com>
+
* bfd/elf32-microblaze.c: Correct adjustment of global symbols
after linker relaxation
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 6025f26..ce8acd6 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -915,8 +915,14 @@ case "${targ}" in
targ_selvecs=bfd_elf32_mep_little_vec
;;
+ microblazeel*-*)
+ targ_defvec=bfd_elf32_microblazeel_vec
+ targ_selvecs=bfd_elf32_microblaze_vec
+ ;;
+
microblaze*-*)
targ_defvec=bfd_elf32_microblaze_vec
+ targ_selvecs=bfd_elf32_microblazeel_vec
;;
mips*-big-*)
diff --git a/bfd/configure b/bfd/configure
index 7ddc696..2a6aff7 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -15267,6 +15267,7 @@ do
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mep_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;;
bfd_elf32_mep_little_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;;
+ bfd_elf32_microblazeel_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
bfd_elf32_microblaze_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
diff --git a/bfd/configure.in b/bfd/configure.in
index e3ff539..49c4e91 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -759,6 +759,7 @@ do
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mep_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;;
bfd_elf32_mep_little_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;;
+ bfd_elf32_microblazeel_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
bfd_elf32_microblaze_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index 487977e..b0f6cec 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -702,6 +702,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
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, *relend;
+ int endian = !bfd_little_endian (output_bfd) * 2;
/* Assume success. */
bfd_boolean ret = TRUE;
asection *sreloc;
@@ -933,9 +934,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
+ offset + INST_WORD_SIZE);
relocation += addend;
bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
- contents + offset + 2);
+ contents + offset + endian);
bfd_put_16 (input_bfd, relocation & 0xffff,
- contents + offset + 2 + INST_WORD_SIZE);
+ contents + offset + endian + INST_WORD_SIZE);
break;
case (int) R_MICROBLAZE_PLT_64:
@@ -952,9 +953,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
+ input_section->output_offset
+ offset + INST_WORD_SIZE);
bfd_put_16 (input_bfd, (immediate >> 16) & 0xffff,
- contents + offset + 2);
+ contents + offset + endian);
bfd_put_16 (input_bfd, immediate & 0xffff,
- contents + offset + 2 + INST_WORD_SIZE);
+ contents + offset + endian + INST_WORD_SIZE);
}
else
{
@@ -963,9 +964,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
+ offset + INST_WORD_SIZE);
immediate = relocation;
bfd_put_16 (input_bfd, (immediate >> 16) & 0xffff,
- contents + offset + 2);
+ contents + offset + endian);
bfd_put_16 (input_bfd, immediate & 0xffff,
- contents + offset + 2 + INST_WORD_SIZE);
+ contents + offset + endian + INST_WORD_SIZE);
}
break;
}
@@ -1031,9 +1032,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
abort (); /* ??? */
}
bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
- contents + offset + 2);
+ contents + offset + endian);
bfd_put_16 (input_bfd, relocation & 0xffff,
- contents + offset + 2 + INST_WORD_SIZE);
+ contents + offset + endian + INST_WORD_SIZE);
break;
}
@@ -1048,8 +1049,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
immediate = relocation;
lo = immediate & 0x0000ffff;
high = (immediate >> 16) & 0x0000ffff;
- bfd_put_16 (input_bfd, high, contents + offset + 2);
- bfd_put_16 (input_bfd, lo, contents + offset + INST_WORD_SIZE + 2);
+ bfd_put_16 (input_bfd, high, contents + offset + endian);
+ bfd_put_16 (input_bfd, lo, contents + offset + INST_WORD_SIZE + endian);
break;
}
@@ -1082,9 +1083,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
+ input_section->output_offset
+ offset + INST_WORD_SIZE);
bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
- contents + offset + 2);
+ contents + offset + endian);
bfd_put_16 (input_bfd, relocation & 0xffff,
- contents + offset + 2 + INST_WORD_SIZE);
+ contents + offset + endian + INST_WORD_SIZE);
}
break;
}
@@ -1176,9 +1177,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
+ input_section->output_offset
+ offset + INST_WORD_SIZE);
bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
- contents + offset + 2);
+ contents + offset + endian);
bfd_put_16 (input_bfd, relocation & 0xffff,
- contents + offset + 2 + INST_WORD_SIZE);
+ contents + offset + endian + INST_WORD_SIZE);
}
break;
}
@@ -1253,6 +1254,21 @@ microblaze_elf_relocate_section (bfd *output_bfd,
return ret;
}
+
+/* Merge backend specific data from an object file to the output
+ object file when linking.
+
+ Note: We only use this hook to catch endian mismatches */
+static bfd_boolean
+microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
+{
+ /* Check if we have the same endianess. */
+ if (! _bfd_generic_verify_endian_match (ibfd, obfd))
+ return FALSE;
+
+ return TRUE;
+}
+
/* Calculate fixup value for reference. */
@@ -1300,6 +1316,36 @@ calc_fixup (bfd_vma addr, asection *sec)
return fixup;
}
+/* Read-modify-write into the bfd, an immediate value into appropriate fields of a 32-bit
+ * instruction. */
+static void
+microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
+{
+ unsigned long instr = bfd_get_32 (abfd, bfd_addr);
+ instr &= ~0x0000ffff;
+ instr |= (val & 0x0000ffff);
+ bfd_put_32 (abfd, instr, bfd_addr);
+}
+
+/* Read-modify-write into the bfd, an immediate value into appropriate fields of
+ * two consecutive 32-bit instructions. */
+static void
+microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
+{
+ unsigned long instr_hi;
+ unsigned long instr_lo;
+
+ instr_hi = bfd_get_32 (abfd, bfd_addr);
+ instr_hi &= ~0x0000ffff;
+ instr_hi |= ((val >> 16) & 0x0000ffff);
+ bfd_put_32 (abfd, instr_hi, bfd_addr);
+
+ instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE);
+ instr_lo &= ~0x0000ffff;
+ instr_lo |= (val & 0x0000ffff);
+ bfd_put_32 (abfd, instr_lo, bfd_addr + INST_WORD_SIZE);
+}
+
static bfd_boolean
microblaze_elf_relax_section (bfd *abfd,
asection *sec,
@@ -1330,7 +1376,8 @@ microblaze_elf_relax_section (bfd *abfd,
/* Only do this for a text section. */
if (link_info->relocatable
|| (sec->flags & SEC_RELOC) == 0
- || (sec->reloc_count == 0))
+ || (sec->reloc_count == 0)
+ || (sec->flags & SEC_CODE) == 0)
return TRUE;
BFD_ASSERT ((sec->size > 0) || (sec->rawsize > 0));
@@ -1511,7 +1558,8 @@ microblaze_elf_relax_section (bfd *abfd,
efix = calc_fixup (target_address, sec);
irel->r_addend -= (efix - sfix);
/* Should use HOWTO. */
- bfd_put_16 (abfd, irel->r_addend, contents + irel->r_offset + 2);
+ microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
+ irel->r_addend);
}
break;
case R_MICROBLAZE_64_NONE:
@@ -1524,8 +1572,9 @@ microblaze_elf_relax_section (bfd *abfd,
sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, sec);
efix = calc_fixup (target_address, sec);
irel->r_addend -= (efix - sfix);
- bfd_put_16 (abfd, irel->r_addend, contents + irel->r_offset
- + INST_WORD_SIZE + 2);
+ microblaze_bfd_write_imm_value_32 (abfd,
+ contents + irel->r_offset + INST_WORD_SIZE,
+ irel->r_addend);
}
break;
}
@@ -1653,13 +1702,13 @@ microblaze_elf_relax_section (bfd *abfd,
}
}
- immediate = (unsigned short) bfd_get_16 (abfd, ocontents +
- irelscan->r_offset + 2);
+ unsigned long instr = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
+ immediate = instr & 0x0000ffff;
target_address = immediate;
offset = calc_fixup (target_address, sec);
immediate -= offset;
irelscan->r_addend -= offset;
- bfd_put_16 (abfd, immediate, ocontents + irelscan->r_offset + 2);
+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, irelscan->r_addend);
}
}
@@ -1695,15 +1744,10 @@ microblaze_elf_relax_section (bfd *abfd,
elf_section_data (o)->this_hdr.contents = ocontents;
}
}
- immediate = (unsigned short) (bfd_get_16 (abfd, ocontents
- + irelscan->r_offset
- + 2) << 16)
- & 0xffff0000;
- immediate += (unsigned short) (bfd_get_16 (abfd, ocontents
- + irelscan->r_offset
- + INST_WORD_SIZE + 2))
- & 0x0000ffff;
-
+ unsigned long instr_hi = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
+ unsigned long instr_lo = bfd_get_32 (abfd, ocontents + irelscan->r_offset + INST_WORD_SIZE);
+ immediate = (instr_hi & 0x0000ffff) << 16;
+ immediate |= (instr_lo & 0x0000ffff);
offset = calc_fixup (irelscan->r_addend, sec);
immediate -= offset;
irelscan->r_addend -= offset;
@@ -1741,22 +1785,15 @@ microblaze_elf_relax_section (bfd *abfd,
elf_section_data (o)->this_hdr.contents = ocontents;
}
}
-
- immediate = (unsigned short)
- (bfd_get_16 (abfd, ocontents + irelscan->r_offset + 2) << 16)
- & 0xffff0000;
- immediate += (unsigned short)
- (bfd_get_16 (abfd, ocontents + irelscan->r_offset
- + INST_WORD_SIZE + 2))
- & 0x0000ffff;
+ unsigned long instr_hi = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
+ unsigned long instr_lo = bfd_get_32 (abfd, ocontents + irelscan->r_offset + INST_WORD_SIZE);
+ immediate = (instr_hi & 0x0000ffff) << 16;
+ immediate |= (instr_lo & 0x0000ffff);
target_address = immediate;
offset = calc_fixup (target_address, sec);
immediate -= offset;
irelscan->r_addend -= offset;
- bfd_put_16 (abfd, ((immediate >> 16) & 0x0000ffff),
- ocontents + irelscan->r_offset + 2);
- bfd_put_16 (abfd, (immediate & 0x0000ffff),
- ocontents + irelscan->r_offset + INST_WORD_SIZE + 2);
+ microblaze_bfd_write_imm_value_64 (abfd, ocontents + irelscan->r_offset, immediate);
}
}
}
@@ -1843,9 +1880,12 @@ microblaze_elf_relax_section (bfd *abfd,
if (sec->relax_count == 0)
{
+ *again = FALSE;
free (sec->relax);
sec->relax = NULL;
}
+ else
+ *again = TRUE;
return TRUE;
error_return:
@@ -3059,6 +3099,8 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
return TRUE;
}
+#define TARGET_LITTLE_SYM bfd_elf32_microblazeel_vec
+#define TARGET_LITTLE_NAME "elf32-microblazeel"
#define TARGET_BIG_SYM bfd_elf32_microblaze_vec
#define TARGET_BIG_NAME "elf32-microblaze"
@@ -3075,6 +3117,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
#define bfd_elf32_bfd_is_local_label_name microblaze_elf_is_local_label_name
#define elf_backend_relocate_section microblaze_elf_relocate_section
#define bfd_elf32_bfd_relax_section microblaze_elf_relax_section
+#define bfd_elf32_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data
#define bfd_elf32_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup
#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook
diff --git a/bfd/targets.c b/bfd/targets.c
index fa206d2..ce746f9 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -658,6 +658,7 @@ extern const bfd_target bfd_elf32_mcore_big_vec;
extern const bfd_target bfd_elf32_mcore_little_vec;
extern const bfd_target bfd_elf32_mep_vec;
extern const bfd_target bfd_elf32_mep_little_vec;
+extern const bfd_target bfd_elf32_microblazeel_vec;
extern const bfd_target bfd_elf32_microblaze_vec;
extern const bfd_target bfd_elf32_mn10200_vec;
extern const bfd_target bfd_elf32_mn10300_vec;
diff --git a/config.sub b/config.sub
index 59bb593..a4f0204 100755
--- a/config.sub
+++ b/config.sub
@@ -156,7 +156,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze)
+ -apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
@@ -273,7 +273,7 @@ case $basic_machine in
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep | metag \
+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -389,7 +389,8 @@ case $basic_machine in
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -788,7 +789,7 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
- microblaze)
+ microblaze*)
basic_machine=microblaze-xilinx
;;
mingw32)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index eeea5c9..73ec28a 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,11 @@
2012-10-10 Edgar E. Iglesias <edgar.iglesias@gmail.com>
+ * tc-microblaze.c: Add microblaze little endian support
+ * tc-microblaze.h: Likewise
+ * configure.tgt: Likewise
+
+2012-10-10 Edgar E. Iglesias <edgar.iglesias@gmail.com>
+
* config/tc-microblaze.c: INST_TYPE_RD_R1_SPECIAL -> INST_TYPE_R1_R2_SPECIAL
2012-10-10 David Holsgrove <david.holsgrove@xilinx.com>
diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
index 4f5fa1d..27bb7af 100644
--- a/gas/config/tc-microblaze.c
+++ b/gas/config/tc-microblaze.c
@@ -35,6 +35,9 @@
#define streq(a,b) (strcmp (a, b) == 0)
#endif
+#define OPTION_EB (OPTION_MD_BASE + 0)
+#define OPTION_EL (OPTION_MD_BASE + 1)
+
void microblaze_generate_symbol (char *sym);
static bfd_boolean check_spl_reg (unsigned *);
@@ -1706,6 +1709,8 @@ const char * md_shortopts = "";
struct option md_longopts[] =
{
+ {"EB", no_argument, NULL, OPTION_EB},
+ {"EL", no_argument, NULL, OPTION_EL},
{ NULL, no_argument, NULL, 0}
};
@@ -2303,6 +2308,12 @@ md_parse_option (int c, char * arg ATTRIBUTE_UNUSED)
{
switch (c)
{
+ case OPTION_EB:
+ target_big_endian = 1;
+ break;
+ case OPTION_EL:
+ target_big_endian = 0;
+ break;
default:
return 0;
}
diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h
index db8d227..0651040 100644
--- a/gas/config/tc-microblaze.h
+++ b/gas/config/tc-microblaze.h
@@ -23,8 +23,10 @@
#define TC_MICROBLAZE 1
#define TARGET_ARCH bfd_arch_microblaze
+#ifndef TARGET_BYTES_BIG_ENDIAN
/* Used to initialise target_big_endian. */
#define TARGET_BYTES_BIG_ENDIAN 1
+#endif
#define IGNORE_NONSTANDARD_ESCAPES
@@ -75,7 +77,7 @@ extern const struct relax_type md_relax_table[];
#ifdef OBJ_ELF
-#define TARGET_FORMAT (target_big_endian ? "elf32-microblaze" : "elf32-microblaze-little")
+#define TARGET_FORMAT (target_big_endian ? "elf32-microblaze" : "elf32-microblazeel")
#define ELF_TC_SPECIAL_SECTIONS \
{ ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \
diff --git a/gas/configure.tgt b/gas/configure.tgt
index 9e44de0..f483842 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -57,7 +57,8 @@ case ${cpu} in
m6811|m6812|m68hc12) cpu_type=m68hc11 ;;
m683??) cpu_type=m68k ;;
mep) cpu_type=mep endian=little ;;
- microblaze*) cpu_type=microblaze ;;
+ microblazeel*) cpu_type=microblaze endian=little;;
+ microblaze*) cpu_type=microblaze endian=big;;
mips*el) cpu_type=mips endian=little ;;
mips*) cpu_type=mips endian=big ;;
mt) cpu_type=mt endian=big ;;
diff --git a/ld/ChangeLog b/ld/ChangeLog
index a4c300a..151fe45 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2012-10-10 Edgar E. Iglesias <edgar.iglesias@gmail.com>
+
+ * emulparams/elf32mb_linux.sh: Add microblaze little endian support
+ * emulparams/elf32mbel_linux.sh: Likewise
+ * emulparams/elf32microblaze.sh: Likewise
+ * emulparams/elf32microblazeel.sh: Likewise
+ * Makefile.am, Makefile.in, configure.tgt: Likewise
+
2012-09-10 Matthias Klose <doko@ubuntu.com>
* config.in: Disable sanity check for kfreebsd.
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 4c692ea..f6f814f 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -237,6 +237,7 @@ ALL_EMULATION_SOURCES = \
eelf32mb_linux.c \
eelf32mcore.c \
eelf32mep.c \
+ eelf32microblazeel.c \
eelf32microblaze.c \
eelf32mipswindiss.c \
eelf32moxie.c \
@@ -1107,6 +1108,9 @@ eelf32m32c.c: $(srcdir)/emulparams/elf32m32c.sh \
$(ELF_DEPS) $(srcdir)/emultempl/needrelax.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32m32c "$(tdir_m32c)"
+eelf32mbel_linux.c: $(srcdir)/emulparams/elf32mbel_linux.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32mbel_linux "$(tdir_microblazeel)"
eelf32mb_linux.c: $(srcdir)/emulparams/elf32mb_linux.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32mb_linux "$(tdir_microblaze)"
@@ -1116,6 +1120,9 @@ eelf32mcore.c: $(srcdir)/emulparams/elf32mcore.sh \
eelf32mep.c: $(srcdir)/emulparams/elf32mep.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/mep.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32mep "$(tdir_mep)"
+eelf32microblazeel.c: $(srcdir)/emulparams/elf32microblazeel.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32microblazeel "$(tdir_microblazeel)"
eelf32microblaze.c: $(srcdir)/emulparams/elf32microblaze.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32microblaze "$(tdir_microblaze)"
diff --git a/ld/Makefile.in b/ld/Makefile.in
index a675d01..5e12617 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -544,6 +544,7 @@ ALL_EMULATION_SOURCES = \
eelf32mb_linux.c \
eelf32mcore.c \
eelf32mep.c \
+ eelf32microblazeel.c \
eelf32microblaze.c \
eelf32mipswindiss.c \
eelf32moxie.c \
@@ -2577,6 +2578,9 @@ eelf32m32c.c: $(srcdir)/emulparams/elf32m32c.sh \
$(ELF_DEPS) $(srcdir)/emultempl/needrelax.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32m32c "$(tdir_m32c)"
+eelf32mbel_linux.c: $(srcdir)/emulparams/elf32mbel_linux.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32mbel_linux "$(tdir_microblazeel)"
eelf32mb_linux.c: $(srcdir)/emulparams/elf32mb_linux.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32mb_linux "$(tdir_microblaze)"
@@ -2586,6 +2590,9 @@ eelf32mcore.c: $(srcdir)/emulparams/elf32mcore.sh \
eelf32mep.c: $(srcdir)/emulparams/elf32mep.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/mep.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32mep "$(tdir_mep)"
+eelf32microblazeel.c: $(srcdir)/emulparams/elf32microblazeel.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32microblazeel "$(tdir_microblazeel)"
eelf32microblaze.c: $(srcdir)/emulparams/elf32microblaze.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32microblaze "$(tdir_microblaze)"
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 72bc5bc..05e21b1 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -395,9 +395,18 @@ mcore-*-pe) targ_emul=mcorepe ;
mcore-*-elf) targ_emul=elf32mcore
;;
mep-*-elf) targ_emul=elf32mep ;;
-microblaze*-linux*)
- targ_emul="elf32mb_linux" ;;
-microblaze*) targ_emul=elf32microblaze ;;
+microblazeel*-linux*) targ_emul="elf32mbel_linux"
+ targ_extra_emuls="elf32mb_linux"
+ ;;
+microblaze*-linux*) targ_emul="elf32mb_linux"
+ targ_extra_emuls="elf32mbel_linux"
+ ;;
+microblazeel*) targ_emul=elf32microblazeel
+ targ_extra_emuls=elf32microblaze
+ ;;
+microblaze*) targ_emul=elf32microblaze
+ targ_extra_emuls=elf32microblazeel
+ ;;
mips*-*-pe) targ_emul=mipspe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
mips*-dec-ultrix*) targ_emul=mipslit ;;
diff --git a/ld/emulparams/elf32mb_linux.sh b/ld/emulparams/elf32mb_linux.sh
index f26f1a0..bb60d1f 100644
--- a/ld/emulparams/elf32mb_linux.sh
+++ b/ld/emulparams/elf32mb_linux.sh
@@ -1,5 +1,7 @@
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-microblaze"
+BIG_OUTPUT_FORMAT="elf32-microblaze"
+LITTLE_OUTPUT_FORMAT="elf32-microblazeel"
TEXT_START_ADDR=0x10000000
NONPAGED_TEXT_START_ADDR=0x28
ALIGNMENT=4
diff --git a/ld/emulparams/elf32mbel_linux.sh b/ld/emulparams/elf32mbel_linux.sh
new file mode 100644
index 0000000..2980e82
--- /dev/null
+++ b/ld/emulparams/elf32mbel_linux.sh
@@ -0,0 +1,18 @@
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-microblazeel"
+BIG_OUTPUT_FORMAT="elf32-microblaze"
+LITTLE_OUTPUT_FORMAT="elf32-microblazeel"
+TEXT_START_ADDR=0x10000000
+NONPAGED_TEXT_START_ADDR=0x28
+ALIGNMENT=4
+MAXPAGESIZE=0x1000
+COMMONPAGESIZE=0x1000
+ARCH=microblaze
+
+NOP=0x80000000
+
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
+NO_SMALL_DATA=yes
+SEPARATE_GOTPLT=12
diff --git a/ld/emulparams/elf32microblaze.sh b/ld/emulparams/elf32microblaze.sh
index ccc20d1..1f80447 100644
--- a/ld/emulparams/elf32microblaze.sh
+++ b/ld/emulparams/elf32microblaze.sh
@@ -1,5 +1,7 @@
SCRIPT_NAME=elfmicroblaze
OUTPUT_FORMAT="elf32-microblaze"
+BIG_OUTPUT_FORMAT="elf32-microblaze"
+LITTLE_OUTPUT_FORMAT="elf32-microblazeel"
#TEXT_START_ADDR=0
NONPAGED_TEXT_START_ADDR=0x28
ALIGNMENT=4
diff --git a/ld/emulparams/elf32microblazeel.sh b/ld/emulparams/elf32microblazeel.sh
new file mode 100644
index 0000000..86268b0
--- /dev/null
+++ b/ld/emulparams/elf32microblazeel.sh
@@ -0,0 +1,23 @@
+SCRIPT_NAME=elfmicroblaze
+OUTPUT_FORMAT="elf32-microblazeel"
+BIG_OUTPUT_FORMAT="elf32-microblaze"
+LITTLE_OUTPUT_FORMAT="elf32-microblazeel"
+#TEXT_START_ADDR=0
+NONPAGED_TEXT_START_ADDR=0x28
+ALIGNMENT=4
+MAXPAGESIZE=4
+ARCH=microblaze
+EMBEDDED=yes
+
+NOP=0x80000000
+
+# Hmmm, there's got to be a better way. This sets the stack to the
+# top of the simulator memory (2^19 bytes).
+#PAGE_SIZE=0x1000
+#DATA_ADDR=0x10000
+#OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }'
+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
+
+TEMPLATE_NAME=elf32
+#GENERATE_SHLIB_SCRIPT=yes
--
1.7.0.4