[AArch64, ILP32] 2/6 Parametrize elfnn-aarch64.c and add basic support in ld

and gas.

bfd/

	* Makefile.am (BFD64_BACKENDS): Add elf32-aarch64.lo.
	(BUILD_CFILES): Add elf32-aarch64.c.
	(elf32-aarch64.c): New rule for generating from elfnn-aarch64.c.
	* Makefile.in: Re-generated.
	* archures.c (bfd_mach_aarch64_ilp32): New define.
	* bfd-in.h (bfd_elf32_aarch64_init_maps): New declaration.
	(bfd_elf32_aarch64_set_options): Ditto.
	(elf32_aarch64_setup_section_lists): Ditto.
	(elf32_aarch64_next_input_section): Ditto.
	(elf32_aarch64_size_stubs): Ditto.
	(elf32_aarch64_build_stubs): Ditto.
	* bfd-in2.h: Re-generated.
	* config.bfd (aarch64-*-elf): Add bfd_elf32_littleaarch64_vec
	and bfd_elf32_bigaarch64_vec.
	(aarch64-*-linux*): Likewise.
	(aarch64_be-*-elf): Likewise.
	(aarch64_be-*-linux*): Likewise.
	* configure.in (bfd_elf32_bigaarch64_vec)
	(bfd_elf32_littleaarch64_vec): New.
	* configure: Re-generated.
	* cpu-aarch64.c (compatible): Don't allow mixing ilp32 objects with
	lp64 ones.
	(bfd_aarch64_arch_ilp32): New.
	(bfd_aarch64_arch): Link to bfd_aarch64_arch_ilp32.
	* elfnn-aarch64.c (ARCH_SIZE): New define.
	(AARCH64_R, AARCH64_R_STR, LOG_FILE_ALIGN): New defines.
	(GOT_ENTRY_SIZE): Re-define as (ARCH_SIZE / 8).
	(elf64_aarch64_*): Rename to elfNN_aarch64_*.
	(ELF64_R_*): Rename to ELFNN_R_*.
	Plus other paramaterization.
	* targets.c (bfd_elf32_bigaarch64_vec, bfd_elf32_littleaarch64_vec):
	New declarations.
	(_bfd_target_vector): Add bfd_elf32_bigaarch64_vec and
	bfd_elf32_littleaarch64_vec.

gas/

	* config/tc-aarch64.c (ilp32_p): New static variable.
	(elf64_aarch64_target_format): Return the target according to the
	value of 'ilp32_p'.
	(md_begin): Determine 'mach' according to the value of 'ilp32_p'.
	(aarch64_opts): Add support for options '-milp32' and '-mlp64'.
	(aarch64_dwarf2_addr_size): New function.
	* config/tc-aarch64.h (aarch64_dwarf2_addr_size): New declaration.
	(DWARF2_ADDR_SIZE): New define.

ld/

	* Makefile.am (ALL_64_EMULATION_SOURCES): Add eaarch64elf32.c.
	(eaarch64elf32.c): New dependency and rule.
	* Makefile.in: Re-generated.
	* configure.tgt (aarch64-*-elf): Add aarch64elf32.
	(aarch64_be-*-elf, aarch64_be-*-linux*, aarch64-*-linux*): Likewise.
	* emulparams/aarch64elf32.sh: New file.
This commit is contained in:
Yufeng Zhang 2013-06-26 10:41:42 +00:00
parent 8119711413
commit cec5225bd8
19 changed files with 590 additions and 402 deletions

View File

@ -1,3 +1,40 @@
2013-06-26 Yufeng Zhang <yufeng.zhang@arm.com>
* Makefile.am (BFD64_BACKENDS): Add elf32-aarch64.lo.
(BUILD_CFILES): Add elf32-aarch64.c.
(elf32-aarch64.c): New rule for generating from elfnn-aarch64.c.
* Makefile.in: Re-generated.
* archures.c (bfd_mach_aarch64_ilp32): New define.
* bfd-in.h (bfd_elf32_aarch64_init_maps): New declaration.
(bfd_elf32_aarch64_set_options): Ditto.
(elf32_aarch64_setup_section_lists): Ditto.
(elf32_aarch64_next_input_section): Ditto.
(elf32_aarch64_size_stubs): Ditto.
(elf32_aarch64_build_stubs): Ditto.
* bfd-in2.h: Re-generated.
* config.bfd (aarch64-*-elf): Add bfd_elf32_littleaarch64_vec
and bfd_elf32_bigaarch64_vec.
(aarch64-*-linux*): Likewise.
(aarch64_be-*-elf): Likewise.
(aarch64_be-*-linux*): Likewise.
* configure.in (bfd_elf32_bigaarch64_vec)
(bfd_elf32_littleaarch64_vec): New.
* configure: Re-generated.
* cpu-aarch64.c (compatible): Don't allow mixing ilp32 objects with
lp64 ones.
(bfd_aarch64_arch_ilp32): New.
(bfd_aarch64_arch): Link to bfd_aarch64_arch_ilp32.
* elfnn-aarch64.c (ARCH_SIZE): New define.
(AARCH64_R, AARCH64_R_STR, LOG_FILE_ALIGN): New defines.
(GOT_ENTRY_SIZE): Re-define as (ARCH_SIZE / 8).
(elf64_aarch64_*): Rename to elfNN_aarch64_*.
(ELF64_R_*): Rename to ELFNN_R_*.
Plus other paramaterization.
* targets.c (bfd_elf32_bigaarch64_vec, bfd_elf32_littleaarch64_vec):
New declarations.
(_bfd_target_vector): Add bfd_elf32_bigaarch64_vec and
bfd_elf32_littleaarch64_vec.
2013-06-26 Yufeng Zhang <yufeng.zhang@arm.com>
* Makefile.am (BFD64_BACKENDS_CFILES): Remove elf64-aarch64.c.

View File

@ -638,6 +638,7 @@ BFD32_BACKENDS_CFILES = \
# elf32-ia64.c requires a 64-bit bfd_vma, and hence can not be put in
# BFD32_BACKENDS.
BFD64_BACKENDS = \
elf32-aarch64.lo \
elf64-aarch64.lo \
aix5ppc-core.lo \
aout64.lo \
@ -763,7 +764,7 @@ SOURCE_CFILES = \
$(OPTIONAL_BACKENDS_CFILES)
BUILD_CFILES = \
elf64-aarch64.c \
elf32-aarch64.c elf64-aarch64.c \
elf32-ia64.c elf64-ia64.c peigen.c pepigen.c pex64igen.c
CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
@ -912,6 +913,11 @@ elf64-target.h : elfxx-target.h
sed -e s/NN/64/g < $(srcdir)/elfxx-target.h > elf64-target.new
mv -f elf64-target.new elf64-target.h
elf32-aarch64.c : elfnn-aarch64.c
rm -f elf32-aarch64.c
sed -e s/NN/32/g < $(srcdir)/elfnn-aarch64.c > elf32-aarch64.new
mv -f elf32-aarch64.new elf32-aarch64.c
elf64-aarch64.c : elfnn-aarch64.c
rm -f elf64-aarch64.c
sed -e s/NN/64/g < $(srcdir)/elfnn-aarch64.c > elf64-aarch64.new

View File

@ -941,6 +941,7 @@ BFD32_BACKENDS_CFILES = \
# elf32-ia64.c requires a 64-bit bfd_vma, and hence can not be put in
# BFD32_BACKENDS.
BFD64_BACKENDS = \
elf32-aarch64.lo \
elf64-aarch64.lo \
aix5ppc-core.lo \
aout64.lo \
@ -1068,7 +1069,7 @@ SOURCE_CFILES = \
$(OPTIONAL_BACKENDS_CFILES)
BUILD_CFILES = \
elf64-aarch64.c \
elf32-aarch64.c elf64-aarch64.c \
elf32-ia64.c elf64-ia64.c peigen.c pepigen.c pex64igen.c
CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
@ -1397,6 +1398,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-strtab.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-vxworks.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-aarch64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-am33lin.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-arc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-arm.Plo@am__quote@
@ -1989,6 +1991,11 @@ elf64-target.h : elfxx-target.h
sed -e s/NN/64/g < $(srcdir)/elfxx-target.h > elf64-target.new
mv -f elf64-target.new elf64-target.h
elf32-aarch64.c : elfnn-aarch64.c
rm -f elf32-aarch64.c
sed -e s/NN/32/g < $(srcdir)/elfnn-aarch64.c > elf32-aarch64.new
mv -f elf32-aarch64.new elf32-aarch64.c
elf64-aarch64.c : elfnn-aarch64.c
rm -f elf64-aarch64.c
sed -e s/NN/64/g < $(srcdir)/elfnn-aarch64.c > elf64-aarch64.new

View File

@ -475,6 +475,7 @@ DESCRIPTION
.#define bfd_mach_tilegx32 2
. bfd_arch_aarch64, {* AArch64 *}
.#define bfd_mach_aarch64 0
.#define bfd_mach_aarch64_ilp32 32
. bfd_arch_nios2,
.#define bfd_mach_nios2 0
. bfd_arch_last

View File

@ -933,9 +933,15 @@ extern unsigned int _bfd_elf_ppc_at_tprel_transform
extern void bfd_elf64_aarch64_init_maps
(bfd *);
extern void bfd_elf32_aarch64_init_maps
(bfd *);
extern void bfd_elf64_aarch64_set_options
(bfd *, struct bfd_link_info *, int, int, int);
extern void bfd_elf32_aarch64_set_options
(bfd *, struct bfd_link_info *, int, int, int);
/* ELF AArch64 mapping symbol support. */
#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0)
#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG (1 << 1)
@ -944,7 +950,7 @@ extern void bfd_elf64_aarch64_set_options
extern bfd_boolean bfd_is_aarch64_special_symbol_name
(const char * name, int type);
/* AArch64 stub generation support. Called from the linker. */
/* AArch64 stub generation support for ELF64. Called from the linker. */
extern int elf64_aarch64_setup_section_lists
(bfd *, struct bfd_link_info *);
extern void elf64_aarch64_next_input_section
@ -955,6 +961,18 @@ extern bfd_boolean elf64_aarch64_size_stubs
void (*) (void));
extern bfd_boolean elf64_aarch64_build_stubs
(struct bfd_link_info *);
/* AArch64 stub generation support for ELF32. Called from the linker. */
extern int elf32_aarch64_setup_section_lists
(bfd *, struct bfd_link_info *);
extern void elf32_aarch64_next_input_section
(struct bfd_link_info *, struct bfd_section *);
extern bfd_boolean elf32_aarch64_size_stubs
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
struct bfd_section * (*) (const char *, struct bfd_section *),
void (*) (void));
extern bfd_boolean elf32_aarch64_build_stubs
(struct bfd_link_info *);
/* TI COFF load page support. */
extern void bfd_ticoff_set_section_load_page

View File

@ -940,9 +940,15 @@ extern unsigned int _bfd_elf_ppc_at_tprel_transform
extern void bfd_elf64_aarch64_init_maps
(bfd *);
extern void bfd_elf32_aarch64_init_maps
(bfd *);
extern void bfd_elf64_aarch64_set_options
(bfd *, struct bfd_link_info *, int, int, int);
extern void bfd_elf32_aarch64_set_options
(bfd *, struct bfd_link_info *, int, int, int);
/* ELF AArch64 mapping symbol support. */
#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0)
#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG (1 << 1)
@ -951,7 +957,7 @@ extern void bfd_elf64_aarch64_set_options
extern bfd_boolean bfd_is_aarch64_special_symbol_name
(const char * name, int type);
/* AArch64 stub generation support. Called from the linker. */
/* AArch64 stub generation support for ELF64. Called from the linker. */
extern int elf64_aarch64_setup_section_lists
(bfd *, struct bfd_link_info *);
extern void elf64_aarch64_next_input_section
@ -962,6 +968,18 @@ extern bfd_boolean elf64_aarch64_size_stubs
void (*) (void));
extern bfd_boolean elf64_aarch64_build_stubs
(struct bfd_link_info *);
/* AArch64 stub generation support for ELF32. Called from the linker. */
extern int elf32_aarch64_setup_section_lists
(bfd *, struct bfd_link_info *);
extern void elf32_aarch64_next_input_section
(struct bfd_link_info *, struct bfd_section *);
extern bfd_boolean elf32_aarch64_size_stubs
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
struct bfd_section * (*) (const char *, struct bfd_section *),
void (*) (void));
extern bfd_boolean elf32_aarch64_build_stubs
(struct bfd_link_info *);
/* TI COFF load page support. */
extern void bfd_ticoff_set_section_load_page
@ -2214,6 +2232,7 @@ enum bfd_architecture
#define bfd_mach_tilegx32 2
bfd_arch_aarch64, /* AArch64 */
#define bfd_mach_aarch64 0
#define bfd_mach_aarch64_ilp32 32
bfd_arch_nios2,
#define bfd_mach_nios2 0
bfd_arch_last

View File

@ -164,22 +164,22 @@ case "${targ}" in
#ifdef BFD64
aarch64-*-elf)
targ_defvec=bfd_elf64_littleaarch64_vec
targ_selvecs="bfd_elf64_bigaarch64_vec bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
targ_selvecs="bfd_elf64_bigaarch64_vec bfd_elf32_littleaarch64_vec bfd_elf32_bigaarch64_vec bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
want64=true
;;
aarch64_be-*-elf)
targ_defvec=bfd_elf64_bigaarch64_vec
targ_selvecs="bfd_elf64_littleaarch64_vec bfd_elf32_bigarm_vec bfd_elf32_littlearm_vec"
targ_selvecs="bfd_elf64_littleaarch64_vec bfd_elf32_littleaarch64_vec bfd_elf32_bigaarch64_vec bfd_elf32_bigarm_vec bfd_elf32_littlearm_vec"
want64=true
;;
aarch64-*-linux*)
targ_defvec=bfd_elf64_littleaarch64_vec
targ_selvecs="bfd_elf64_bigaarch64_vec bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
targ_selvecs="bfd_elf64_bigaarch64_vec bfd_elf32_littleaarch64_vec bfd_elf32_bigaarch64_vec bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
want64=true
;;
aarch64_be-*-linux*)
targ_defvec=bfd_elf64_bigaarch64_vec
targ_selvecs="bfd_elf64_littleaarch64_vec bfd_elf32_bigarm_vec bfd_elf32_littlearm_vec"
targ_selvecs="bfd_elf64_littleaarch64_vec bfd_elf32_littleaarch64_vec bfd_elf32_bigaarch64_vec bfd_elf32_bigarm_vec bfd_elf32_littlearm_vec"
want64=true
;;
alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)

2
bfd/configure vendored
View File

@ -15365,6 +15365,7 @@ do
bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_bigaarch64_vec) tb="$tb elf64-aarch64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf32_bigaarch64_vec) tb="$tb elf32-aarch64.lo elf32.lo $elf"; target_size=64 ;;
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_hppa_linux_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
@ -15374,6 +15375,7 @@ do
bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elfxx-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_vms_vec) tb="$tb elf64-ia64-vms.lo elf64-ia64.lo elfxx-ia64.lo elf64.lo vms-lib.lo vms-misc.lo $elf"; target_size=64 ;;
bfd_elf64_littleaarch64_vec)tb="$tb elf64-aarch64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf32_littleaarch64_vec)tb="$tb elf32-aarch64.lo elf32.lo $elf"; target_size=64 ;;
bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;

View File

@ -860,6 +860,7 @@ do
bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_bigaarch64_vec) tb="$tb elf64-aarch64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf32_bigaarch64_vec) tb="$tb elf32-aarch64.lo elf32.lo $elf"; target_size=64 ;;
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_hppa_linux_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
@ -869,6 +870,7 @@ do
bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elfxx-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_vms_vec) tb="$tb elf64-ia64-vms.lo elf64-ia64.lo elfxx-ia64.lo elf64.lo vms-lib.lo vms-misc.lo $elf"; target_size=64 ;;
bfd_elf64_littleaarch64_vec)tb="$tb elf64-aarch64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf32_littleaarch64_vec)tb="$tb elf32-aarch64.lo elf32.lo $elf"; target_size=64 ;;
bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;

View File

@ -38,6 +38,10 @@ compatible (const bfd_arch_info_type * a, const bfd_arch_info_type * b)
if (a->mach == b->mach)
return a;
/* Don't allow mixing ilp32 with lp64. */
if ((a->mach & bfd_mach_aarch64_ilp32) != (b->mach & bfd_mach_aarch64_ilp32))
return NULL;
/* Otherwise if either a or b is the 'default' machine
then it can be polymorphed into the other. */
if (a->the_default)
@ -101,9 +105,11 @@ scan (const struct bfd_arch_info *info, const char *string)
"aarch64", PRINT, 4, DEFAULT, compatible, scan, \
bfd_arch_default_fill, NEXT }
const bfd_arch_info_type bfd_aarch64_arch =
N (0, "aarch64", TRUE, NULL);
static const bfd_arch_info_type bfd_aarch64_arch_ilp32 =
N (bfd_mach_aarch64_ilp32, "aarch64:ilp32", FALSE, NULL);
const bfd_arch_info_type bfd_aarch64_arch =
N (0, "aarch64", TRUE, &bfd_aarch64_arch_ilp32);
bfd_boolean
bfd_is_aarch64_special_symbol_name (const char *name, int type)

File diff suppressed because it is too large Load Diff

View File

@ -736,6 +736,7 @@ extern const bfd_target bfd_elf64_alpha_vec;
extern const bfd_target bfd_elf64_big_generic_vec;
extern const bfd_target bfd_elf64_bigmips_vec;
extern const bfd_target bfd_elf64_bigaarch64_vec;
extern const bfd_target bfd_elf32_bigaarch64_vec;
extern const bfd_target bfd_elf64_hppa_linux_vec;
extern const bfd_target bfd_elf64_hppa_vec;
extern const bfd_target bfd_elf64_ia64_big_vec;
@ -745,6 +746,7 @@ extern const bfd_target bfd_elf64_ia64_vms_vec;
extern const bfd_target bfd_elf64_little_generic_vec;
extern const bfd_target bfd_elf64_littlemips_vec;
extern const bfd_target bfd_elf64_littleaarch64_vec;
extern const bfd_target bfd_elf32_littleaarch64_vec;
extern const bfd_target bfd_elf64_mmix_vec;
extern const bfd_target bfd_elf64_powerpc_vec;
extern const bfd_target bfd_elf64_powerpcle_vec;
@ -1125,6 +1127,7 @@ static const bfd_target * const _bfd_target_vector[] =
&bfd_elf64_big_generic_vec,
&bfd_elf64_bigmips_vec,
&bfd_elf64_bigaarch64_vec,
&bfd_elf32_bigaarch64_vec,
&bfd_elf64_hppa_linux_vec,
&bfd_elf64_hppa_vec,
&bfd_elf64_ia64_big_vec,
@ -1134,6 +1137,7 @@ static const bfd_target * const _bfd_target_vector[] =
&bfd_elf64_little_generic_vec,
&bfd_elf64_littlemips_vec,
&bfd_elf64_littleaarch64_vec,
&bfd_elf32_littleaarch64_vec,
&bfd_elf64_mmix_vec,
&bfd_elf64_powerpc_vec,
&bfd_elf64_powerpcle_vec,

View File

@ -1,3 +1,14 @@
2013-06-26 Yufeng Zhang <yufeng.zhang@arm.com>
* config/tc-aarch64.c (ilp32_p): New static variable.
(elf64_aarch64_target_format): Return the target according to the
value of 'ilp32_p'.
(md_begin): Determine 'mach' according to the value of 'ilp32_p'.
(aarch64_opts): Add support for options '-milp32' and '-mlp64'.
(aarch64_dwarf2_addr_size): New function.
* config/tc-aarch64.h (aarch64_dwarf2_addr_size): New declaration.
(DWARF2_ADDR_SIZE): New define.
2013-06-26 Richard Sandiford <rdsandiford@googlemail.com>
* doc/c-mips.texi: Use ISA instead of @sc{isa}.

View File

@ -60,6 +60,12 @@ static const aarch64_feature_set aarch64_arch_none = AARCH64_ARCH_NONE;
#ifdef OBJ_ELF
/* Pre-defined "_GLOBAL_OFFSET_TABLE_" */
static symbolS *GOT_symbol;
/* When non-zero, program to a 32-bit model, in which the C data types
int, long and all pointer types are 32-bit objects (ILP32); or to a
64-bit model, in which the C int type is 32-bits but the C long type
and all pointer types are 64-bit objects (LP64). */
static int ilp32_p = 0;
#endif
enum neon_el_type
@ -5892,6 +5898,18 @@ tc_aarch64_regname_to_dw2regnum (char *regname)
return -1;
}
/* Implement DWARF2_ADDR_SIZE. */
int
aarch64_dwarf2_addr_size (void)
{
#if defined (OBJ_MAYBE_ELF) || defined (OBJ_ELF)
if (ilp32_p)
return 4;
#endif
return bfd_arch_bits_per_address (stdoutput) / 8;
}
/* MD interface: Symbol and relocation handling. */
/* Return the address within the segment that a PC-relative fixup is
@ -6693,9 +6711,9 @@ const char *
elf64_aarch64_target_format (void)
{
if (target_big_endian)
return "elf64-bigaarch64";
return ilp32_p ? "elf32-bigaarch64" : "elf64-bigaarch64";
else
return "elf64-littleaarch64";
return ilp32_p ? "elf32-littleaarch64" : "elf64-littleaarch64";
}
void
@ -6986,7 +7004,7 @@ md_begin (void)
cpu_variant = *mcpu_cpu_opt;
/* Record the CPU type. */
mach = bfd_mach_aarch64;
mach = ilp32_p ? bfd_mach_aarch64_ilp32 : bfd_mach_aarch64;
bfd_set_arch_mach (stdoutput, TARGET_ARCH, mach);
}
@ -7031,6 +7049,10 @@ static struct aarch64_option_table aarch64_opts[] = {
{"mbig-endian", N_("assemble for big-endian"), &target_big_endian, 1, NULL},
{"mlittle-endian", N_("assemble for little-endian"), &target_big_endian, 0,
NULL},
#ifdef OBJ_ELF
{"mlp64", N_("select the LP64 model"), &ilp32_p, 0, NULL},
{"milp32", N_("select the ILP32 model"), &ilp32_p, 1, NULL},
#endif /* OBJ_ELF */
#ifdef DEBUG_AARCH64
{"mdebug-dump", N_("temporary switch for dumping"), &debug_dump, 1, NULL},
#endif /* DEBUG_AARCH64 */

View File

@ -153,6 +153,9 @@ struct aarch64_frag_type
/* Registers are generally saved at negative offsets to the CFA. */
#define DWARF2_CIE_DATA_ALIGNMENT (-4)
extern int aarch64_dwarf2_addr_size (void);
#define DWARF2_ADDR_SIZE(bfd) aarch64_dwarf2_addr_size ()
#ifdef OBJ_ELF
# define obj_frob_symbol(sym, punt) aarch64elf_frob_symbol ((sym), & (punt))

View File

@ -1,3 +1,12 @@
2013-06-26 Yufeng Zhang <yufeng.zhang@arm.com>
* Makefile.am (ALL_64_EMULATION_SOURCES): Add eaarch64elf32.c.
(eaarch64elf32.c): New dependency and rule.
* Makefile.in: Re-generated.
* configure.tgt (aarch64-*-elf): Add aarch64elf32.
(aarch64_be-*-elf, aarch64_be-*-linux*, aarch64-*-linux*): Likewise.
* emulparams/aarch64elf32.sh: New file.
2013-06-25 Maciej W. Rozycki <macro@codesourcery.com>
* emultempl/mipself.em (insn32): New variable.

View File

@ -463,6 +463,7 @@ ALL_EMULATIONS = $(ALL_EMULATION_SOURCES:.c=.@OBJEXT@)
ALL_64_EMULATION_SOURCES = \
eaarch64elf.c \
eaarch64elf32.c \
eaarch64elfb.c \
eaarch64linux.c \
eaarch64linuxb.c \
@ -1762,6 +1763,10 @@ eaarch64elf.c: $(srcdir)/emulparams/aarch64elf.sh \
$(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} aarch64elf "$(tdir_aarch64elf)"
eaarch64elf32.c: $(srcdir)/emulparams/aarch64elf32.sh \
$(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} aarch64elf32 "$(tdir_aarch64elf32)"
eaarch64elfb.c: $(srcdir)/emulparams/aarch64elfb.sh $(srcdir)/emulparams/aarch64elf.sh \
$(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}

View File

@ -770,6 +770,7 @@ ALL_EMULATION_SOURCES = \
ALL_EMULATIONS = $(ALL_EMULATION_SOURCES:.c=.@OBJEXT@)
ALL_64_EMULATION_SOURCES = \
eaarch64elf.c \
eaarch64elf32.c \
eaarch64elfb.c \
eaarch64linux.c \
eaarch64linuxb.c \
@ -1078,6 +1079,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deffilep.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elf32.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elfb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linuxb.Po@am__quote@
@ -3242,6 +3244,10 @@ eaarch64elf.c: $(srcdir)/emulparams/aarch64elf.sh \
$(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} aarch64elf "$(tdir_aarch64elf)"
eaarch64elf32.c: $(srcdir)/emulparams/aarch64elf32.sh \
$(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} aarch64elf32 "$(tdir_aarch64elf32)"
eaarch64elfb.c: $(srcdir)/emulparams/aarch64elfb.sh $(srcdir)/emulparams/aarch64elf.sh \
$(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}

View File

@ -46,13 +46,13 @@ targ64_extra_libpath=
# break the alpha sorting.
case "${targ}" in
aarch64_be-*-elf) targ_emul=aarch64elfb
targ_extra_emuls="aarch64elf armelfb armelf" ;;
targ_extra_emuls="aarch64elf aarch64elf32 armelfb armelf" ;;
aarch64-*-elf) targ_emul=aarch64elf
targ_extra_emuls="aarch64elfb armelf armelfb" ;;
targ_extra_emuls="aarch64elf32 aarch64elfb armelf armelfb" ;;
aarch64_be-*-linux*) targ_emul=aarch64linuxb
targ_extra_emuls="aarch64linux aarch64elfb aarch64elf armelfb_linux_eabi armelf_linux_eabi armelfb armelf" ;;
targ_extra_emuls="aarch64linux aarch64elfb aarch64elf aarch64elf32 armelfb_linux_eabi armelf_linux_eabi armelfb armelf" ;;
aarch64-*-linux*) targ_emul=aarch64linux
targ_extra_emuls="aarch64linuxb aarch64elf aarch64elfb armelf_linux_eabi armelfb_linux_eabi armelf armelfb" ;;
targ_extra_emuls="aarch64linuxb aarch64elf aarch64elf32 aarch64elfb armelf_linux_eabi armelfb_linux_eabi armelf armelfb" ;;
alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
targ_emul=elf64alpha_fbsd
targ_extra_emuls="elf64alpha alpha"