mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
5b9c07b278
Remove x86-specific linker options from bfd_link_info and put them in elf_linker_x86_params. Add _bfd_elf_linker_x86_set_options to pass x86-specific linker options from ld to bfd. bfd/ * elf-linker-x86.h: New file. * elf32-i386.c (elf_i386_convert_load_reloc): Use htab->params to get x86-specific linker options. * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Likewise. (_bfd_x86_elf_link_setup_gnu_properties): Likewise. (_bfd_elf_linker_x86_set_options): New function. * elfxx-x86.h: Include "elf-linker-x86.h". (elf_x86_link_hash_table): Add params. include/ * bfdlink.h (bfd_link_info): Remove x86-specific linker options. ld/ * Makefile.am (ELF_X86_DEPS): Add $(srcdir)/emultempl/elf-x86.em. (eelf_i386_sol2.c): Also depend on $(srcdir)/emultempl/solaris2-x86.em. (eelf_x86_64_sol2.c): Likewise. * Makefile.in: Regenerated. * emulparams/call_nop.sh: Set x86-specific linker options via params. * emulparams/cet.sh: Likewise. * emulparams/reloc_overflow.sh: Likewise. * emulparams/elf32_x86_64.sh (EXTRA_EM_FILE): New. Set to "elf-x86". * emulparams/elf_i386.sh: Likewise. * emulparams/elf_i386_be.sh: Likewise. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_i386_vxworks.sh: Likewise. * emulparams/elf_iamcu.sh: Likewise. * emulparams/elf_k1om.sh: Likewise. * emulparams/elf_l1om.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * emulparams/elf_i386_sol2.sh (EXTRA_EM_FILE): Changed to "solaris2-x86". * emulparams/elf_x86_64_sol2.sh: Likewise. * emultempl/elf-x86.em: New file. * emultempl/solaris2-x86.em: Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Don't set link_info.call_nop_byte.
44 lines
1.3 KiB
Bash
44 lines
1.3 KiB
Bash
PARSE_AND_LIST_OPTIONS_CALL_NOP='
|
|
fprintf (file, _("\
|
|
-z call-nop=PADDING Use PADDING as 1-byte NOP for branch\n"));
|
|
'
|
|
PARSE_AND_LIST_ARGS_CASE_Z_CALL_NOP='
|
|
else if (strncmp (optarg, "call-nop=", 9) == 0)
|
|
{
|
|
if (strcmp (optarg + 9, "prefix-addr") == 0)
|
|
{
|
|
params.call_nop_as_suffix = FALSE;
|
|
params.call_nop_byte = 0x67;
|
|
}
|
|
else if (strcmp (optarg + 9, "suffix-nop") == 0)
|
|
{
|
|
params.call_nop_as_suffix = TRUE;
|
|
params.call_nop_byte = 0x90;
|
|
}
|
|
else if (strncmp (optarg + 9, "prefix-", 7) == 0)
|
|
{
|
|
char *end;
|
|
params.call_nop_byte = strtoul (optarg + 16 , &end, 0);
|
|
if (*end)
|
|
einfo (_("%F%P: invalid number for -z call-nop=prefix-: %s\n"),
|
|
optarg + 16);
|
|
params.call_nop_as_suffix = FALSE;
|
|
}
|
|
else if (strncmp (optarg + 9, "suffix-", 7) == 0)
|
|
{
|
|
char *end;
|
|
params.call_nop_byte = strtoul (optarg + 16, &end, 0);
|
|
if (*end)
|
|
einfo (_("%F%P: invalid number for -z call-nop=suffix-: %s\n"),
|
|
optarg + 16);
|
|
params.call_nop_as_suffix = TRUE;
|
|
}
|
|
else
|
|
einfo (_("%F%P: unsupported option: -z %s\n"), optarg);
|
|
}
|
|
'
|
|
|
|
PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_CALL_NOP"
|
|
PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_CALL_NOP"
|
|
CALL_NOP_BYTE=0x67
|