* gas misbehavior in binutils-2.16.1 for sh4 target and --enable-shared
@ 2005-08-24 23:52 Mike Frysinger
2005-08-25 5:13 ` Kaz Kojima
0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2005-08-24 23:52 UTC (permalink / raw)
To: binutils
while debugging a gcc issue, i noticed that `file` was giving me varying
results; turns out that it was due to configuring binutils-2.16.1 with
--enable-shared. binutils-2.15 works as expected, so i'm inclined to think it
a bug :). the other quirky thing is readelf shows different Flags in the ELF
header ...
using vanilla binutils-2.16.1 and binutils-2.15 on an amd64 host, i ran:
./configure --target=sh4-linux --enable-shared
make
touch test.s
./gas/as-new test.s -o test.o
file test.o
./binutils/readelf -h test.o | grep Flags
binutils-2.16.1 with --enabled-shared:
test.o: ELF 32-bit LSB relocatable, Hitachi SH, version 1 (SYSV), not stripped
Flags: 0x19, unknown ISA
binutils-2.16.1 without --enabled-shared:
binutils-2.15 with --enabled-shared:
test.o: ELF 32-bit LSB relocatable, Hitachi SH, version 1 MathCoPro/FPU/MAU
Required (SYSV), not stripped
Flags: 0x1, sh1
running through strace shows that the correct libbfd.so is being loaded,
libbfd-2.16.1.so from ./bfd/.libs/x86_64/libbfd-2.16.1.so ... so what
gives ? :)
for reference, i tested a few different versions ... 2.15.92.0.2 and
2.16.91.0.3 also have this odd behavior ...
-mike
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gas misbehavior in binutils-2.16.1 for sh4 target and --enable-shared
2005-08-24 23:52 gas misbehavior in binutils-2.16.1 for sh4 target and --enable-shared Mike Frysinger
@ 2005-08-25 5:13 ` Kaz Kojima
2005-08-25 5:46 ` Alan Modra
2005-08-25 22:08 ` Mike Frysinger
0 siblings, 2 replies; 5+ messages in thread
From: Kaz Kojima @ 2005-08-25 5:13 UTC (permalink / raw)
To: vapier; +Cc: binutils
Mike Frysinger <vapier@gentoo.org> wrote:
> binutils-2.16.1 with --enabled-shared:
> test.o: ELF 32-bit LSB relocatable, Hitachi SH, version 1 (SYSV), not stripped
> Flags: 0x19, unknown ISA
It's caused by an off-by-one error. Thanks for catching it.
sh_elf_get_flags_from_mach looks up a value in a table starting with
the wrong index. I've committed the attached patch.
Regards,
kaz
--
2005-08-25 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* elf32-sh.c (sh_elf_get_flags_from_mach): Fix off-by-one error.
--- ORIG/src/bfd/elf32-sh.c 2005-08-25 11:59:27.000000000 +0900
+++ LOCAL/src/bfd/elf32-sh.c 2005-08-25 12:05:33.000000000 +0900
@@ -6655,7 +6655,7 @@ sh_elf_set_mach_from_flags (bfd *abfd)
int
sh_elf_get_flags_from_mach (unsigned long mach)
{
- int i = ARRAY_SIZE (sh_ef_bfd_table);
+ int i = ARRAY_SIZE (sh_ef_bfd_table) - 1;
for (; i>0; i--)
if (sh_ef_bfd_table[i] == mach)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gas misbehavior in binutils-2.16.1 for sh4 target and --enable-shared
2005-08-25 5:13 ` Kaz Kojima
@ 2005-08-25 5:46 ` Alan Modra
2005-08-25 5:59 ` Kaz Kojima
2005-08-25 22:08 ` Mike Frysinger
1 sibling, 1 reply; 5+ messages in thread
From: Alan Modra @ 2005-08-25 5:46 UTC (permalink / raw)
To: Kaz Kojima; +Cc: binutils
On Thu, Aug 25, 2005 at 02:13:29PM +0900, Kaz Kojima wrote:
> + int i = ARRAY_SIZE (sh_ef_bfd_table) - 1;
>
> for (; i>0; i--)
> if (sh_ef_bfd_table[i] == mach)
Do you want to check sh_ef_bfd_table[0]?
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gas misbehavior in binutils-2.16.1 for sh4 target and --enable-shared
2005-08-25 5:46 ` Alan Modra
@ 2005-08-25 5:59 ` Kaz Kojima
0 siblings, 0 replies; 5+ messages in thread
From: Kaz Kojima @ 2005-08-25 5:59 UTC (permalink / raw)
To: amodra; +Cc: binutils
Alan Modra <amodra@bigpond.net.au> wrote:
>> + int i = ARRAY_SIZE (sh_ef_bfd_table) - 1;
>>
>> for (; i>0; i--)
>> if (sh_ef_bfd_table[i] == mach)
>
> Do you want to check sh_ef_bfd_table[0]?
Ah, I also thought so. sh_ef_bfd_table[0] is set to EF_SH_UNKNOWN
which is 0 for backwards compatibility. So I think that this is
intentional.
Regards,
kaz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gas misbehavior in binutils-2.16.1 for sh4 target and --enable-shared
2005-08-25 5:13 ` Kaz Kojima
2005-08-25 5:46 ` Alan Modra
@ 2005-08-25 22:08 ` Mike Frysinger
1 sibling, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2005-08-25 22:08 UTC (permalink / raw)
To: binutils
On Thursday 25 August 2005 01:13 am, Kaz Kojima wrote:
> Mike Frysinger <vapier@gentoo.org> wrote:
> > binutils-2.16.1 with --enabled-shared:
> > test.o: ELF 32-bit LSB relocatable, Hitachi SH, version 1 (SYSV), not
> > stripped Flags: 0x19, unknown ISA
>
> It's caused by an off-by-one error. Thanks for catching it.
> sh_elf_get_flags_from_mach looks up a value in a table starting with
> the wrong index. I've committed the attached patch.
yep, that certainly did the trick, thanks
-mike
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-08-25 22:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-24 23:52 gas misbehavior in binutils-2.16.1 for sh4 target and --enable-shared Mike Frysinger
2005-08-25 5:13 ` Kaz Kojima
2005-08-25 5:46 ` Alan Modra
2005-08-25 5:59 ` Kaz Kojima
2005-08-25 22:08 ` Mike Frysinger
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).