* [PATCH] ELF: Pass bfd_link_info to merge_gnu_properties
@ 2017-06-09 16:26 H.J. Lu
2017-06-12 14:35 ` H.J. Lu
0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2017-06-09 16:26 UTC (permalink / raw)
To: binutils
Pass struct bfd_link_info * to merge_gnu_properties to give backend
control of how GNU properties are merged based on linker command line
options.
Any comments?
H.J.
---
* elf-bfd.h (elf_backend_data): Add struct bfd_link_info *
to merge_gnu_properties.
* elf-properties.c (elf_merge_gnu_properties): Add struct
bfd_link_info * and pass it to merge_gnu_properties.
(elf_merge_gnu_property_list): Add struct bfd_link_info *
and pass it to elf_merge_gnu_properties.
(_bfd_elf_link_setup_gnu_properties): Pass info to
elf_merge_gnu_property_list.
* elf32-i386.c (elf_i386_merge_gnu_properties): Add struct
bfd_link_info *.
* elf64-x86-64.c (elf_x86_64_merge_gnu_properties): Likewise.
---
bfd/elf-bfd.h | 4 ++--
bfd/elf-properties.c | 15 ++++++++-------
bfd/elf32-i386.c | 3 ++-
bfd/elf64-x86-64.c | 3 ++-
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 820bc98..567b63a 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1437,8 +1437,8 @@ struct elf_backend_data
unsigned int);
/* Merge GNU properties. Return TRUE if property is updated. */
- bfd_boolean (*merge_gnu_properties) (bfd *, elf_property *,
- elf_property *);
+ bfd_boolean (*merge_gnu_properties) (struct bfd_link_info *, bfd *,
+ elf_property *, elf_property *);
/* Set up GNU properties. */
bfd *(*setup_gnu_properties) (struct bfd_link_info *);
diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
index fda8875..2d054dd 100644
--- a/bfd/elf-properties.c
+++ b/bfd/elf-properties.c
@@ -197,8 +197,8 @@ next:
with ABFD. */
static bfd_boolean
-elf_merge_gnu_properties (bfd *abfd, elf_property *aprop,
- elf_property *bprop)
+elf_merge_gnu_properties (struct bfd_link_info *info, bfd *abfd,
+ elf_property *aprop, elf_property *bprop)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
@@ -206,7 +206,7 @@ elf_merge_gnu_properties (bfd *abfd, elf_property *aprop,
if (bed->merge_gnu_properties != NULL
&& pr_type >= GNU_PROPERTY_LOPROC
&& pr_type < GNU_PROPERTY_LOUSER)
- return bed->merge_gnu_properties (abfd, aprop, bprop);
+ return bed->merge_gnu_properties (info, abfd, aprop, bprop);
switch (pr_type)
{
@@ -263,7 +263,8 @@ elf_find_and_remove_property (elf_property_list **listp,
/* Merge GNU property list *LISTP with ABFD. */
static void
-elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
+elf_merge_gnu_property_list (struct bfd_link_info *info, bfd *abfd,
+ elf_property_list **listp)
{
elf_property_list *p, **lastp;
elf_property *pr;
@@ -275,7 +276,7 @@ elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
pr = elf_find_and_remove_property (listp, p->property.pr_type);
/* Pass NULL to elf_merge_gnu_properties for the property which
isn't on *LISTP. */
- elf_merge_gnu_properties (abfd, &p->property, pr);
+ elf_merge_gnu_properties (info, abfd, &p->property, pr);
if (p->property.pr_kind == property_remove)
{
/* Remove this property. */
@@ -287,7 +288,7 @@ elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
/* Merge the remaining properties on *LISTP with ABFD. */
for (p = *listp; p != NULL; p = p->next)
- if (elf_merge_gnu_properties (abfd, NULL, &p->property))
+ if (elf_merge_gnu_properties (info, abfd, NULL, &p->property))
{
pr = _bfd_elf_get_property (abfd, p->property.pr_type,
p->property.pr_datasz);
@@ -365,7 +366,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
when all properties are from ELF objects with different
machine code or class. */
if (first_pbfd != NULL)
- elf_merge_gnu_property_list (first_pbfd, listp);
+ elf_merge_gnu_property_list (info, first_pbfd, listp);
if (list != NULL)
{
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index e447e3d..f9142a9 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -6388,7 +6388,8 @@ elf_i386_parse_gnu_properties (bfd *abfd, unsigned int type,
should be merged with ABFD. */
static bfd_boolean
-elf_i386_merge_gnu_properties (bfd *abfd ATTRIBUTE_UNUSED,
+elf_i386_merge_gnu_properties (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
elf_property *aprop,
elf_property *bprop)
{
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index c94d7ff..5306019 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -7035,7 +7035,8 @@ elf_x86_64_parse_gnu_properties (bfd *abfd, unsigned int type,
should be merged with ABFD. */
static bfd_boolean
-elf_x86_64_merge_gnu_properties (bfd *abfd ATTRIBUTE_UNUSED,
+elf_x86_64_merge_gnu_properties (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
elf_property *aprop,
elf_property *bprop)
{
--
2.9.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ELF: Pass bfd_link_info to merge_gnu_properties
2017-06-09 16:26 [PATCH] ELF: Pass bfd_link_info to merge_gnu_properties H.J. Lu
@ 2017-06-12 14:35 ` H.J. Lu
0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2017-06-12 14:35 UTC (permalink / raw)
To: Binutils
On Fri, Jun 9, 2017 at 9:26 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Pass struct bfd_link_info * to merge_gnu_properties to give backend
> control of how GNU properties are merged based on linker command line
> options.
>
> Any comments?
I am checking it in.
> H.J.
> ---
> * elf-bfd.h (elf_backend_data): Add struct bfd_link_info *
> to merge_gnu_properties.
> * elf-properties.c (elf_merge_gnu_properties): Add struct
> bfd_link_info * and pass it to merge_gnu_properties.
> (elf_merge_gnu_property_list): Add struct bfd_link_info *
> and pass it to elf_merge_gnu_properties.
> (_bfd_elf_link_setup_gnu_properties): Pass info to
> elf_merge_gnu_property_list.
> * elf32-i386.c (elf_i386_merge_gnu_properties): Add struct
> bfd_link_info *.
> * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): Likewise.
> ---
> bfd/elf-bfd.h | 4 ++--
> bfd/elf-properties.c | 15 ++++++++-------
> bfd/elf32-i386.c | 3 ++-
> bfd/elf64-x86-64.c | 3 ++-
> 4 files changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
> index 820bc98..567b63a 100644
> --- a/bfd/elf-bfd.h
> +++ b/bfd/elf-bfd.h
> @@ -1437,8 +1437,8 @@ struct elf_backend_data
> unsigned int);
>
> /* Merge GNU properties. Return TRUE if property is updated. */
> - bfd_boolean (*merge_gnu_properties) (bfd *, elf_property *,
> - elf_property *);
> + bfd_boolean (*merge_gnu_properties) (struct bfd_link_info *, bfd *,
> + elf_property *, elf_property *);
>
> /* Set up GNU properties. */
> bfd *(*setup_gnu_properties) (struct bfd_link_info *);
> diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
> index fda8875..2d054dd 100644
> --- a/bfd/elf-properties.c
> +++ b/bfd/elf-properties.c
> @@ -197,8 +197,8 @@ next:
> with ABFD. */
>
> static bfd_boolean
> -elf_merge_gnu_properties (bfd *abfd, elf_property *aprop,
> - elf_property *bprop)
> +elf_merge_gnu_properties (struct bfd_link_info *info, bfd *abfd,
> + elf_property *aprop, elf_property *bprop)
> {
> const struct elf_backend_data *bed = get_elf_backend_data (abfd);
> unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
> @@ -206,7 +206,7 @@ elf_merge_gnu_properties (bfd *abfd, elf_property *aprop,
> if (bed->merge_gnu_properties != NULL
> && pr_type >= GNU_PROPERTY_LOPROC
> && pr_type < GNU_PROPERTY_LOUSER)
> - return bed->merge_gnu_properties (abfd, aprop, bprop);
> + return bed->merge_gnu_properties (info, abfd, aprop, bprop);
>
> switch (pr_type)
> {
> @@ -263,7 +263,8 @@ elf_find_and_remove_property (elf_property_list **listp,
> /* Merge GNU property list *LISTP with ABFD. */
>
> static void
> -elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
> +elf_merge_gnu_property_list (struct bfd_link_info *info, bfd *abfd,
> + elf_property_list **listp)
> {
> elf_property_list *p, **lastp;
> elf_property *pr;
> @@ -275,7 +276,7 @@ elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
> pr = elf_find_and_remove_property (listp, p->property.pr_type);
> /* Pass NULL to elf_merge_gnu_properties for the property which
> isn't on *LISTP. */
> - elf_merge_gnu_properties (abfd, &p->property, pr);
> + elf_merge_gnu_properties (info, abfd, &p->property, pr);
> if (p->property.pr_kind == property_remove)
> {
> /* Remove this property. */
> @@ -287,7 +288,7 @@ elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
>
> /* Merge the remaining properties on *LISTP with ABFD. */
> for (p = *listp; p != NULL; p = p->next)
> - if (elf_merge_gnu_properties (abfd, NULL, &p->property))
> + if (elf_merge_gnu_properties (info, abfd, NULL, &p->property))
> {
> pr = _bfd_elf_get_property (abfd, p->property.pr_type,
> p->property.pr_datasz);
> @@ -365,7 +366,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
> when all properties are from ELF objects with different
> machine code or class. */
> if (first_pbfd != NULL)
> - elf_merge_gnu_property_list (first_pbfd, listp);
> + elf_merge_gnu_property_list (info, first_pbfd, listp);
>
> if (list != NULL)
> {
> diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
> index e447e3d..f9142a9 100644
> --- a/bfd/elf32-i386.c
> +++ b/bfd/elf32-i386.c
> @@ -6388,7 +6388,8 @@ elf_i386_parse_gnu_properties (bfd *abfd, unsigned int type,
> should be merged with ABFD. */
>
> static bfd_boolean
> -elf_i386_merge_gnu_properties (bfd *abfd ATTRIBUTE_UNUSED,
> +elf_i386_merge_gnu_properties (struct bfd_link_info *info ATTRIBUTE_UNUSED,
> + bfd *abfd ATTRIBUTE_UNUSED,
> elf_property *aprop,
> elf_property *bprop)
> {
> diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
> index c94d7ff..5306019 100644
> --- a/bfd/elf64-x86-64.c
> +++ b/bfd/elf64-x86-64.c
> @@ -7035,7 +7035,8 @@ elf_x86_64_parse_gnu_properties (bfd *abfd, unsigned int type,
> should be merged with ABFD. */
>
> static bfd_boolean
> -elf_x86_64_merge_gnu_properties (bfd *abfd ATTRIBUTE_UNUSED,
> +elf_x86_64_merge_gnu_properties (struct bfd_link_info *info ATTRIBUTE_UNUSED,
> + bfd *abfd ATTRIBUTE_UNUSED,
> elf_property *aprop,
> elf_property *bprop)
> {
> --
> 2.9.4
>
--
H.J.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ELF: Pass bfd_link_info to merge_gnu_properties
@ 2017-05-22 16:40 H.J. Lu
0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2017-05-22 16:40 UTC (permalink / raw)
To: binutils
Pass struct bfd_link_info * to merge_gnu_properties to give backend
control of how GNU properties are merged.
Any comments?
H.J.
---
* elf-bfd.h (elf_backend_data): Add struct bfd_link_info *
to merge_gnu_properties.
* elf-properties.c (elf_merge_gnu_properties): Add struct
bfd_link_info * and pass it to merge_gnu_properties.
(elf_merge_gnu_property_list): Add struct bfd_link_info *
and pass it to elf_merge_gnu_properties.
(_bfd_elf_link_setup_gnu_properties): Pass info to
elf_merge_gnu_property_list.
* elf32-i386.c (elf_i386_merge_gnu_properties): Add struct
bfd_link_info *.
* elf64-x86-64.c (elf_x86_64_merge_gnu_properties): Likewise.
---
bfd/elf-bfd.h | 4 ++--
bfd/elf-properties.c | 15 ++++++++-------
bfd/elf32-i386.c | 3 ++-
bfd/elf64-x86-64.c | 3 ++-
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 4110ace..af74efb 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1437,8 +1437,8 @@ struct elf_backend_data
unsigned int);
/* Merge GNU properties. Return TRUE if property is updated. */
- bfd_boolean (*merge_gnu_properties) (bfd *, elf_property *,
- elf_property *);
+ bfd_boolean (*merge_gnu_properties) (struct bfd_link_info *, bfd *,
+ elf_property *, elf_property *);
/* Set up GNU properties. */
bfd *(*setup_gnu_properties) (struct bfd_link_info *);
diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
index fda8875..2d054dd 100644
--- a/bfd/elf-properties.c
+++ b/bfd/elf-properties.c
@@ -197,8 +197,8 @@ next:
with ABFD. */
static bfd_boolean
-elf_merge_gnu_properties (bfd *abfd, elf_property *aprop,
- elf_property *bprop)
+elf_merge_gnu_properties (struct bfd_link_info *info, bfd *abfd,
+ elf_property *aprop, elf_property *bprop)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
@@ -206,7 +206,7 @@ elf_merge_gnu_properties (bfd *abfd, elf_property *aprop,
if (bed->merge_gnu_properties != NULL
&& pr_type >= GNU_PROPERTY_LOPROC
&& pr_type < GNU_PROPERTY_LOUSER)
- return bed->merge_gnu_properties (abfd, aprop, bprop);
+ return bed->merge_gnu_properties (info, abfd, aprop, bprop);
switch (pr_type)
{
@@ -263,7 +263,8 @@ elf_find_and_remove_property (elf_property_list **listp,
/* Merge GNU property list *LISTP with ABFD. */
static void
-elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
+elf_merge_gnu_property_list (struct bfd_link_info *info, bfd *abfd,
+ elf_property_list **listp)
{
elf_property_list *p, **lastp;
elf_property *pr;
@@ -275,7 +276,7 @@ elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
pr = elf_find_and_remove_property (listp, p->property.pr_type);
/* Pass NULL to elf_merge_gnu_properties for the property which
isn't on *LISTP. */
- elf_merge_gnu_properties (abfd, &p->property, pr);
+ elf_merge_gnu_properties (info, abfd, &p->property, pr);
if (p->property.pr_kind == property_remove)
{
/* Remove this property. */
@@ -287,7 +288,7 @@ elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
/* Merge the remaining properties on *LISTP with ABFD. */
for (p = *listp; p != NULL; p = p->next)
- if (elf_merge_gnu_properties (abfd, NULL, &p->property))
+ if (elf_merge_gnu_properties (info, abfd, NULL, &p->property))
{
pr = _bfd_elf_get_property (abfd, p->property.pr_type,
p->property.pr_datasz);
@@ -365,7 +366,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
when all properties are from ELF objects with different
machine code or class. */
if (first_pbfd != NULL)
- elf_merge_gnu_property_list (first_pbfd, listp);
+ elf_merge_gnu_property_list (info, first_pbfd, listp);
if (list != NULL)
{
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 1fdc06c..ac015c3 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -6379,7 +6379,8 @@ elf_i386_parse_gnu_properties (bfd *abfd, unsigned int type,
should be merged with ABFD. */
static bfd_boolean
-elf_i386_merge_gnu_properties (bfd *abfd ATTRIBUTE_UNUSED,
+elf_i386_merge_gnu_properties (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
elf_property *aprop,
elf_property *bprop)
{
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 7beb78e..6a1c1de 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -7020,7 +7020,8 @@ elf_x86_64_parse_gnu_properties (bfd *abfd, unsigned int type,
should be merged with ABFD. */
static bfd_boolean
-elf_x86_64_merge_gnu_properties (bfd *abfd ATTRIBUTE_UNUSED,
+elf_x86_64_merge_gnu_properties (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
elf_property *aprop,
elf_property *bprop)
{
--
2.9.4
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-12 14:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 16:26 [PATCH] ELF: Pass bfd_link_info to merge_gnu_properties H.J. Lu
2017-06-12 14:35 ` H.J. Lu
-- strict thread matches above, loose matches on Subject: below --
2017-05-22 16:40 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).