* [PATCH] C-SKY: Fix machine flag.
@ 2023-01-13 12:54 Xianmiao Qu
2023-01-17 11:49 ` Nick Clifton
0 siblings, 1 reply; 4+ messages in thread
From: Xianmiao Qu @ 2023-01-13 12:54 UTC (permalink / raw)
To: binutils, lifang_xia
bfd/
* elf32-csky.c (elf32_csky_merge_attributes): Don't save
and restore the ARCH attribute, it will actually clear
the ARCH attribute.
(csky_elf_merge_private_bfd_data): Store the machine flag
correctly.
---
bfd/elf32-csky.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
index 7e03a3bc44d..7c2bd5dd8c0 100644
--- a/bfd/elf32-csky.c
+++ b/bfd/elf32-csky.c
@@ -2892,16 +2892,8 @@ elf32_csky_merge_attributes (bfd *ibfd, struct bfd_link_info *info)
/* This is the first object. Copy the attributes. */
out_attr = elf_known_obj_attributes_proc (obfd);
- /* If Tag_CSKY_CPU_NAME is already set, save it. */
- memcpy (&tattr, &out_attr[Tag_CSKY_ARCH_NAME], sizeof (tattr));
-
_bfd_elf_copy_obj_attributes (ibfd, obfd);
- out_attr = elf_known_obj_attributes_proc (obfd);
-
- /* Restore Tag_CSKY_CPU_NAME. */
- memcpy (&out_attr[Tag_CSKY_ARCH_NAME], &tattr, sizeof (tattr));
-
/* Use the Tag_null value to indicate the attributes have been
initialized. */
out_attr[0].i = 1;
@@ -3067,11 +3059,12 @@ csky_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
out_attr = elf_known_obj_attributes_proc (obfd);
/* the flags like"e , f ,g ..." , we take collection. */
- newest_flag = (old_flags & (~CSKY_ARCH_MASK))
- | (new_flags & (~CSKY_ARCH_MASK));
+ newest_flag = old_flags | new_flags;
sec_name = get_elf_backend_data (ibfd)->obj_attrs_section;
- if (bfd_get_section_by_name (ibfd, sec_name) == NULL)
+ if (bfd_get_section_by_name (ibfd, sec_name) == NULL
+ || (new_flags & (CSKY_ARCH_MASK | CSKY_ABI_MASK) !=
+ old_flags & (CSKY_ARCH_MASK | CSKY_ABI_MASK)))
{
/* Input BFDs have no ".csky.attribute" section. */
new_arch = csky_find_arch_with_eflag (new_flags & CSKY_ARCH_MASK);
@@ -3110,9 +3103,6 @@ csky_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
out_attr[Tag_CSKY_ARCH_NAME].s =
_bfd_elf_attr_strdup (obfd, newest_arch->name);
}
- else
- newest_flag |= ((new_flags & (CSKY_ARCH_MASK | CSKY_ABI_MASK))
- | (old_flags & (CSKY_ARCH_MASK | CSKY_ABI_MASK)));
}
else
{
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] C-SKY: Fix machine flag.
2023-01-13 12:54 [PATCH] C-SKY: Fix machine flag Xianmiao Qu
@ 2023-01-17 11:49 ` Nick Clifton
2023-01-17 12:53 ` Mark Wielaard
0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2023-01-17 11:49 UTC (permalink / raw)
To: Xianmiao Qu, binutils, lifang_xia
Hi Xianmiao Qu,
> bfd/
> * elf32-csky.c (elf32_csky_merge_attributes): Don't save
> and restore the ARCH attribute, it will actually clear
> the ARCH attribute.
> (csky_elf_merge_private_bfd_data): Store the machine flag
> correctly.
Approved and applied.
Cheers
Nick
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] C-SKY: Fix machine flag.
2023-01-17 11:49 ` Nick Clifton
@ 2023-01-17 12:53 ` Mark Wielaard
2023-01-17 12:57 ` Nick Clifton
0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2023-01-17 12:53 UTC (permalink / raw)
To: Nick Clifton, Xianmiao Qu, binutils, lifang_xia
Hi,
On Tue, 2023-01-17 at 11:49 +0000, Nick Clifton via Binutils wrote:
> Hi Xianmiao Qu,
>
> > bfd/
> > * elf32-csky.c (elf32_csky_merge_attributes): Don't save
> > and restore the ARCH attribute, it will actually clear
> > the ARCH attribute.
> > (csky_elf_merge_private_bfd_data): Store the machine flag
> > correctly.
>
> Approved and applied.
Note that this broke the build on all arches:
https://builder.sourceware.org/buildbot/#/changes/17260
../../binutils-gdb/bfd/elf32-csky.c: In function
‘elf32_csky_merge_attributes’:
../../binutils-gdb/bfd/elf32-csky.c:2867:17: error: unused variable
‘tattr’ [-Werror=unused-variable]
2867 | obj_attribute tattr;
| ^~~~~
../../binutils-gdb/bfd/elf32-csky.c: In function
‘csky_elf_merge_private_bfd_data’:
../../binutils-gdb/bfd/elf32-csky.c:3067:56: error: suggest parentheses
around comparison in operand of ‘&’ [-Werror=parentheses]
3067 | || (new_flags & (CSKY_ARCH_MASK | CSKY_ABI_MASK) !=
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
3068 | old_flags & (CSKY_ARCH_MASK | CSKY_ABI_MASK)))
| ~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [Makefile:1765: elf32-csky.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] C-SKY: Fix machine flag.
2023-01-17 12:53 ` Mark Wielaard
@ 2023-01-17 12:57 ` Nick Clifton
0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2023-01-17 12:57 UTC (permalink / raw)
To: Mark Wielaard, Xianmiao Qu, binutils, lifang_xia
Hi Mark,
> Note that this broke the build on all arches:
> https://builder.sourceware.org/buildbot/#/changes/17260
So it did. Sorry about that. It should now be fixed, but
it does leave me wondering why my test build did not pick
it up. I must investigate.
Cheers
Nick
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-17 12:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 12:54 [PATCH] C-SKY: Fix machine flag Xianmiao Qu
2023-01-17 11:49 ` Nick Clifton
2023-01-17 12:53 ` Mark Wielaard
2023-01-17 12:57 ` Nick Clifton
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).