25430897 Solaris needs a newer DWARF
authorNorm Jacobs <Norm.Jacobs@Oracle.COM>
Fri, 31 Mar 2017 10:33:39 -0700
changeset 7822 7d852afd19da
parent 7821 314e0c8ed692
child 7823 6a1d28f6325f
25430897 Solaris needs a newer DWARF
components/dwarf/Makefile
components/dwarf/libdwarf.license
components/dwarf/libdwarf.p5m
components/dwarf/patches/000-solaris-relocs.patch
components/dwarf/patches/001-libelf.patch
components/dwarf/patches/002-memleak.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/dwarf/Makefile	Fri Mar 31 10:33:39 2017 -0700
@@ -0,0 +1,60 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+#
+COMPILER=gcc
+BUILD_BITS= 64_and_32
+include ../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		dwarf
+COMPONENT_VERSION=	20161124
+# Convert YYYYMMDD -> YYYY.MM.DD
+IPS_COMPONENT_VERSION=	$(shell echo $(COMPONENT_VERSION) | \
+				$(GSED) -e 's/\(.\{4\}\)\(.\{2\}\)/0.\1.\2./')
+COMPONENT_PROJECT_URL=	https://www.prevanders.net/dwarf.html
+COMPONENT_ARCHIVE=	lib$(COMPONENT_NAME)-$(COMPONENT_VERSION).tar.gz
+COMPONENT_ARCHIVE_URL=	https://www.prevanders.net/$(COMPONENT_ARCHIVE)
+COMPONENT_ARCHIVE_HASH=	\
+    sha256:bd3d6dc7da0509876fb95b8681f165febd898845dc66714aa58e69b8feca988f
+COMPONENT_BUGDB=	library/libdwarf
+COMPONENT_ANITYA_ID=	1587
+
+TPNO=			33513
+
+COMPONENT_PREP_ACTION = (cd $(@D); $(AUTORECONF) -if)
+
+# the community doesn't have an install target yet
+INSTALL_TARGET=	build
+
+TEST_TARGET= $(NO_TESTS)
+
+include $(WS_MAKE_RULES)/common.mk
+
+COMPONENT_INSTALL_ENV += PATH="$(GNUBIN):$(USRBIN):$(GCC_ROOT)/bin"
+
+CONFIGURE_OPTIONS +=	--enable-shared
+CONFIGURE_OPTIONS +=	--disable-nonshared
+
+REQUIRED_PACKAGES += library/zlib
+REQUIRED_PACKAGES += system/library
+REQUIRED_PACKAGES += system/linker
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/dwarf/libdwarf.license	Fri Mar 31 10:33:39 2017 -0700
@@ -0,0 +1,172 @@
+The Dwarf software distribution includes the libdwarf library, as well as dwarfdump, 
+utilities, and example code.  The libdwarf library includes LGPL and BSD-style
+license text so that applications can make use of the library without being
+relicensed.
+
+---------------------------------------------------------------------------------------
+libdwarf library: LGPL and BSD-style licenses
+---------------------------------------------------------------------------------------
+
+  Copyright (c) 1987, 1993, 1994
+  The Regents of the University of California.  All rights reserved.
+  
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+  3. Neither the name of the University nor the names of its contributors
+     may be used to endorse or promote products derived from this software
+     without specific prior written permission.
+  *
+  THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  SUCH DAMAGE.
+
+------------------
+  
+  Copyright (c) 2013-2014, David Anderson
+  All rights reserved.
+  
+  Redistribution and use in source and binary forms, with
+  or without modification, are permitted provided that the
+  following conditions are met:
+  
+      Redistributions of source code must retain the above
+      copyright notice, this list of conditions and the following
+      disclaimer.
+  
+      Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials
+      provided with the distribution.
+  
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  
+------------------
+  
+  Copyright 1993-2006 Silicon Graphics, Inc.
+  Copyright 2007-2015 David Anderson.
+  
+  Permission is hereby granted to
+  copy or republish or use any or all of this document without
+  restriction except that when publishing more than a small amount
+  of the document
+  please acknowledge Silicon Graphics, Inc and David Anderson.
+  
+  This document is distributed in the hope that it would be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  
+---------------------------------------------------------------------------------------
+dwarfdump, utilities and example programs: GPL and BSD-style licenses
+---------------------------------------------------------------------------------------
+
+  Copyright (c) 1987, 1993, 1994
+  The Regents of the University of California.  All rights reserved.
+  
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+  3. Neither the name of the University nor the names of its contributors
+     may be used to endorse or promote products derived from this software
+     without specific prior written permission.
+  
+  THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  SUCH DAMAGE.
+
+------------------
+  
+  Copyright (c) 2013-2016, David Anderson
+  All rights reserved.
+  
+  Redistribution and use in source and binary forms, with
+  or without modification, are permitted provided that the
+  following conditions are met:
+  
+      Redistributions of source code must retain the above
+      copyright notice, this list of conditions and the following
+      disclaimer.
+  
+      Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials
+      provided with the distribution.
+  
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  
+------------------
+
+  Copyright (c) 2009-2015 David Anderson.
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+  * Neither the name of the example nor the
+    names of its contributors may be used to endorse or promote products
+    derived from this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY David Anderson ''AS IS'' AND ANY
+  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  DISCLAIMED. IN NO EVENT SHALL David Anderson BE LIABLE FOR ANY
+  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/dwarf/libdwarf.p5m	Fri Mar 31 10:33:39 2017 -0700
@@ -0,0 +1,45 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+#
+
+<transform file path=usr.*/man/.+ -> default mangler.man.stability volatile>
+set name=pkg.fmri \
+    value=pkg:/library/libdwarf@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary value="DWARF library and utilities"
+set name=com.oracle.info.description value="DWARF library and utilties"
+set name=com.oracle.info.tpno value=$(TPNO)
+set name=info.classification \
+    value=org.opensolaris.category.2008:System/Libraries
+set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
+set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
+set name=org.opensolaris.arc-caseid value=PSARC/2017/014
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+file $(MACH64)/dwarfdump/dwarfdump path=usr/bin/dwarfdump
+file libdwarf/dwarf.h path=usr/include/dwarf.h
+file $(MACH64)/libdwarf/libdwarf.h path=usr/include/libdwarf.h
+link path=usr/lib/$(MACH64)/libdwarf.so target=libdwarf.so.1
+file $(MACH64)/libdwarf/libdwarf.so.1 path=usr/lib/$(MACH64)/libdwarf.so.1
+link path=usr/lib/libdwarf.so target=libdwarf.so.1
+file $(MACH32)/libdwarf/libdwarf.so.1 path=usr/lib/libdwarf.so.1
+license libdwarf.license license=BSD
+license dwarfdump/GPL.txt license=GPLv2
+license libdwarf/LGPL.txt license=LGPLv2.1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/dwarf/patches/000-solaris-relocs.patch	Fri Mar 31 10:33:39 2017 -0700
@@ -0,0 +1,58 @@
+#
+# Submitted upstream on 2017-01-23, it will be incorporated in the
+# the next release.
+#
+diff --git a/libdwarf/config.h.in b/libdwarf/config.h.in
+index c593643..980e3d4 100644
+--- a/libdwarf/config.h.in
++++ b/libdwarf/config.h.in
+@@ -79,6 +79,15 @@
+ /* Define 1 if libelf.h defines struct _Elf */
+ #undef HAVE_STRUCT_UNDERSCORE_ELF
+ 
++/* Define to 1 if you have the <sys/elf_386.h> header file. */
++#undef HAVE_SYS_ELF_386_H
++
++/* Define to 1 if you have the <sys/elf_amd64.h> header file. */
++#undef HAVE_SYS_ELF_AMD64_H
++
++/* Define to 1 if you have the <sys/elf_SPARC.h> header file. */
++#undef HAVE_SYS_ELF_SPARC_H
++
+ /* Define to 1 if you have the <sys/ia64/elf.h> header file. */
+ #undef HAVE_SYS_IA64_ELF_H
+ 
+diff --git a/libdwarf/configure.in b/libdwarf/configure.in
+index 46ab313..7671896 100644
+--- a/libdwarf/configure.in
++++ b/libdwarf/configure.in
+@@ -12,7 +12,7 @@ AC_CHECK_TOOL(AR, ar)
+ 
+ dnl AC_ARFLAGS
+ 
+-AC_CHECK_HEADERS(alloca.h elf.h unistd.h elfaccess.h libelf.h libelf/libelf.h  sys/types.h sys/ia64/elf.h)
++AC_CHECK_HEADERS(alloca.h elf.h unistd.h elfaccess.h libelf.h libelf/libelf.h sys/types.h sys/elf_386.h sys/elf_amd64.h sys/elf_SPARC.h sys/ia64/elf.h)
+ 
+ dnl The default libdwarf is the one with struct Elf
+ echo Assuming struct Elf for the default libdwarf.h
+diff --git a/libdwarf/dwarf_elf_access.c b/libdwarf/dwarf_elf_access.c
+index 5ebece9..a132a50 100644
+--- a/libdwarf/dwarf_elf_access.c
++++ b/libdwarf/dwarf_elf_access.c
+@@ -43,6 +43,16 @@
+ 
+ #ifdef HAVE_ELF_H
+ #include <elf.h>
++/* Relocations are in sys/elf_{mach}.h on Solaris.  */
++#ifdef HAVE_SYS_ELF_AMD64_H
++#include <sys/elf_amd64.h>
++#endif
++#ifdef HAVE_SYS_ELF_386_H
++#include <sys/elf_386.h>
++#endif
++#ifdef HAVE_SYS_ELF_SPARC_H
++#include <sys/elf_SPARC.h>
++#endif
+ #endif
+ #ifdef HAVE_LIBELF_H
+ #include <libelf.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/dwarf/patches/001-libelf.patch	Fri Mar 31 10:33:39 2017 -0700
@@ -0,0 +1,16 @@
+#
+# Add guards for Elf type if libelf is already included.
+# working with upstreadm to resolve this.
+#
+--- a/libdwarf/libdwarf.h.in
++++ b/libdwarf/libdwarf.h.in
+@@ -60,7 +60,9 @@ extern "C" {
+ 
+ */
+ 
++#ifndef _LIBELF_H
+ typedef struct Elf Elf;
++#endif
+ typedef struct Elf* dwarf_elf_handle;
+ 
+ /* To enable printing with printf regardless of the
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/dwarf/patches/002-memleak.patch	Fri Mar 31 10:33:39 2017 -0700
@@ -0,0 +1,15 @@
+#
+# Submitted upstream 2017-01-23, will be fixed in the next release.
+#
+diff --git a/dwarfdump/dwarf_tsearchbal.c b/dwarfdump/dwarf_tsearchbal.c
+index 06628f8..08d8ff3 100644
+--- a/dwarfdump/dwarf_tsearchbal.c
++++ b/dwarfdump/dwarf_tsearchbal.c
+@@ -522,6 +522,7 @@ dwarf_tsearch(const void *key, void **headin,
+         }
+         root = allocate_ts_entry(key);
+         if(!root) {
++            free(head);
+             return NULL;
+         }
+         head->rlink = root;