[Bug gas/10241] New: incorrect parsing of floating point literals

2009-06-04 Thread mshinwell at janestcapital dot com
gas fails to parse floating point literals correctly when the first character 
of the literal is '0' and the 
second character is a letter of the alphabet.  For example, 0e-4 parses as -4, 
and even 0e0e-4 is 
accepted (and parses to zero).  The issue is clearly most serious in the 0e-4 
case.

I think this is a host/build/target-triplet independent problem.  The offending 
code is in 
gas/read.c:s_float_space:

  /* Skip any 0{letter} that may be present.  Don't even check if the
   * letter is legal.  */
  if (input_line_pointer[0] == '0'
  && ISALPHA (input_line_pointer[1]))
input_line_pointer += 2;

It seems unclear what the purpose of this code is.

Test case, test.s (zeros interspersed to make the output easier):

.data
.double 0e0e-4
.double 0
.double 0e-4
.double 0
.double -4.0
.double 0

$ ./install/bin/x86_64-pc-linux-gnu-as -o test.o test.s && 
./install/bin/x86_64-pc-linux-gnu-
objdump -Dr test.o

-- 
   Summary: incorrect parsing of floating point literals
   Product: binutils
   Version: 2.19
Status: NEW
  Severity: normal
  Priority: P2
 Component: gas
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: mshinwell at janestcapital dot com
CC: bug-binutils at gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=10241

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/10223] libbfd returns messed up data (symbol->section == 0x109 or other strange values)

2009-06-04 Thread amodra at bigpond dot net dot au


-- 
   What|Removed |Added

   Severity|critical|normal


http://sourceware.org/bugzilla/show_bug.cgi?id=10223

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


Re: strings: invalid integer argument trings

2009-06-04 Thread Alan Modra
On Tue, Jun 02, 2009 at 08:05:52AM +0800, jida...@jidanni.org wrote:
> If deprecated, then please do it properly:
> 
> $ strings --help|grep ''
>   -   least [number] characters (default 4).
> $ strings -11
> strings: invalid integer argument trings
> 
> Hahaha! "trings".
> 
> $ strings --version
> GNU strings (GNU Binutils for Debian) 2.19.51.20090508

optind is incremented after an option arg is fully processed.  In the
case of '-11', the first '1' (which is seen as an option due to
decimal digits being part of the getopt_long option string) hits the
default label of the switch before optind has been incremented.

* strings.c (main): Delay parsing of decimal digits.

Index: binutils/strings.c
===
RCS file: /cvs/src/src/binutils/strings.c,v
retrieving revision 1.44
diff -u -p -r1.44 strings.c
--- binutils/strings.c  1 Apr 2009 14:57:11 -   1.44
+++ binutils/strings.c  4 Jun 2009 07:43:29 -
@@ -158,6 +158,7 @@ main (int argc, char **argv)
   int exit_status = 0;
   bfd_boolean files_given = FALSE;
   char *s;
+  int numeric_opt = 0;
 
 #if defined (HAVE_SETLOCALE)
   setlocale (LC_ALL, "");
@@ -247,13 +248,17 @@ main (int argc, char **argv)
  usage (stderr, 1);
 
default:
- string_min = (int) strtoul (argv[optind - 1] + 1, &s, 0);
- if (s != NULL && *s != 0)
-   fatal (_("invalid integer argument %s"), argv[optind - 1] + 1);
+ numeric_opt = optind;
  break;
}
 }
 
+  if (numeric_opt != 0)
+{
+  string_min = (int) strtoul (argv[numeric_opt - 1] + 1, &s, 0);
+  if (s != NULL && *s != 0)
+   fatal (_("invalid integer argument %s"), argv[numeric_opt - 1] + 1);
+}
   if (string_min < 1)
 fatal (_("invalid minimum string length %d"), string_min);
 

-- 
Alan Modra
Australia Development Lab, IBM




___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/10238] Gold linker does not resolve symbols using indirect dependencies

2009-06-04 Thread apratt at us dot ibm dot com

--- Additional Comments From apratt at us dot ibm dot com  2009-06-04 17:04 
---
I had understood that gold was to be a drop-in replacement for the system
linkers on the platforms it supports, accepting the same inputs and performing
valid (though much faster) links on them. I reported this issue because I came
across it "in the wild": a link line that works with the host linker but not
with gold, a classic case of incompatibility.

This isn't quite the same as replicating the load-time library search, because
once the program links it forgets which library satisfied the undefined symbols.
If the linker and the loader find different libraries, the semantics are still
satisfied as long as the libraries that are found export the symbols you use.

I didn't construct this test case out of whole cloth: I encountered this
incompatibility while testing IBM Rational PurifyPlus against the gold linker.
That is, I found this incompatibility using a real-world, shipping product that
produces linker command lines that work with the default linker.

Of course it's possible to work around this by changing PurifyPlus, but that's
not how I understood the goals of the "gold" project: I thought users who adopt
gold would not be expected to go back to other tool vendors and ask for changes
to support it. That's why I filed this bug: to call attention to this missing
feature/incompatibility with the default GNU linker.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10238

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/10238] Gold linker does not resolve symbols using indirect dependencies

2009-06-04 Thread ian at airs dot com

--- Additional Comments From ian at airs dot com  2009-06-04 16:17 ---
I haven't tried your test case yet, but in general this is intended behaviour
for gold.  The GNU linker goes to considerable effort to replicate the search
path used by the dynamic linker.  This leads to issues of the program linker and
the dynamic linker getting out of synch and finding different libraries.  I
don't think that doing this searching in the program linker is necessary, and I
chose not to implement it in gold.  So, given that the difference is
intentional, can you explain whether this is an important feature that gold
should implement, and why?  Without a good reason, my inclination is to close
this bug report as WONTFIX.  Thanks.

-- 
   What|Removed |Added

 Status|NEW |ASSIGNED


http://sourceware.org/bugzilla/show_bug.cgi?id=10238

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/10223] libbfd returns messed up data (symbol->section == 0x109 or other strange values)

2009-06-04 Thread ich at az2000 dot de

--- Additional Comments From ich at az2000 dot de  2009-06-04 17:23 ---
Thanks a lot, that was the problem. It seems that I had left an old bfd.h in
/usr/local/includes and all system build scripts (Gentoo Portage) used that one
instead of the one in /usr/include. Removing the file from /usr/local/include,
recompiling binutils and oprofile solved the problem.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10223

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


Re: strings: invalid integer argument trings

2009-06-04 Thread Alan Modra
On Tue, Jun 02, 2009 at 08:05:52AM +0800, jida...@jidanni.org wrote:
> If deprecated, then please do it properly:
> 
> $ strings --help|grep ''
>   -   least [number] characters (default 4).
> $ strings -11
> strings: invalid integer argument trings
> 
> Hahaha! "trings".
> 
> $ strings --version
> GNU strings (GNU Binutils for Debian) 2.19.51.20090508

optind is incremented after an option arg is fully processed.  In the
case of '-11', the first '1' (which is seen as an option due to
decimal digits being part of the getopt_long option string) hits the
default label of the switch before optind has been incremented.

* strings.c (main): Delay parsing of decimal digits.

Index: binutils/strings.c
===
RCS file: /cvs/src/src/binutils/strings.c,v
retrieving revision 1.44
diff -u -p -r1.44 strings.c
--- binutils/strings.c  1 Apr 2009 14:57:11 -   1.44
+++ binutils/strings.c  4 Jun 2009 07:43:29 -
@@ -158,6 +158,7 @@ main (int argc, char **argv)
   int exit_status = 0;
   bfd_boolean files_given = FALSE;
   char *s;
+  int numeric_opt = 0;
 
 #if defined (HAVE_SETLOCALE)
   setlocale (LC_ALL, "");
@@ -247,13 +248,17 @@ main (int argc, char **argv)
  usage (stderr, 1);
 
default:
- string_min = (int) strtoul (argv[optind - 1] + 1, &s, 0);
- if (s != NULL && *s != 0)
-   fatal (_("invalid integer argument %s"), argv[optind - 1] + 1);
+ numeric_opt = optind;
  break;
}
 }
 
+  if (numeric_opt != 0)
+{
+  string_min = (int) strtoul (argv[numeric_opt - 1] + 1, &s, 0);
+  if (s != NULL && *s != 0)
+   fatal (_("invalid integer argument %s"), argv[numeric_opt - 1] + 1);
+}
   if (string_min < 1)
 fatal (_("invalid minimum string length %d"), string_min);
 

-- 
Alan Modra
Australia Development Lab, IBM


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/10223] libbfd returns messed up data (symbol->section == 0x109 or other strange values)

2009-06-04 Thread amodra at bigpond dot net dot au

--- Additional Comments From amodra at bigpond dot net dot au  2009-06-04 
09:31 ---
Most likely you have built oprofile using bfd headers that don't match the
libbfd you are linking against.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10223

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/10238] Gold linker does not resolve symbols using indirect dependencies

2009-06-04 Thread ian at airs dot com

--- Additional Comments From ian at airs dot com  2009-06-05 05:05 ---
I should say: thanks for the bug report.  I appreciate it.

gold is not intended to be a precise replacement for the GNU linker.  The GNU
linker has too much history and is the result of too many odd decisions (many
made by myself).  gold is intended to be be a 98% replacement, but there are a
number of known incompatibilities.  This is one of them.

That said, if there is a good reason that gold should implement this feature,
I'm willing to consider it.  But precise compatibility with the GNU linker is
not yet enough of a reason to convince me.

It's not correct that it doesn't matter which library the linker finds at link
time.  If the library has version information in it, then there can be trouble
if the dynamic linker finds a different library.  Also, if the symbol being
resolved is a data symbol, the size of the symbol will be copied into the
executable.  If a COPY reloc is created, and the size of the symbol does not
match the size of the symbol in the library found by the dynamic linker, the
program will fail at runtime.  These are uncommon issues, but real enough that
it's fairly important in practice that both linkers use the same search path.

Your script did not work for me until I added -Wl,-rpath,. to the GNU linker
command line.  I'm not sure why you didn't need that.

Do you happen to know why PurifyPlus uses this feature of the GNU linker?  It's
not a feature of other ELF linkers.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10238

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/10223] libbfd returns messed up data (symbol->section == 0x109 or other strange values)

2009-06-04 Thread amodra at bigpond dot net dot au

--- Additional Comments From amodra at bigpond dot net dot au  2009-06-05 
05:40 ---
.

-- 
   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID


http://sourceware.org/bugzilla/show_bug.cgi?id=10223

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/10241] incorrect parsing of floating point literals

2009-06-04 Thread amodra at bigpond dot net dot au

--- Additional Comments From amodra at bigpond dot net dot au  2009-06-05 
06:24 ---
Please read the gas info doc, node Flonums.  Your floating point literals are
invalid.

-- 
   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID


http://sourceware.org/bugzilla/show_bug.cgi?id=10241

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils