summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-02-22 04:51:15 +0000
committerobrien <obrien@FreeBSD.org>2002-02-22 04:51:15 +0000
commita522fd15cba9bb2856dce2d394ebb3cfb6c92765 (patch)
treea89290eb1d6a226107972d43d8868854703c0a8f
parent30ebf72ed197b6fdc8b2007c5e538206d26010b4 (diff)
downloadFreeBSD-src-a522fd15cba9bb2856dce2d394ebb3cfb6c92765.zip
FreeBSD-src-a522fd15cba9bb2856dce2d394ebb3cfb6c92765.tar.gz
Bring the binutils_2_12_20020221_snap version of this to the HEAD branch.
-rw-r--r--contrib/binutils/gas/config/tc-i386.c68
-rw-r--r--contrib/binutils/ld/configure.tgt37
-rw-r--r--contrib/binutils/ld/emulparams/elf64alpha.sh3
3 files changed, 79 insertions, 29 deletions
diff --git a/contrib/binutils/gas/config/tc-i386.c b/contrib/binutils/gas/config/tc-i386.c
index a580038..c680683 100644
--- a/contrib/binutils/gas/config/tc-i386.c
+++ b/contrib/binutils/gas/config/tc-i386.c
@@ -1,6 +1,6 @@
/* i386.c -- Assemble code for the Intel 80386
Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
+ 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -52,8 +52,12 @@
#define SCALE1_WHEN_NO_INDEX 1
#endif
+#ifndef true
#define true 1
+#endif
+#ifndef false
#define false 0
+#endif
static unsigned int mode_from_disp_size PARAMS ((unsigned int));
static int fits_in_signed_byte PARAMS ((offsetT));
@@ -1178,7 +1182,12 @@ tc_i386_fix_adjustable (fixP)
/* Prevent all adjustments to global symbols, or else dynamic
linking will not work correctly. */
if (S_IS_EXTERNAL (fixP->fx_addsy)
- || S_IS_WEAK (fixP->fx_addsy))
+ || S_IS_WEAK (fixP->fx_addsy)
+ /* Don't adjust pc-relative references to merge sections in 64-bit
+ mode. */
+ || (use_rela_relocations
+ && (S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE) != 0
+ && fixP->fx_pcrel))
return 0;
#endif
/* adjust_reloc_syms doesn't know about the GOT. */
@@ -1298,6 +1307,7 @@ md_assemble (line)
/* If we are in 16-bit mode, do not allow addr16 or data16.
Similarly, in 32-bit mode, do not allow addr32 or data32. */
if ((current_templates->start->opcode_modifier & (Size16 | Size32))
+ && flag_code != CODE_64BIT
&& (((current_templates->start->opcode_modifier & Size32) != 0)
^ (flag_code == CODE_16BIT)))
{
@@ -2263,6 +2273,14 @@ md_assemble (line)
return;
}
+ if (i.suffix != QWORD_MNEM_SUFFIX && (flag_code == CODE_64BIT)
+ && !(i.tm.opcode_modifier & IgnoreSize)
+ && (i.tm.opcode_modifier & JumpByte))
+ {
+ if (! add_prefix (ADDR_PREFIX_OPCODE))
+ return;
+ }
+
/* Set mode64 for an operand. */
if (i.suffix == QWORD_MNEM_SUFFIX
&& !(i.tm.opcode_modifier & NoRex64))
@@ -2415,13 +2433,15 @@ md_assemble (line)
if (! i.index_reg)
{
/* Operand is just <disp> */
- if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0))
+ if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0)
+ && (flag_code != CODE_64BIT))
{
i.rm.regmem = NO_BASE_REGISTER_16;
i.types[op] &= ~Disp;
i.types[op] |= Disp16;
}
- else if (flag_code != CODE_64BIT)
+ else if (flag_code != CODE_64BIT
+ || (i.prefix[ADDR_PREFIX] != 0))
{
i.rm.regmem = NO_BASE_REGISTER;
i.types[op] &= ~Disp;
@@ -3438,10 +3458,13 @@ i386_displacement (disp_start, disp_end)
#endif
int bigdisp = Disp32;
- if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0))
- bigdisp = Disp16;
if (flag_code == CODE_64BIT)
- bigdisp = Disp64;
+ {
+ if (!i.prefix[ADDR_PREFIX])
+ bigdisp = Disp64;
+ }
+ else if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0))
+ bigdisp = Disp16;
i.types[this_operand] |= bigdisp;
exp = &disp_expressions[i.disp_operands];
@@ -3596,15 +3619,28 @@ i386_index_check (operand_string)
ok = 1;
if (flag_code == CODE_64BIT)
{
- /* 64bit checks. */
- if ((i.base_reg
- && ((i.base_reg->reg_type & Reg64) == 0)
- && (i.base_reg->reg_type != BaseIndex
- || i.index_reg))
- || (i.index_reg
- && ((i.index_reg->reg_type & (Reg64|BaseIndex))
- != (Reg64|BaseIndex))))
- ok = 0;
+ if (i.prefix[ADDR_PREFIX] == 0)
+ {
+ /* 64bit checks. */
+ if ((i.base_reg
+ && ((i.base_reg->reg_type & Reg64) == 0)
+ && (i.base_reg->reg_type != BaseIndex
+ || i.index_reg))
+ || (i.index_reg
+ && ((i.index_reg->reg_type & (Reg64|BaseIndex))
+ != (Reg64|BaseIndex))))
+ ok = 0;
+ }
+ else
+ {
+ /* 32bit checks. */
+ if ((i.base_reg
+ && (i.base_reg->reg_type & (Reg32 | RegRex)) != Reg32)
+ || (i.index_reg
+ && ((i.index_reg->reg_type & (Reg32|BaseIndex|RegRex))
+ != (Reg32|BaseIndex))))
+ ok = 0;
+ }
}
else
{
diff --git a/contrib/binutils/ld/configure.tgt b/contrib/binutils/ld/configure.tgt
index b03cc27..10edbe7 100644
--- a/contrib/binutils/ld/configure.tgt
+++ b/contrib/binutils/ld/configure.tgt
@@ -47,8 +47,8 @@ sparc*-*-coff) targ_emul=coff_sparc ;;
sparc*-*-elf) targ_emul=elf32_sparc ;;
sparc*-*-sysv4*) targ_emul=elf32_sparc ;;
sparc64-*-freebsd* | sparcv9-*-freebsd*)
- targ_emul=elf64_sparc
- targ_extra_emuls="elf32_sparc"
+ targ_emul=elf64_sparc_fbsd
+ targ_extra_emuls="elf64_sparc elf32_sparc"
targ_extra_libpath=$targ_extra_emuls
tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
;;
@@ -105,7 +105,8 @@ i960-intel-nindy) targ_emul=gld960 ;;
i960-*-rtems*) targ_emul=gld960coff ;;
i960-*-elf*) targ_emul=elf32_i960 ;;
ia64-*-elf*) targ_emul=elf64_ia64 ;;
-ia64-*-freebsd*) targ_emul=elf64_ia64 ;;
+ia64-*-freebsd*) targ_emul=elf64_ia64_fbsd
+ targ_extra_emuls="elf64_ia64" ;;
ia64-*-netbsd*) targ_emul=elf64_ia64 ;;
ia64-*-linux*) targ_emul=elf64_ia64 ;;
ia64-*-aix*) targ_emul=elf64_aix ;;
@@ -179,10 +180,12 @@ i[3456]86-*-netware) targ_emul=i386nw ;;
i[3456]86-*-elf*) targ_emul=elf_i386 ;;
i[3456]86-*-freebsdaout* | i[3456]86-*-freebsd[12].* | i[3456]86-*-freebsd[12])
targ_emul=i386bsd ;;
-i[3456]86-*-freebsd*) targ_emul=elf_i386 ;;
-x86_64-*-freebsd*) targ_emul=elf_x86_64
- targ_extra_emuls=elf_i386
- tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
+i[3456]86-*-freebsd*) targ_emul=elf_i386_fbsd
+ targ_extra_emuls="elf_i386 i386bsd" ;;
+x86_64-*-freebsd*) targ_emul=elf_x86_64_fbsd
+ targ_extra_emuls="elf_i386_fbsd elf_x86_64 elf_i386"
+ tdir_elf_i386=`echo ${targ_alias} \
+ | sed -e 's/x86_64/i386/'`
;;
i[3456]86-*-sysv*) targ_emul=i386coff ;;
i[3456]86-*-ptx*) targ_emul=i386coff ;;
@@ -213,7 +216,8 @@ arm-*-aout | armel-*-aout) targ_emul=armaoutl ;;
armeb-*-aout) targ_emul=armaoutb ;;
arm-*-coff) targ_emul=armcoff ;;
arm-*-vxworks) targ_emul=armcoff ;;
-arm-*-freebsd*) targ_emul=armelf ;;
+arm-*-freebsd*) targ_emul=armelf_fbsd
+ targ_extra_emuls="armelf" ;;
arm-*-netbsdelf*) targ_emul=armelf_nbsd;
targ_extra_emuls="armelf armnbsd" ;;
arm-*-netbsd*) targ_emul=armnbsd;
@@ -275,6 +279,11 @@ sh-*-elf* | sh-*-rtemself*)
sh-*-pe) targ_emul=shpe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
sh-*-*|sh-*-rtems*) targ_emul=sh; targ_extra_emuls=shl ;;
+sh64-*-elf*)
+ targ_emul=shelf
+ targ_extra_emuls="shlelf shelf32 shlelf32 shelf64 shlelf64"
+ targ_extra_libpath=$targ_extra_emuls
+ ;;
m68k-sony-*) targ_emul=news ;;
m68k-hp-bsd*) targ_emul=hp300bsd ;;
m68*-motorola-sysv*) targ_emul=delta68 ;;
@@ -307,6 +316,7 @@ hppa*64*-*) targ_emul=elf64hppa ;;
hppa*-*-linux-gnu*) targ_emul=hppalinux ;;
hppa*-*-*elf*) targ_emul=hppaelf ;;
hppa*-*-lites*) targ_emul=hppaelf ;;
+hppa*-*-netbsd*) targ_emul=hppanbsd ;;
hppa*-*-rtems*) targ_emul=hppaelf ;;
vax-dec-ultrix* | vax-dec-bsd*) targ_emul=vax ;;
mips*-*-pe) targ_emul=mipspe ;
@@ -353,8 +363,8 @@ mmix-*-*) targ_emul=mmo
;;
mn10200-*-*) targ_emul=mn10200 ;;
mn10300-*-*) targ_emul=mn10300 ;;
-alpha*-*-freebsd*) targ_emul=elf64alpha
- targ_extra_emuls=alpha
+alpha*-*-freebsd*) targ_emul=elf64alpha_fbsd
+ targ_extra_emuls="elf64alpha alpha"
tdir_alpha=`echo ${targ_alias} | sed -e 's/freebsd/freebsdecoff/'`
;;
alpha*-*-linuxecoff*) targ_emul=alpha targ_extra_emuls=elf64alpha
@@ -371,11 +381,14 @@ z8k-*-coff) targ_emul=z8002; targ_extra_emuls=z8001 ;;
ns32k-pc532-mach* | ns32k-pc532-ux*) targ_emul=pc532macha ;;
ns32k-pc532-netbsd* | ns32k-pc532-lites*) targ_emul=ns32knbsd ;;
openrisc-*-*) targ_emul=elf32openrisc ;;
+or32-*-coff) targ_emul=or32 ;;
+or32-*-elf) targ_emul=or32elf ;;
+or32-*-rtems) targ_emul=or32 ;;
pdp11-*-*) targ_emul=pdp11 ;;
pjl*-*-*) targ_emul=pjlelf ; targ_extra_emuls="elf_i386" ;;
pj*-*-*) targ_emul=pjelf ;;
-powerpc-*-freebsd*) targ_emul=elf32ppc;
- targ_extra_emuls=elf32ppcsim;
+powerpc-*-freebsd*) targ_emul=elf32ppc_fbsd;
+ targ_extra_emuls="elf32ppc elf32ppcsim";
targ_extra_libpath=elf32ppc;
tdir_elf32ppcsim=`echo ${targ_alias} | sed -e 's/ppc/ppcsim/'`
;;
diff --git a/contrib/binutils/ld/emulparams/elf64alpha.sh b/contrib/binutils/ld/emulparams/elf64alpha.sh
index a245065..d8dd613 100644
--- a/contrib/binutils/ld/emulparams/elf64alpha.sh
+++ b/contrib/binutils/ld/emulparams/elf64alpha.sh
@@ -13,7 +13,8 @@ ARCH=alpha
MACHINE=
GENERATE_SHLIB_SCRIPT=yes
DATA_PLT=
-NOP=0x2ffe0000 # unop
+# Note that the string of digits is little-endian.
+NOP=0x0000fe2f # unop
OTHER_READONLY_SECTIONS="
.reginfo ${RELOCATING-0} : { *(.reginfo) }"
OpenPOWER on IntegriCloud