mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 19:09:31 +08:00
cskyelf.em branch stub handling
This fixes the csky-elf ld-elf/pr21884 and ld-unique/pr21529 failures, by disabling branch stubs for binary (and other non-csky) output. The csky-linux target gets branch stubs off by default because presumably there are reasons why branch stubs were disabled, but rather than killing the support completely it can be enabled by --branch-stub. * emultempl/cskyelf.em (csk_elf_before_parse): New function, setting use_branch_stub false for linux. (csky_elf_create_output_section_statements): Do emit this function and all others in the file for linux, plus the branch option control. Disable branch stubs when non-ELF.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2019-04-10 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* emultempl/cskyelf.em (csk_elf_before_parse): New function,
|
||||||
|
setting use_branch_stub false for linux.
|
||||||
|
(csky_elf_create_output_section_statements): Do emit this
|
||||||
|
function and all others in the file for linux, plus the branch
|
||||||
|
option control. Disable branch stubs when non-ELF.
|
||||||
|
|
||||||
2019-04-10 Alan Modra <amodra@gmail.com>
|
2019-04-10 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* Makefile.am (eskyelf.c, eskyelf_linux.c): Depend on cskyelf.em.
|
* Makefile.am (eskyelf.c, eskyelf_linux.c): Depend on cskyelf.em.
|
||||||
|
@ -116,25 +116,32 @@ EOF
|
|||||||
case ${target} in
|
case ${target} in
|
||||||
csky-*-linux-*)
|
csky-*-linux-*)
|
||||||
fragment <<EOF
|
fragment <<EOF
|
||||||
/* 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
|
static void
|
||||||
csky_elf_create_output_section_statements (void)
|
csky_elf_before_parse (void)
|
||||||
{
|
{
|
||||||
use_branch_stub = FALSE;
|
use_branch_stub = FALSE;
|
||||||
|
gld${EMULATION_NAME}_before_parse ();
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
*)
|
esac
|
||||||
|
|
||||||
fragment <<EOF
|
fragment <<EOF
|
||||||
|
|
||||||
/* This is a convenient point to tell BFD about target specific flags.
|
/* This is a convenient point to tell BFD about target specific flags.
|
||||||
After the output has been created, but before inputs are read. */
|
After the output has been created, but before inputs are read. */
|
||||||
static void
|
static void
|
||||||
csky_elf_create_output_section_statements (void)
|
csky_elf_create_output_section_statements (void)
|
||||||
{
|
{
|
||||||
|
if (!(bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
|
||||||
|
&& elf_object_id (link_info.output_bfd) == CSKY_ELF_DATA))
|
||||||
|
use_branch_stub = FALSE;
|
||||||
|
|
||||||
/* If don't use branch stub, just do not emit stub_file. */
|
/* If don't use branch stub, just do not emit stub_file. */
|
||||||
if (use_branch_stub == FALSE)
|
if (!use_branch_stub)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
stub_file = lang_add_input_file ("linker stubs",
|
stub_file = lang_add_input_file ("linker stubs",
|
||||||
lang_input_file_is_fake_enum, NULL);
|
lang_input_file_is_fake_enum, NULL);
|
||||||
stub_file->the_bfd = bfd_create ("linker stubs", link_info.output_bfd);
|
stub_file->the_bfd = bfd_create ("linker stubs", link_info.output_bfd);
|
||||||
@ -150,11 +157,7 @@ csky_elf_create_output_section_statements (void)
|
|||||||
stub_file->the_bfd->flags |= BFD_LINKER_CREATED;
|
stub_file->the_bfd->flags |= BFD_LINKER_CREATED;
|
||||||
ldlang_add_file (stub_file);
|
ldlang_add_file (stub_file);
|
||||||
}
|
}
|
||||||
EOF
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
fragment <<EOF
|
|
||||||
/* Call-back for elf32_csky_size_stubs. */
|
/* Call-back for elf32_csky_size_stubs. */
|
||||||
|
|
||||||
/* Create a new stub section, and arrange for it to be linked
|
/* Create a new stub section, and arrange for it to be linked
|
||||||
@ -304,11 +307,6 @@ EOF
|
|||||||
|
|
||||||
# This code gets inserted into the generic elf32.sc linker script
|
# This code gets inserted into the generic elf32.sc linker script
|
||||||
# and allows us to define our own command line switches.
|
# and allows us to define our own command line switches.
|
||||||
case ${target} in
|
|
||||||
csky-*-linux-*)
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
PARSE_AND_LIST_PROLOGUE='
|
PARSE_AND_LIST_PROLOGUE='
|
||||||
#define OPTION_BRANCH_STUB 301
|
#define OPTION_BRANCH_STUB 301
|
||||||
#define OPTION_NO_BRANCH_STUB 302
|
#define OPTION_NO_BRANCH_STUB 302
|
||||||
@ -347,9 +345,10 @@ PARSE_AND_LIST_ARGS_CASES='
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
'
|
'
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
case ${target} in
|
||||||
|
csky-*-linux-*) LDEMUL_BEFORE_PARSE=csky_elf_before_parse ;;
|
||||||
|
esac
|
||||||
LDEMUL_AFTER_ALLOCATION=gld${EMULATION_NAME}_after_allocation
|
LDEMUL_AFTER_ALLOCATION=gld${EMULATION_NAME}_after_allocation
|
||||||
LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=csky_elf_create_output_section_statements
|
LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=csky_elf_create_output_section_statements
|
||||||
LDEMUL_FINISH=gld${EMULATION_NAME}_finish
|
LDEMUL_FINISH=gld${EMULATION_NAME}_finish
|
||||||
|
Reference in New Issue
Block a user