Binutils with MCST patches
Go to file
Pedro Alves aacca8a7a9 Fix HP/PA GNU/Linux "long double" format
This:

 $ ./gdb -ex "set architecture hppa1.0" -ex "set osabi GNU/Linux" -ex "ptype 1.0L"

Shows that HPPA/Linux support for long doubles is broken.  It causes
GDB to access memory out of bounds.  With Valgrind, we see:

 The target architecture is assumed to be hppa1.0
 ==4371== Invalid write of size 8
 ==4371==    at 0x4C2F21F: memset (vg_replace_strmem.c:1224)
 ==4371==    by 0x8451C4: convert_doublest_to_floatformat (doublest.c:362)
 ==4371==    by 0x845F86: floatformat_from_doublest (doublest.c:769)
 ==4371==    by 0x84628E: store_typed_floating (doublest.c:873)
 ==4371==    by 0x6A7C3D: value_from_double (value.c:3662)
 ==4371==    by 0x6AA211: evaluate_subexp_standard (eval.c:745)
 ==4371==    by 0x7F306D: evaluate_subexp_c (c-lang.c:716)
 ==4371==    by 0x6A8C6A: evaluate_subexp (eval.c:79)
 ==4371==    by 0x6A8E87: evaluate_type (eval.c:174)
 ==4371==    by 0x817B8D: whatis_exp (typeprint.c:456)
 ==4371==    by 0x817D68: ptype_command (typeprint.c:508)
 ==4371==    by 0x5F2977: do_cfunc (cli-decode.c:105)
 ==4371==  Address 0x8998d18 is 0 bytes after a block of size 8 alloc'd
 ==4371==    at 0x4C2AA98: calloc (vg_replace_malloc.c:711)
 ==4371==    by 0x8732B6: xcalloc (common-utils.c:83)
 ==4371==    by 0x8732F5: xzalloc (common-utils.c:93)
 ==4371==    by 0x6A37AF: allocate_value_contents (value.c:1036)
 ==4371==    by 0x6A37E5: allocate_value (value.c:1047)
 ==4371==    by 0x6A7BEE: value_from_double (value.c:3656)
 ==4371==    by 0x6AA211: evaluate_subexp_standard (eval.c:745)
 ==4371==    by 0x7F306D: evaluate_subexp_c (c-lang.c:716)
 ==4371==    by 0x6A8C6A: evaluate_subexp (eval.c:79)
 ==4371==    by 0x6A8E87: evaluate_type (eval.c:174)
 ==4371==    by 0x817B8D: whatis_exp (typeprint.c:456)
 ==4371==    by 0x817D68: ptype_command (typeprint.c:508)

The trouble is that hppa_linux_init_abi overrides the default
long_double_bit set by the generic hppa-tdep.c:

  set_gdbarch_long_double_bit (gdbarch, 128);
  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);

with:

  /* On hppa-linux, currently, sizeof(long double) == 8.  There has been
     some discussions to support 128-bit long double, but it requires some
     more work in gcc and glibc first.  */
  set_gdbarch_long_double_bit (gdbarch, 64);

which misses overriding the long_double_format, so we end with a weird
combination of:

  set_gdbarch_long_double_bit (gdbarch, 64);
  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);

Weird because floatformats_ia64_quad's totalsize is longer than 64-bits.

The floatformat conversion routines use the struct floatformat's
totalsize (in bits) to know how much to copy/convert, thus the buffer
overruns.

gdb/ChangeLog:
2016-03-09  Pedro Alves  <palves@redhat.com>

	* hppa-linux-tdep.c (hppa_linux_init_abi): Set the long double
	format to floatformats_ieee_double.
2016-03-09 01:50:02 +00:00
bfd Automatic date update in version.in 2016-03-09 00:00:09 +00:00
binutils Allow zero length archive elements. 2016-03-07 17:29:25 +00:00
config Sync top level files with gcc. 2016-02-10 10:54:29 +00:00
cpu Correct fr30 comment 2016-03-03 12:55:30 +10:30
elfcpp Remove typename from Mips64_rela_data 2016-01-12 12:08:06 -08:00
etc
gas [ARC] Allow non-instruction relocations within .text sections 2016-03-08 14:19:52 +01:00
gdb Fix HP/PA GNU/Linux "long double" format 2016-03-09 01:50:02 +00:00
gold Refactor Output_data_reloc_base::do_write for MIPS-specific relocs. 2016-03-08 15:06:59 -08:00
gprof Regen configure 2016-01-17 12:28:14 +10:30
include [ARC] Allow non-instruction relocations within .text sections 2016-03-08 14:19:52 +01:00
intl Regen intl/configure 2015-08-31 12:53:36 +09:30
ld Handle local IFUNC symbols in shared object 2016-03-08 09:42:16 -08:00
libdecnumber Remove leading/trailing white spaces in ChangeLog 2015-07-24 04:16:47 -07:00
libiberty Sync libiberty with GCC. 2016-01-28 21:44:42 +01:00
opcodes Add const qualifiers at various places. 2016-03-07 15:16:28 +00:00
readline Revert "Sync readline/ to version 7.0 alpha" 2015-07-25 15:57:00 -04:00
sim Fix bugs in the simulation of the AArch64's ADDP, FADDP, LD1, CCMP and CCMP instructions. 2016-03-03 15:22:53 +00:00
texinfo
zlib Import zlib 1.2.8 with local change merged in. 2015-11-25 15:14:47 -08:00
.cvsignore
.gitattributes
.gitignore Import changes made to files shared with the FSF GCC project. 2016-01-11 11:06:56 +00:00
COPYING
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
COPYING3
COPYING3.LIB
ChangeLog Sync top level files with gcc. 2016-02-10 10:54:29 +00:00
MAINTAINERS
Makefile.def Sync top-level Makefile.def with GCC 2016-01-12 08:34:40 -08:00
Makefile.in Sync top level files with gcc. 2016-02-10 10:54:29 +00:00
Makefile.tpl Sync top level files with gcc. 2016-02-10 10:54:29 +00:00
README
README-maintainer-mode
compile
config-ml.in Sync toplevel files with GCC 2015-07-27 07:49:05 -07:00
config.guess Import changes made to files shared with the FSF GCC project. 2016-01-11 11:06:56 +00:00
config.rpath
config.sub Import changes made to files shared with the FSF GCC project. 2016-01-11 11:06:56 +00:00
configure Sync top level files with gcc. 2016-02-10 10:54:29 +00:00
configure.ac Sync top level files with gcc. 2016-02-10 10:54:29 +00:00
depcomp
djunpack.bat
install-sh
libtool.m4 Sync top-level btool.m4 with GCC 2016-01-12 08:44:52 -08:00
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
setup.com
src-release.sh fix gdb version parsing in src-release.sh 2016-01-17 10:01:55 +04:00
symlink-tree
ylwrap

README

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.