Multi-GOT support for m68k.

bfd/

        * elf32-m68k.c (struct elf_m68k_link_hash_entry: got_entry_key,
        glist): New fields.
        (struct elf_m68k_got_entry_key, struct elf_m68k_got_entry,
        struct elf_m68k_got, struct elf_m68k_bfd2got_entry,
        struct elf_m68k_multi_got): New data structures.
        (struct elf_m68k_link_hash_table: local_gp_p, use_neg_got_offsets_p,
        allow_multigot_p, multi_got_): New fields.
        (elf_m68k_multi_got): New macro.
        (elf_m68k_link_hash_newfunc): Initialize new fields of
        struct elf_m68k_link_hash_entry.
        (elf_m68k_link_hash_table_create): Initialize new fields of
        struct elf_m68k_link_hash_table.
        (elf_m68k_link_hash_table_free): New static function implementing hook.
        (elf_m68k_init_got, elf_m68k_clear_got, elf_m68k_create_empty_got): New
        static functions for struct elf_m68k_got.
        (elf_m68k_init_got_entry_key, elf_m68k_got_entry_hash,
        elf_m68k_got_entry_eq): New static functions for
        struct elf_m68k_got_entry.
        (ELF_M68K_REL_8O_MAX_N_ENTRIES_IN_GOT,
        ELF_M68K_REL_8O_16O_MAX_N_ENTRIES_IN_GOT): New macros.
        (enum elf_m68k_get_entry_howto): New enum.
        (elf_m68k_get_got_entry, elf_m68k_update_got_entry_type,
        elf_m68k_remove_got_entry_type): New static functions for
        struct elf_m68k_got_entry.
        (elf_m68k_add_entry_to_got): New static function.
        (elf_m68k_bfd2got_entry_hash, elf_m68k_bfd2got_entry_eq,
        elf_m68k_bfd2got_entry_del, elf_m68k_get_bfd2got_entry): New static
        functions for struct elf_m68k_bfd2got_entry.
        (struct elf_m68k_can_merge_gots_arg, elf_m68k_can_merge_gots_1,
        elf_m68k_can_merge_gots): New traversal.
        (struct elf_m68k_merge_gots_arg, elf_m68k_merge_gots_1,
        elf_m68k_merge_gots): Ditto.
        (struct elf_m68k_finalize_got_offsets_arg,
        elf_m68k_finalize_got_offsets_1, elf_m68k_finalize_got_offsets): Ditto.
        (struct elf_m68k_partition_multi_got_arg,
        elf_m68k_partition_multi_got_1, elf_m68k_init_symndx2h_1,
        elf_m68k_partition_multi_got): Ditto.
        (elf_m68k_find_got_entry_ptr, elf_m68k_remove_got_entry): New static
        functions.
        (elf_m68k_copy_indirect_symbol): New static function implementing
        a hook.
        (elf_m68k_check_relocs): Update to add entries to multi-GOT.
        (elf_m68k_gc_sweep_hook): Update to remove entries from multi-GOT.
        (elf_m68k_always_size_sections): Assign BFDs to GOTs.
        (elf_m68k_relocate_section): Update to properly handle GOT relocations.
        (elf_m68k_finish_dynamic_symbol): Update to traverse all GOT entries
        of a global symbol.
        (bfd_elf_m68k_set_target_options): New function.
        (bfd_elf32_bfd_link_hash_table_free): Define hook.
        (bfd_elf32_bfd_final_link): Change expansion to bfd_elf_final_link
        to skip generic calculation of GOT offsets.
        (elf_backend_copy_indirect_symbol): Define hook.

        * bfd-in.h (bfd_elf_m68k_set_target_options): Declare function.
        * bfd-in2.h: Regenerate.

        ld/

        * configure.in (--enable-got): New option.  Handle it.
        * configure: Regenerate.
        * config.in: Regenerate.

        * emultempl/m68kelf.em: (got_handling_target_default): New shell
        variable.
        (GOT_HANDLING_TARGET_DEFAULT): New macro.
        (GOT_HANDLING_DEFAULT): New macro.  Initialize it from configure
        option if one was given.
        (got_handling): New static variable.
        (elf_m68k_create_output_section_statements): New static function
        implementing hook.
        (PARSE_AND_LIST_PROLOGUE): Define shell variable.
        (OPTION_GOT): New macro.
        (PARSE_AND_LIST_LONGOPTS): Define shell variable.  Specify
        --got option.
        (got): New linker option.
        (PARSE_AND_LIST_OPTIONS): Define shell variable.  Print help string
        for --got option.
        (PARSE_AND_LIST_ARGS_CASES): Define shell variable.  Handle --got
        option.

        * ld.texinfo: Document --got=<type> option.
        * gen-doc.texi: Add M68K.
        * NEWS: Mention the new feature.

        ld/testsuite/

        * ld-m68k/got-12.s: New file.
        * ld-m68k/got-13.s: New file.
        * ld-m68k/got-14.s: New file.
        * ld-m68k/got-15.s: New file.
        * ld-m68k/got-34.s: New file.
        * ld-m68k/got-35.s: New file.
        * ld-m68k/got-single-12-ok.d: New dump test.
        * ld-m68k/got-single-13-er.d: New dump test.
        * ld-m68k/got-negative-14-ok.d: New dump test.
        * ld-m68k/got-negative-15-er.d: New dump test.
        * ld-m68k/got-negative-12-13-14-34-ok.d: New dump test.
        * ld-m68k/got-negative-12-13-14-35-er.d: New dump test.
        * ld-m68k/got-multigot-14-ok.d: New dump test.
        * ld-m68k/got-multigot-15-er.d: New dump test.
        * ld-m68k/got-multigot-12-13-14-34-35-ok.d: New dump test.
        * ld-m68k/xgot-15.s: New source.
        * ld-m68k/got-xgot-15-ok.d: New test.
        * ld-m68k/got-xgot-12-13-14-15-34-35-ok.d: New test.
        * ld-m68k/m68k.exp: Run new tests.
This commit is contained in:
Nick Clifton 2008-05-21 12:01:37 +00:00
parent 90b5b1a5e4
commit 7fb9f789e3
35 changed files with 469297 additions and 150 deletions

View File

@ -1,3 +1,61 @@
2008-05-21 Maxim Kuvyrkov <maxim@codesourcery.com>
Add multi-GOT support for m68k.
* elf32-m68k.c (struct elf_m68k_link_hash_entry: got_entry_key,
glist): New fields.
(struct elf_m68k_got_entry_key, struct elf_m68k_got_entry,
struct elf_m68k_got, struct elf_m68k_bfd2got_entry,
struct elf_m68k_multi_got): New data structures.
(struct elf_m68k_link_hash_table: local_gp_p, use_neg_got_offsets_p,
allow_multigot_p, multi_got_): New fields.
(elf_m68k_multi_got): New macro.
(elf_m68k_link_hash_newfunc): Initialize new fields of
struct elf_m68k_link_hash_entry.
(elf_m68k_link_hash_table_create): Initialize new fields of
struct elf_m68k_link_hash_table.
(elf_m68k_link_hash_table_free): New static function implementing hook.
(elf_m68k_init_got, elf_m68k_clear_got, elf_m68k_create_empty_got): New
static functions for struct elf_m68k_got.
(elf_m68k_init_got_entry_key, elf_m68k_got_entry_hash,
elf_m68k_got_entry_eq): New static functions for
struct elf_m68k_got_entry.
(ELF_M68K_REL_8O_MAX_N_ENTRIES_IN_GOT,
ELF_M68K_REL_8O_16O_MAX_N_ENTRIES_IN_GOT): New macros.
(enum elf_m68k_get_entry_howto): New enum.
(elf_m68k_get_got_entry, elf_m68k_update_got_entry_type,
elf_m68k_remove_got_entry_type): New static functions for
struct elf_m68k_got_entry.
(elf_m68k_add_entry_to_got): New static function.
(elf_m68k_bfd2got_entry_hash, elf_m68k_bfd2got_entry_eq,
elf_m68k_bfd2got_entry_del, elf_m68k_get_bfd2got_entry): New static
functions for struct elf_m68k_bfd2got_entry.
(struct elf_m68k_can_merge_gots_arg, elf_m68k_can_merge_gots_1,
elf_m68k_can_merge_gots): New traversal.
(struct elf_m68k_merge_gots_arg, elf_m68k_merge_gots_1,
elf_m68k_merge_gots): Ditto.
(struct elf_m68k_finalize_got_offsets_arg,
elf_m68k_finalize_got_offsets_1, elf_m68k_finalize_got_offsets): Ditto.
(struct elf_m68k_partition_multi_got_arg,
elf_m68k_partition_multi_got_1, elf_m68k_init_symndx2h_1,
elf_m68k_partition_multi_got): Ditto.
(elf_m68k_find_got_entry_ptr, elf_m68k_remove_got_entry): New static
functions.
(elf_m68k_copy_indirect_symbol): New static function implementing
a hook.
(elf_m68k_check_relocs): Update to add entries to multi-GOT.
(elf_m68k_gc_sweep_hook): Update to remove entries from multi-GOT.
(elf_m68k_always_size_sections): Assign BFDs to GOTs.
(elf_m68k_relocate_section): Update to properly handle GOT relocations.
(elf_m68k_finish_dynamic_symbol): Update to traverse all GOT entries
of a global symbol.
(bfd_elf_m68k_set_target_options): New function.
(bfd_elf32_bfd_link_hash_table_free): Define hook.
(bfd_elf32_bfd_final_link): Change expansion to bfd_elf_final_link
to skip generic calculation of GOT offsets.
(elf_backend_copy_indirect_symbol): Define hook.
* bfd-in.h (bfd_elf_m68k_set_target_options): Declare function.
* bfd-in2.h: Regenerate.
2008-05-21 André Johansen <andrejoh@gmail.com>
PR 868

View File

@ -712,6 +712,8 @@ extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
char **);
extern void bfd_elf_m68k_set_target_options (struct bfd_link_info *, int);
extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
char **);

View File

@ -719,6 +719,8 @@ extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
char **);
extern void bfd_elf_m68k_set_target_options (struct bfd_link_info *, int);
extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
char **);

View File

@ -3365,11 +3365,11 @@ group_sections (struct elf32_arm_link_hash_table *htab,
/* OK, the size from the start of CURR to the end is less
than stub_group_size and thus can be handled by one stub
section. (or the tail section is itself larger than
section. (Or the tail section is itself larger than
stub_group_size, in which case we may be toast.)
We should really be keeping track of the total size of
stubs added here, as stubs contribute to the final output
section size. */
section size. */
do
{
prev = PREV_SEC (tail);

View File

@ -2728,7 +2728,14 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
check_segment[2];
int silence_segment_error = !(info->shared || info->pie);
unsigned long insn;
static bfd_boolean ef_frv_pic_flag_set = FALSE;
if (! ef_frv_pic_flag_set && IS_FDPIC (output_bfd))
{
elf_elfheader (output_bfd)->e_flags |= EF_FRV_PIC;
ef_frv_pic_flag_set = TRUE;
}
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
@ -3985,7 +3992,9 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
}
if (!silence_segment_error && (info->shared || info->pie))
return FALSE;
elf_elfheader (output_bfd)->e_flags |= EF_FRV_PIC;
/* PR 6446: EF_FRV_PIC should be cleared if
there are any inter-segment relocations. */
elf_elfheader (output_bfd)->e_flags &= ~ EF_FRV_PIC;
}
switch (r_type)

File diff suppressed because it is too large Load Diff

View File

@ -2201,7 +2201,8 @@ elf64_hppa_finalize_opd (dyn_h, data)
/* All we really want from the new symbol is its dynamic
symbol index. */
dynindx = nh->dynindx;
if (nh)
dynindx = nh->dynindx;
}
rel.r_addend = 0;

View File

@ -1,3 +1,29 @@
2008-05-21 Maxim Kuvyrkov <maxim@codesourcery.com>
* configure.in (--enable-got): New option. Handle it.
* configure: Regenerate.
* config.in: Regenerate.
* emultempl/m68kelf.em: (got_handling_target_default): New shell
variable.
(GOT_HANDLING_TARGET_DEFAULT): New macro.
(GOT_HANDLING_DEFAULT): New macro. Initialize it from configure
option if one was given.
(got_handling): New static variable.
(elf_m68k_create_output_section_statements): New static function
implementing hook.
(PARSE_AND_LIST_PROLOGUE): Define shell variable.
(OPTION_GOT): New macro.
(PARSE_AND_LIST_LONGOPTS): Define shell variable. Specify
--got option.
(got): New linker option.
(PARSE_AND_LIST_OPTIONS): Define shell variable. Print help string
for --got option.
(PARSE_AND_LIST_ARGS_CASES): Define shell variable. Handle --got
option.
* ld.texinfo: Document --got=<type> option.
* gen-doc.texi: Add M68K.
* NEWS: Mention the new feature.
2008-05-21 Evandro Menezes <evandro@yahoo.com>
PR ld/6430

View File

@ -1,4 +1,7 @@
-*- text -*-
* The M68K linker now supports multiple GOT generation schemes controlled via
the --got=<type> command line option.
* The ARM ELF linker will now generate stubs for function calls to symbols that
are too far away. The placement of the stubs is controlled by a new linker
command line option: --stub-group-size=N.

View File

@ -7,6 +7,9 @@
/* Additional extension a shared object might have. */
#undef EXTRA_SHLIB_EXTENSION
/* Define to choose default GOT handling scheme. */
#undef GOT_HANDLING_DEFAULT
/* Define to 1 if you have the declaration of `environ', and to 0 if you
don't. */
#undef HAVE_DECL_ENVIRON

73
ld/configure vendored
View File

@ -1003,6 +1003,8 @@ Optional Features:
--enable-dependency-tracking do not reject slow dependency extractors
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
--enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings
--enable-shared[=PKGS]
@ -3321,6 +3323,49 @@ fi;
# Check whether --enable-got or --disable-got was given.
if test "${enable_got+set}" = set; then
enableval="$enable_got"
case "${enableval}" in
target | single | negative | multigot) got_handling=$enableval ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-got option" >&5
echo "$as_me: error: bad value ${enableval} for --enable-got option" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
got_handling=target
fi;
case "${got_handling}" in
target)
cat >>confdefs.h <<\_ACEOF
#define GOT_HANDLING_DEFAULT GOT_HANDLING_TARGET_DEFAULT
_ACEOF
;;
single)
cat >>confdefs.h <<\_ACEOF
#define GOT_HANDLING_DEFAULT GOT_HANDLING_SINGLE
_ACEOF
;;
negative)
cat >>confdefs.h <<\_ACEOF
#define GOT_HANDLING_DEFAULT GOT_HANDLING_NEGATIVE
_ACEOF
;;
multigot)
cat >>confdefs.h <<\_ACEOF
#define GOT_HANDLING_DEFAULT GOT_HANDLING_MULTIGOT
_ACEOF
;;
*) { { echo "$as_me:$LINENO: error: bad value ${got_handling} for --enable-got option" >&5
echo "$as_me: error: bad value ${got_handling} for --enable-got option" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
@ -4761,13 +4806,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:4764: $ac_compile\"" >&5)
(eval echo "\"\$as_me:4809: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:4767: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval echo "\"\$as_me:4812: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:4770: output\"" >&5)
(eval echo "\"\$as_me:4815: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@ -5822,7 +5867,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 5825 "configure"' > conftest.$ac_ext
echo '#line 5870 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -6922,11 +6967,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:6925: $lt_compile\"" >&5)
(eval echo "\"\$as_me:6970: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:6929: \$? = $ac_status" >&5
echo "$as_me:6974: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -7244,11 +7289,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7247: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7292: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:7251: \$? = $ac_status" >&5
echo "$as_me:7296: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -7349,11 +7394,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7352: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7397: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:7356: \$? = $ac_status" >&5
echo "$as_me:7401: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -7404,11 +7449,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7407: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7452: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:7411: \$? = $ac_status" >&5
echo "$as_me:7456: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -10201,7 +10246,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10204 "configure"
#line 10249 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -10301,7 +10346,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10304 "configure"
#line 10349 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H

View File

@ -67,6 +67,31 @@ AC_SUBST(use_sysroot)
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
AC_ARG_ENABLE([got],
AS_HELP_STRING([--enable-got=<type>],
[GOT handling scheme (target, single, negative, multigot)]),
[case "${enableval}" in
target | single | negative | multigot) got_handling=$enableval ;;
*) AC_ERROR(bad value ${enableval} for --enable-got option) ;;
esac],
[got_handling=target])
case "${got_handling}" in
target)
AC_DEFINE([GOT_HANDLING_DEFAULT], [GOT_HANDLING_TARGET_DEFAULT],
[Define to choose default GOT handling scheme]) ;;
single)
AC_DEFINE([GOT_HANDLING_DEFAULT], [GOT_HANDLING_SINGLE],
[Define to choose default GOT handling scheme]) ;;
negative)
AC_DEFINE([GOT_HANDLING_DEFAULT], [GOT_HANDLING_NEGATIVE],
[Define to choose default GOT handling scheme]) ;;
multigot)
AC_DEFINE([GOT_HANDLING_DEFAULT], [GOT_HANDLING_MULTIGOT],
[Define to choose default GOT handling scheme]) ;;
*) AC_ERROR(bad value ${got_handling} for --enable-got option) ;;
esac
AM_BINUTILS_WARNINGS
AM_CONFIG_HEADER(config.h:config.in)

View File

@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2000, 2001, 2003, 2007 Free Software Foundation, Inc.
# Copyright 2000, 2001, 2003, 2007, 2008 Free Software Foundation, Inc.
# Written by Michael Sokolov <msokolov@ivan.Harhan.ORG>, based on armelf.em
#
# This file is part of the GNU Binutils.
@ -31,8 +31,28 @@ case ${target} in
;;
esac
case ${target} in
*-linux*)
# Don't use multi-GOT by default due to glibc linker's assumption
# that GOT pointer points to GOT[0].
# got_handling_target_default=GOT_HANDLING_MULTIGOT
got_handling_target_default=GOT_HANDLING_SINGLE
;;
*)
got_handling_target_default=GOT_HANDLING_SINGLE
;;
esac
fragment <<EOF
#define GOT_HANDLING_SINGLE (0)
#define GOT_HANDLING_NEGATIVE (1)
#define GOT_HANDLING_MULTIGOT (2)
#define GOT_HANDLING_TARGET_DEFAULT ${got_handling_target_default}
/* How to generate GOT. */
static int got_handling = GOT_HANDLING_DEFAULT;
#ifdef SUPPORT_EMBEDDED_RELOCS
static void check_sections (bfd *, asection *, void *);
#endif
@ -182,9 +202,49 @@ m68k_elf_after_allocation (void)
#endif /* SUPPORT_EMBEDDED_RELOCS */
}
/* This is a convenient point to tell BFD about target specific flags.
After the output has been created, but before inputs are read. */
static void
elf_m68k_create_output_section_statements (void)
{
bfd_elf_m68k_set_target_options (&link_info, got_handling);
}
EOF
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
PARSE_AND_LIST_PROLOGUE='
#define OPTION_GOT 301
'
PARSE_AND_LIST_LONGOPTS='
{ "got", required_argument, NULL, OPTION_GOT},
'
PARSE_AND_LIST_OPTIONS='
fprintf (file, _(" --got=<type> Specify GOT handling scheme\n"));
'
PARSE_AND_LIST_ARGS_CASES='
case OPTION_GOT:
if (strcmp (optarg, "target") == 0)
got_handling = GOT_HANDLING_TARGET_DEFAULT;
else if (strcmp (optarg, "single") == 0)
got_handling = 0;
else if (strcmp (optarg, "negative") == 0)
got_handling = 1;
else if (strcmp (optarg, "multigot") == 0)
got_handling = 2;
else
einfo (_("Unrecognized --got argument '\''%s'\''.\n"), optarg);
break;
'
# We have our own after_open and after_allocation functions, but they call
# the standard routines, so give them a different name.
LDEMUL_AFTER_OPEN=m68k_elf_after_open
LDEMUL_AFTER_ALLOCATION=m68k_elf_after_allocation
LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=elf_m68k_create_output_section_statements

View File

@ -8,6 +8,7 @@
@set HPPA
@set I960
@set M68HC11
@set M68K
@set MMIX
@set MSP430
@set POWERPC

View File

@ -25,6 +25,7 @@
@set HPPA
@set I960
@set M68HC11
@set M68K
@set MMIX
@set MSP430
@set POWERPC
@ -145,6 +146,9 @@ section entitled ``GNU Free Documentation License''.
@ifset M68HC11
* M68HC11/68HC12:: ld and the Motorola 68HC11 and 68HC12 families
@end ifset
@ifset M68K
* M68K:: ld and Motorola 68K family
@end ifset
@ifset POWERPC
* PowerPC ELF32:: ld and PowerPC 32-bit ELF Support
@end ifset
@ -2440,6 +2444,28 @@ paging and addresses within the memory window.
@c man end
@end ifset
@ifset M68K
@subsection Options specific to Motorola 68K target
@c man begin OPTIONS
The following options are supported to control handling of GOT generation
when linking for 68K targets.
@table @gcctabopt
@kindex --got
@item --got=@var{type}
This option tells the linker which GOT generation scheme to use.
@var{type} should be one of @samp{single}, @samp{negative},
@samp{multigot} or @samp{target}. For more information refer to the
Info entry for @file{ld}.
@end table
@c man end
@end ifset
@ifset UsesEnvVars
@node Environment
@section Environment Variables
@ -5309,6 +5335,9 @@ functionality are not listed.
@ifset HPPA
* HPPA ELF32:: @command{ld} and HPPA 32-bit ELF
@end ifset
@ifset M68K
* M68K:: @command{ld} and the Motorola 68K family
@end ifset
@ifset MMIX
* MMIX:: @command{ld} and MMIX
@end ifset
@ -5731,6 +5760,35 @@ large, it may not be possible for a branch to reach its stub.
@end ifclear
@end ifset
@ifset M68K
@ifclear GENERIC
@raisesections
@end ifclear
@node M68K
@section @command{ld} and the Motorola 68K family
@cindex Motorola 68K GOT generation
@kindex --got=@var{type}
The @samp{--got=@var{type}} option lets you choose the GOT generation scheme.
The choices are @samp{single}, @samp{negative}, @samp{multigot} and
@samp{target}. When @samp{target} is selected the linker chooses
the default GOT generation scheme for the current target.
@samp{single} tells the linker to generate a single GOT with
entries only at non-negative offsets.
@samp{negative} instructs the linker to generate a single GOT with
entries at both negative and positive offsets. Not all environments
support such GOTs.
@samp{multigot} allows the linker to generate several GOTs in the
output file. All GOT references from a single input object
file access the same GOT, but references from different input object
files might access different GOTs. Not all environments support such GOTs.
@ifclear GENERIC
@lowersections
@end ifclear
@end ifset
@ifset MMIX
@ifclear GENERIC
@raisesections

View File

@ -1,3 +1,25 @@
2008-05-21 Maxim Kuvyrkov <maxim@codesourcery.com>
* ld-m68k/got-12.s: New file.
* ld-m68k/got-13.s: New file.
* ld-m68k/got-14.s: New file.
* ld-m68k/got-15.s: New file.
* ld-m68k/got-34.s: New file.
* ld-m68k/got-35.s: New file.
* ld-m68k/got-single-12-ok.d: New dump test.
* ld-m68k/got-single-13-er.d: New dump test.
* ld-m68k/got-negative-14-ok.d: New dump test.
* ld-m68k/got-negative-15-er.d: New dump test.
* ld-m68k/got-negative-12-13-14-34-ok.d: New dump test.
* ld-m68k/got-negative-12-13-14-35-er.d: New dump test.
* ld-m68k/got-multigot-14-ok.d: New dump test.
* ld-m68k/got-multigot-15-er.d: New dump test.
* ld-m68k/got-multigot-12-13-14-34-35-ok.d: New dump test.
* ld-m68k/xgot-15.s: New source.
* ld-m68k/got-xgot-15-ok.d: New test.
* ld-m68k/got-xgot-12-13-14-15-34-35-ok.d: New test.
* ld-m68k/m68k.exp: Run new tests.
2008-05-15 Christophe Lyon <christophe.lyon@st.com>
* ld-arm/arm-elf.exp (armelftests): Add farcall-arm-arm,

32771
ld/testsuite/ld-m68k/got-12.s Normal file

File diff suppressed because it is too large Load Diff

32775
ld/testsuite/ld-m68k/got-13.s Normal file

File diff suppressed because it is too large Load Diff

65551
ld/testsuite/ld-m68k/got-14.s Normal file

File diff suppressed because it is too large Load Diff

65555
ld/testsuite/ld-m68k/got-15.s Normal file

File diff suppressed because it is too large Load Diff

32795
ld/testsuite/ld-m68k/got-34.s Normal file

File diff suppressed because it is too large Load Diff

32799
ld/testsuite/ld-m68k/got-35.s Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
#source: got-15.s
#as: -mcpu=5206
#ld: -shared --got=multigot
#error: .*GOT overflow.*

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
#source: got-12.s
#source: got-13.s
#source: got-14.s
#source: got-35.s
#as: -mcpu=5206
#ld: -shared --got=negative
#error: .*relocation truncated to fit.*

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
#source: got-15.s
#as: -mcpu=5206
#ld: -shared --got=negative
#error: .*GOT overflow.*

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
#source: got-13.s
#as: -mcpu=5206
#ld: -shared --got=single
#error: .*relocation truncated to fit.*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
# Expect script for run_dump_test based ld-m68k tests.
# Copyright 2006, 2007 Free Software Foundation, Inc.
# Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@ -66,3 +66,22 @@ foreach { id sources } { a { plt1.s } b { plt1-empty.s plt1.s } } {
plt1-${id}-${arch}.so]]
}
}
# 1 - 1
# 2 - 8189
# 3 - 8190
# 4 - 16384
# 5 - 16385
run_dump_test "got-single-12-ok"
run_dump_test "got-single-13-er"
run_dump_test "got-negative-14-ok"
run_dump_test "got-negative-15-er"
run_dump_test "got-negative-12-13-14-34-ok"
run_dump_test "got-negative-12-13-14-35-er"
run_dump_test "got-multigot-14-ok"
run_dump_test "got-multigot-15-er"
run_dump_test "got-multigot-12-13-14-34-35-ok"
run_dump_test "got-xgot-15-ok"
run_dump_test "got-xgot-12-13-14-15-34-35-ok"

81940
ld/testsuite/ld-m68k/xgot-15.s Normal file

File diff suppressed because it is too large Load Diff