* [PATCH] Change _bfd_elf_link_setup_gnu_properties to bfd *
@ 2017-04-25 15:13 H.J. Lu
2017-04-27 16:06 ` H.J. Lu
0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2017-04-25 15:13 UTC (permalink / raw)
To: binutils
Change setup_gnu_properties to return the first relocatable ELF input
with GNU properties so that a backend can make decision based on GNU
properties.
Any comments?
H.J.
---
* elf-bfd.h (elf_backend_data): Change setup_gnu_properties
to return bfd *.
(_bfd_elf_link_setup_gnu_properties): Return bfd *.
* elf-properties.c (_bfd_elf_link_setup_gnu_properties): Return
the first relocatable ELF input with GNU properties.
---
bfd/elf-bfd.h | 4 ++--
bfd/elf-properties.c | 11 +++++++----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 4c0c9e8..de8cdb7 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1435,7 +1435,7 @@ struct elf_backend_data
elf_property *);
/* Set up GNU properties. */
- void (*setup_gnu_properties) (struct bfd_link_info *);
+ bfd *(*setup_gnu_properties) (struct bfd_link_info *);
/* Encoding used for compact EH tables. */
int (*compact_eh_encoding) (struct bfd_link_info *);
@@ -2595,7 +2595,7 @@ extern bfd_boolean _bfd_elf_parse_gnu_properties
(bfd *, Elf_Internal_Note *);
extern elf_property * _bfd_elf_get_property
(bfd *, unsigned int, unsigned int);
-extern void _bfd_elf_link_setup_gnu_properties
+extern bfd *_bfd_elf_link_setup_gnu_properties
(struct bfd_link_info *);
/* The linker may need to keep track of the number of relocs that it
diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
index 048ea9c..fda8875 100644
--- a/bfd/elf-properties.c
+++ b/bfd/elf-properties.c
@@ -299,9 +299,10 @@ elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
}
}
-/* Set up GNU properties. */
+/* Set up GNU properties. Return the first relocatable ELF input with
+ GNU properties if found. Otherwise, return NULL. */
-void
+bfd *
_bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
{
bfd *abfd, *first_pbfd = NULL;
@@ -336,7 +337,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
/* Do nothing if there is no .note.gnu.property section. */
if (!has_properties)
- return;
+ return NULL;
/* Merge .note.gnu.property sections. */
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next)
@@ -411,7 +412,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
/* Discard .note.gnu.property section if all properties have
been removed. */
sec->output_section = bfd_abs_section_ptr;
- return;
+ return NULL;
}
/* Compute the section size. */
@@ -488,4 +489,6 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
/* Cache the section contents for elf_link_input_bfd. */
elf_section_data (sec)->this_hdr.contents = contents;
}
+
+ return first_pbfd;
}
--
2.9.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Change _bfd_elf_link_setup_gnu_properties to bfd *
2017-04-25 15:13 [PATCH] Change _bfd_elf_link_setup_gnu_properties to bfd * H.J. Lu
@ 2017-04-27 16:06 ` H.J. Lu
0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2017-04-27 16:06 UTC (permalink / raw)
To: Binutils
On Tue, Apr 25, 2017 at 8:13 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Change setup_gnu_properties to return the first relocatable ELF input
> with GNU properties so that a backend can make decision based on GNU
> properties.
>
> Any comments?
>
> H.J.
> ---
> * elf-bfd.h (elf_backend_data): Change setup_gnu_properties
> to return bfd *.
> (_bfd_elf_link_setup_gnu_properties): Return bfd *.
> * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Return
> the first relocatable ELF input with GNU properties.
> ---
> bfd/elf-bfd.h | 4 ++--
> bfd/elf-properties.c | 11 +++++++----
> 2 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
> index 4c0c9e8..de8cdb7 100644
> --- a/bfd/elf-bfd.h
> +++ b/bfd/elf-bfd.h
> @@ -1435,7 +1435,7 @@ struct elf_backend_data
> elf_property *);
>
> /* Set up GNU properties. */
> - void (*setup_gnu_properties) (struct bfd_link_info *);
> + bfd *(*setup_gnu_properties) (struct bfd_link_info *);
>
> /* Encoding used for compact EH tables. */
> int (*compact_eh_encoding) (struct bfd_link_info *);
> @@ -2595,7 +2595,7 @@ extern bfd_boolean _bfd_elf_parse_gnu_properties
> (bfd *, Elf_Internal_Note *);
> extern elf_property * _bfd_elf_get_property
> (bfd *, unsigned int, unsigned int);
> -extern void _bfd_elf_link_setup_gnu_properties
> +extern bfd *_bfd_elf_link_setup_gnu_properties
> (struct bfd_link_info *);
>
> /* The linker may need to keep track of the number of relocs that it
> diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
> index 048ea9c..fda8875 100644
> --- a/bfd/elf-properties.c
> +++ b/bfd/elf-properties.c
> @@ -299,9 +299,10 @@ elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
> }
> }
>
> -/* Set up GNU properties. */
> +/* Set up GNU properties. Return the first relocatable ELF input with
> + GNU properties if found. Otherwise, return NULL. */
>
> -void
> +bfd *
> _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
> {
> bfd *abfd, *first_pbfd = NULL;
> @@ -336,7 +337,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
>
> /* Do nothing if there is no .note.gnu.property section. */
> if (!has_properties)
> - return;
> + return NULL;
>
> /* Merge .note.gnu.property sections. */
> for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next)
> @@ -411,7 +412,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
> /* Discard .note.gnu.property section if all properties have
> been removed. */
> sec->output_section = bfd_abs_section_ptr;
> - return;
> + return NULL;
> }
>
> /* Compute the section size. */
> @@ -488,4 +489,6 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
> /* Cache the section contents for elf_link_input_bfd. */
> elf_section_data (sec)->this_hdr.contents = contents;
> }
> +
> + return first_pbfd;
> }
> --
> 2.9.3
>
I am checking it in now.
--
H.J.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-27 16:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25 15:13 [PATCH] Change _bfd_elf_link_setup_gnu_properties to bfd * H.J. Lu
2017-04-27 16:06 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).