mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 06:17:47 +08:00
Allow stubs without associated input section in ARM backend
2016-05-10 Thomas Preud'homme <thomas.preudhomme@arm.com> bfd/ * bfd-in.h (elf32_arm_size_stubs): Add an output section parameter. * bfd-in2.h: Regenerated. * elf32-arm.c (struct elf32_arm_link_hash_table): Add an output section parameter to add_stub_section callback. (elf32_arm_create_or_find_stub_sec): Get output section from link_sec and pass it down to add_stub_section. (elf32_arm_add_stub): Set section to stub_sec if NULL before using it for error message. (elf32_arm_size_stubs): Add output section parameter to add_stub_section function pointer parameter. ld/ * emultempl/armelf.em (elf32_arm_add_stub_section): Add output_section parameter and rename input_section parameter to after_input_section. Append input stub section to the output section if after_input_section is NULL.
This commit is contained in:
@ -1,3 +1,16 @@
|
|||||||
|
2016-05-10 Thomas Preud'homme <thomas.preudhomme@arm.com>
|
||||||
|
|
||||||
|
* bfd-in.h (elf32_arm_size_stubs): Add an output section parameter.
|
||||||
|
* bfd-in2.h: Regenerated.
|
||||||
|
* elf32-arm.c (struct elf32_arm_link_hash_table): Add an output section
|
||||||
|
parameter to add_stub_section callback.
|
||||||
|
(elf32_arm_create_or_find_stub_sec): Get output section from link_sec
|
||||||
|
and pass it down to add_stub_section.
|
||||||
|
(elf32_arm_add_stub): Set section to stub_sec if NULL before using it
|
||||||
|
for error message.
|
||||||
|
(elf32_arm_size_stubs): Add output section parameter to
|
||||||
|
add_stub_section function pointer parameter.
|
||||||
|
|
||||||
2016-05-10 Thomas Preud'homme <thomas.preudhomme@arm.com>
|
2016-05-10 Thomas Preud'homme <thomas.preudhomme@arm.com>
|
||||||
|
|
||||||
* elf32-arm.c (elf32_arm_create_stub): New function.
|
* elf32-arm.c (elf32_arm_create_stub): New function.
|
||||||
|
@ -934,7 +934,8 @@ extern void elf32_arm_next_input_section
|
|||||||
(struct bfd_link_info *, struct bfd_section *);
|
(struct bfd_link_info *, struct bfd_section *);
|
||||||
extern bfd_boolean elf32_arm_size_stubs
|
extern bfd_boolean elf32_arm_size_stubs
|
||||||
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
|
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
|
||||||
struct bfd_section * (*) (const char *, struct bfd_section *, unsigned int),
|
struct bfd_section * (*) (const char *, struct bfd_section *,
|
||||||
|
struct bfd_section *, unsigned int),
|
||||||
void (*) (void));
|
void (*) (void));
|
||||||
extern bfd_boolean elf32_arm_build_stubs
|
extern bfd_boolean elf32_arm_build_stubs
|
||||||
(struct bfd_link_info *);
|
(struct bfd_link_info *);
|
||||||
|
@ -941,7 +941,8 @@ extern void elf32_arm_next_input_section
|
|||||||
(struct bfd_link_info *, struct bfd_section *);
|
(struct bfd_link_info *, struct bfd_section *);
|
||||||
extern bfd_boolean elf32_arm_size_stubs
|
extern bfd_boolean elf32_arm_size_stubs
|
||||||
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
|
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
|
||||||
struct bfd_section * (*) (const char *, struct bfd_section *, unsigned int),
|
struct bfd_section * (*) (const char *, struct bfd_section *,
|
||||||
|
struct bfd_section *, unsigned int),
|
||||||
void (*) (void));
|
void (*) (void));
|
||||||
extern bfd_boolean elf32_arm_build_stubs
|
extern bfd_boolean elf32_arm_build_stubs
|
||||||
(struct bfd_link_info *);
|
(struct bfd_link_info *);
|
||||||
|
@ -3163,7 +3163,8 @@ struct elf32_arm_link_hash_table
|
|||||||
bfd *stub_bfd;
|
bfd *stub_bfd;
|
||||||
|
|
||||||
/* Linker call-backs. */
|
/* Linker call-backs. */
|
||||||
asection * (*add_stub_section) (const char *, asection *, unsigned int);
|
asection * (*add_stub_section) (const char *, asection *, asection *,
|
||||||
|
unsigned int);
|
||||||
void (*layout_sections_again) (void);
|
void (*layout_sections_again) (void);
|
||||||
|
|
||||||
/* Array to keep track of which stub sections have been created, and
|
/* Array to keep track of which stub sections have been created, and
|
||||||
@ -4144,6 +4145,7 @@ elf32_arm_create_or_find_stub_sec (asection **link_sec_p, asection *section,
|
|||||||
{
|
{
|
||||||
asection *link_sec;
|
asection *link_sec;
|
||||||
asection *stub_sec;
|
asection *stub_sec;
|
||||||
|
asection *out_sec;
|
||||||
|
|
||||||
link_sec = htab->stub_group[section->id].link_sec;
|
link_sec = htab->stub_group[section->id].link_sec;
|
||||||
BFD_ASSERT (link_sec != NULL);
|
BFD_ASSERT (link_sec != NULL);
|
||||||
@ -4166,7 +4168,8 @@ elf32_arm_create_or_find_stub_sec (asection **link_sec_p, asection *section,
|
|||||||
|
|
||||||
memcpy (s_name, link_sec->name, namelen);
|
memcpy (s_name, link_sec->name, namelen);
|
||||||
memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX));
|
memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX));
|
||||||
stub_sec = (*htab->add_stub_section) (s_name, link_sec,
|
out_sec = link_sec->output_section;
|
||||||
|
stub_sec = (*htab->add_stub_section) (s_name, out_sec, link_sec,
|
||||||
htab->nacl_p ? 4 : 3);
|
htab->nacl_p ? 4 : 3);
|
||||||
if (stub_sec == NULL)
|
if (stub_sec == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -4202,6 +4205,8 @@ elf32_arm_add_stub (const char *stub_name,
|
|||||||
TRUE, FALSE);
|
TRUE, FALSE);
|
||||||
if (stub_entry == NULL)
|
if (stub_entry == NULL)
|
||||||
{
|
{
|
||||||
|
if (section == NULL)
|
||||||
|
section = stub_sec;
|
||||||
(*_bfd_error_handler) (_("%s: cannot create stub entry %s"),
|
(*_bfd_error_handler) (_("%s: cannot create stub entry %s"),
|
||||||
section->owner,
|
section->owner,
|
||||||
stub_name);
|
stub_name);
|
||||||
@ -5216,6 +5221,7 @@ elf32_arm_size_stubs (bfd *output_bfd,
|
|||||||
struct bfd_link_info *info,
|
struct bfd_link_info *info,
|
||||||
bfd_signed_vma group_size,
|
bfd_signed_vma group_size,
|
||||||
asection * (*add_stub_section) (const char *, asection *,
|
asection * (*add_stub_section) (const char *, asection *,
|
||||||
|
asection *,
|
||||||
unsigned int),
|
unsigned int),
|
||||||
void (*layout_sections_again) (void))
|
void (*layout_sections_again) (void))
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2016-05-10 Thomas Preud'homme <thomas.preudhomme@arm.com>
|
||||||
|
|
||||||
|
* emultempl/armelf.em (elf32_arm_add_stub_section): Add output_section
|
||||||
|
parameter and rename input_section parameter to after_input_section.
|
||||||
|
Append input stub section to the output section if after_input_section
|
||||||
|
is NULL.
|
||||||
|
|
||||||
2016-05-10 Thomas Preud'homme <thomas.preudhomme@arm.com>
|
2016-05-10 Thomas Preud'homme <thomas.preudhomme@arm.com>
|
||||||
|
|
||||||
* testsuite/ld-arm/arm-elf.exp (EABI attribute merging 10 (DSP)): New
|
* testsuite/ld-arm/arm-elf.exp (EABI attribute merging 10 (DSP)): New
|
||||||
|
@ -203,12 +203,12 @@ hook_in_stub (struct hook_stub_info *info, lang_statement_union_type **lp)
|
|||||||
|
|
||||||
static asection *
|
static asection *
|
||||||
elf32_arm_add_stub_section (const char * stub_sec_name,
|
elf32_arm_add_stub_section (const char * stub_sec_name,
|
||||||
asection * input_section,
|
asection * output_section,
|
||||||
|
asection * after_input_section,
|
||||||
unsigned int alignment_power)
|
unsigned int alignment_power)
|
||||||
{
|
{
|
||||||
asection *stub_sec;
|
asection *stub_sec;
|
||||||
flagword flags;
|
flagword flags;
|
||||||
asection *output_section;
|
|
||||||
lang_output_section_statement_type *os;
|
lang_output_section_statement_type *os;
|
||||||
struct hook_stub_info info;
|
struct hook_stub_info info;
|
||||||
|
|
||||||
@ -221,18 +221,34 @@ elf32_arm_add_stub_section (const char * stub_sec_name,
|
|||||||
|
|
||||||
bfd_set_section_alignment (stub_file->the_bfd, stub_sec, alignment_power);
|
bfd_set_section_alignment (stub_file->the_bfd, stub_sec, alignment_power);
|
||||||
|
|
||||||
output_section = input_section->output_section;
|
|
||||||
os = lang_output_section_get (output_section);
|
os = lang_output_section_get (output_section);
|
||||||
|
|
||||||
info.input_section = input_section;
|
info.input_section = after_input_section;
|
||||||
lang_list_init (&info.add);
|
lang_list_init (&info.add);
|
||||||
lang_add_section (&info.add, stub_sec, NULL, os);
|
lang_add_section (&info.add, stub_sec, NULL, os);
|
||||||
|
|
||||||
if (info.add.head == NULL)
|
if (info.add.head == NULL)
|
||||||
goto err_ret;
|
goto err_ret;
|
||||||
|
|
||||||
|
if (after_input_section == NULL)
|
||||||
|
{
|
||||||
|
lang_statement_union_type **lp = &os->children.head;
|
||||||
|
lang_statement_union_type *l, *lprev = NULL;
|
||||||
|
|
||||||
|
for (; (l = *lp) != NULL; lp = &l->header.next, lprev = l);
|
||||||
|
|
||||||
|
if (lprev)
|
||||||
|
lprev->header.next = info.add.head;
|
||||||
|
else
|
||||||
|
os->children.head = info.add.head;
|
||||||
|
|
||||||
|
return stub_sec;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (hook_in_stub (&info, &os->children.head))
|
if (hook_in_stub (&info, &os->children.head))
|
||||||
return stub_sec;
|
return stub_sec;
|
||||||
|
}
|
||||||
|
|
||||||
err_ret:
|
err_ret:
|
||||||
einfo ("%X%P: can not make stub section: %E\n");
|
einfo ("%X%P: can not make stub section: %E\n");
|
||||||
|
Reference in New Issue
Block a user