[00/11] libctf: various portability fixes and small bugfixes

Message ID 20191216225357.87247-1-nick.alcock@oracle.com
Headers show
Series
  • libctf: various portability fixes and small bugfixes
Related show

Message

Nick Alcock Dec. 16, 2019, 10:53 p.m.
These deal with bug 25120 (a bunch of portability problems: elfcpp, used by
gold, contains the same problem so I fixed it there too), fix another bunch of
portability problems which appeared when binutils libctf hit the FreeBSD ports
tree, and fix a bunch of problems with forwards which emerged during the
development of the CTF-deduplicating linker and during ongoing testing of the
non-deduplicating linker.

It also finally gets --disable-libctf working (this bit is an older patch
that I simply never got around to pushing, and has been reviewed already:
it has a GDB portion which needed some changes and has been posted to
the GDB list already).

There's also one small feature addition: like objdump, readelf can now view .ctf
sections that contain CTF archives, and knows how the linker structures these
(with a .ctf member that is the parent of all the other members).  Since the
linker emits these whenever conflicting types with the same name are encountered
in a single program, without this capability there are lots of programs that
objdump --ctf can view but readelf --ctf=.ctf claims is a corrupted file.
This required a small API addition to libctf to open CTF archives from already-
read memory buffers while specifying string and symbol tables.

The libiberty and binutils bits outside the first patch in the series have not
appeared here before and need review.

Nick Alcock (11):
  binutils, ld: work with --disable-libctf
  libctf: create: non-root-visible types should not appear in name
    tables
  libctf: create: don't add forwards if the type added already exists
  libctf: create: ctf_add_type should hand back already-added non-SoUs
  libctf: create: forwards are always in the namespace of their referent
  libctf, binutils: support CTF archives like objdump
  libiberty, include, libctf: Use bsearch_r to avoid nonportable
    __thread
  libctf: work with compilers not supporting GNU C attributes
  libctf, elfcpp, gold: do not assume that <byteswap.h> contains bswap_*
  libctf: add some missing #includes.
  libctf: support platforms with separate libintl

 binutils/ChangeLog       |  35 ++++++++
 binutils/Makefile.am     |   5 ++
 binutils/Makefile.in     |   9 ++-
 binutils/aclocal.m4      |   1 +
 binutils/config.in       |   3 +
 binutils/configure       |  39 ++++++++-
 binutils/configure.ac    |   6 ++
 binutils/doc/Makefile.in |   1 +
 binutils/objdump.c       |  27 ++++++-
 binutils/readelf.c       | 118 +++++++++++++++++++--------
 elfcpp/ChangeLog         |  10 +++
 elfcpp/elfcpp_swap.h     |  16 ++--
 gold/ChangeLog           |   7 ++
 gold/config.in           |  12 +++
 gold/configure           | 127 ++++++++++++++++++-----------
 gold/configure.ac        |   3 +
 include/ChangeLog        |   9 +++
 include/ctf-api.h        |   4 +
 include/libiberty.h      |   7 ++
 ld/ChangeLog             |  30 +++++++
 ld/Makefile.am           |   4 +
 ld/Makefile.in           |   5 +-
 ld/aclocal.m4            |   1 +
 ld/config.in             |   3 +
 ld/configure             |  42 +++++++++-
 ld/configure.ac          |   9 +++
 ld/ldelfgen.c            |  14 ++++
 ld/ldlang.c              |  35 ++++++++
 libctf/ChangeLog         |  52 ++++++++++++
 libctf/Makefile.in       |  19 ++++-
 libctf/aclocal.m4        |   3 +-
 libctf/config.h.in       |  16 ++++
 libctf/configure         | 167 ++++++++++++++++++++++++++++++++++++++-
 libctf/configure.ac      |   4 +
 libctf/ctf-archive.c     |  93 ++++++++++++++++------
 libctf/ctf-create.c      |  49 ++++++++----
 libctf/ctf-impl.h        |  15 +++-
 libctf/ctf-open-bfd.c    |  69 ++--------------
 libctf/ctf-open.c        |  37 +++++++--
 libctf/libctf.ver        |   1 +
 libctf/swap.h            |  16 ++--
 libiberty/ChangeLog      |   8 ++
 libiberty/Makefile.in    |  12 ++-
 libiberty/bsearch_r.c    |  92 +++++++++++++++++++++
 44 files changed, 1016 insertions(+), 219 deletions(-)
 create mode 100644 libiberty/bsearch_r.c

-- 
2.24.1.242.gb57e918ca5

Comments

Alan Modra Dec. 19, 2019, 12:52 a.m. | #1
On Mon, Dec 16, 2019 at 10:53:46PM +0000, Nick Alcock wrote:
> The libiberty and binutils bits outside the first patch in the series have not

> appeared here before and need review.


The binutils part is fine.  libiberty patches should go to
gcc-patches@gcc.gnu.org as per libiberty/README.  You probably should
post just the libiberty part of the patch, making it clear in the
subject that it is a libiberty patch and cc the libiberty maintainer.
binutils/libiberty can be imported from the gcc repo later by anyone
with write access to the binutils repo.  If the gcc patch approval
process takes too long then you may apply the patch to binutils.

-- 
Alan Modra
Australia Development Lab, IBM
Nick Alcock Jan. 7, 2020, 5:04 p.m. | #2
On 19 Dec 2019, Alan Modra outgrape:

> On Mon, Dec 16, 2019 at 10:53:46PM +0000, Nick Alcock wrote:

>> The libiberty and binutils bits outside the first patch in the series have not

>> appeared here before and need review.

>

> The binutils part is fine.  libiberty patches should go to

> gcc-patches@gcc.gnu.org as per libiberty/README.


Oh, thank you, I never noticed this before. I'll split out the
libiberty/include portion and respin things as suggested there (make
maint-deps and make-stamp-functions, etc.)

> binutils/libiberty can be imported from the gcc repo later by anyone

> with write access to the binutils repo.  If the gcc patch approval

> process takes too long then you may apply the patch to binutils.


I guess this means I have to respin this bit against GCC trunk (and keep
the current patch as a necessary-for-testing-but-will-be-dropped
portion if the resulting patch is any different).