Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151782096
D24746.id71492.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
13 KB
Referenced Files
None
Subscribers
None
D24746.id71492.diff
View Options
Index: devel/Makefile
===================================================================
--- devel/Makefile
+++ devel/Makefile
@@ -507,6 +507,7 @@
SUBDIR += duplo
SUBDIR += dwarf2json
SUBDIR += dwarfdump
+ SUBDIR += dwarves
SUBDIR += dxa65
SUBDIR += dyncall
SUBDIR += e00compr
Index: devel/dwarves/Makefile
===================================================================
--- /dev/null
+++ devel/dwarves/Makefile
@@ -0,0 +1,60 @@
+# Created by: Conrad Meyer <cem@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME= dwarves
+PORTVERSION= 1.17
+CATEGORIES= devel
+MASTER_SITES= https://fedorapeople.org/~acme/dwarves/
+
+MAINTAINER= cem@FreeBSD.org
+COMMENT= Debugging Information Manipulation Tools (pahole & friends)
+
+LICENSE= GPLv2 LGPL21 BSD2CLAUSE
+LICENSE_COMB= multi
+LICENSE_FILE_GPLv2= ${WRKSRC}/COPYING
+LICENSE_FILE_LGPL21= ${WRKSRC}/lib/bpf/LICENSE.LPGL-2.1
+LICENSE_FILE_BSD2CLAUSE= ${WRKSRC}/lib/bpf/LICENSE.BSD-2-Clause
+
+IGNORE_FreeBSD_11= true
+
+LIB_DEPENDS= libargp.so:devel/argp-standalone
+LIB_DEPENDS+= libdw.so:devel/elfutils
+BUILD_DEPENDS= gnulib>=0:devel/gnulib
+
+OPTIONS_DEFINE= MANPAGES
+OPTIONS_DEFAULT= MANPAGES
+OPTIONS_SUB= yes
+
+USES= cmake gettext python:3.7+,env shebangfix tar:xz
+USE_GCC= 9+
+USE_LDCONFIG= yes
+
+SHEBANG_FILES= btfdiff fullcircle ostra/python/ostra.py ostra/ostra-cg
+
+CFLAGS+= -I${WRKSRC}
+
+pre-configure:
+ ${SED} -i '' -e 's,#include <malloc.h>,#include <stdlib.h>,' ${WRKSRC}/*.c
+ ${CP} -a \
+ ${LOCALBASE}/share/gnulib/lib/obstack.c \
+ ${LOCALBASE}/share/gnulib/lib/obstack.h \
+ ${WRKSRC}
+ ${SED} -i '' -e 's,_GL_ATTRIBUTE_PURE,__attribute__((pure)),g' \
+ ${WRKSRC}/obstack.c ${WRKSRC}/obstack.h
+ ${MKDIR} ${WRKSRC}/asm
+ ${MKDIR} ${WRKSRC}/bits
+ ${MKDIR} ${WRKSRC}/linux
+ ${LN} -s ${WRKSRC}/freebsd_compat.h ${WRKSRC}/asm/bitsperlong.h
+ ${LN} -s ${WRKSRC}/freebsd_compat.h ${WRKSRC}/asm/errno.h
+ ${LN} -s ${WRKSRC}/freebsd_compat.h ${WRKSRC}/asm/posix_types.h
+ ${LN} -s ${WRKSRC}/freebsd_compat.h ${WRKSRC}/asm/types.h
+ ${LN} -s ${WRKSRC}/freebsd_compat.h ${WRKSRC}/asm/unistd.h
+ ${LN} -s ${WRKSRC}/freebsd_compat.h ${WRKSRC}/bits/reg.h
+ ${LN} -s ${WRKSRC}/freebsd_compat.h ${WRKSRC}/endian.h
+ ${LN} -s ${WRKSRC}/freebsd_compat.h ${WRKSRC}/exitfail.h
+ ${LN} -s ${WRKSRC}/freebsd_compat.h ${WRKSRC}/gettext.h
+ ${LN} -s ${WRKSRC}/freebsd_compat.h ${WRKSRC}/linux/limits.h
+ ${LN} -s ${WRKSRC}/freebsd_compat.h ${WRKSRC}/linux/types.h
+ ${LN} -s ${WRKSRC}/freebsd_compat.h ${WRKSRC}/vasnprintf.h
+
+.include <bsd.port.mk>
Index: devel/dwarves/distinfo
===================================================================
--- /dev/null
+++ devel/dwarves/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1584128313
+SHA256 (dwarves-1.17.tar.xz) = f196b0604c16a3812031ed2cd4c14d27fef889186b514a16db2d2f52717aef70
+SIZE (dwarves-1.17.tar.xz) = 309028
Index: devel/dwarves/files/patch-CMakeLists.txt
===================================================================
--- /dev/null
+++ devel/dwarves/files/patch-CMakeLists.txt
@@ -0,0 +1,48 @@
+--- CMakeLists.txt.orig 2020-03-13 17:13:35 UTC
++++ CMakeLists.txt
+@@ -7,7 +7,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMA
+ # Try to parse this later, Helio just showed me a KDE4 example to support
+ # x86-64 builds.
+ # the following are directories where stuff will be installed to
+-set(__LIB "" CACHE STRING "Define suffix of directory name (32/64)" )
++set(__LIB "lib" CACHE STRING "Define suffix of directory name (32/64)" )
+
+ macro(_set_fancy _var _value _comment)
+ if (NOT DEFINED ${_var})
+@@ -76,7 +76,7 @@ endif()
+
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64")
+
+-file(GLOB libbpf_sources "lib/bpf/src/*.c")
++set(libbpf_sources lib/bpf/src/btf.c lib/bpf/src/hashmap.c lib/bpf/src/libbpf.c)
+ add_library(bpf OBJECT ${libbpf_sources})
+ set_property(TARGET bpf PROPERTY POSITION_INDEPENDENT_CODE 1)
+ target_include_directories(bpf PRIVATE
+@@ -85,13 +85,13 @@ target_include_directories(bpf PRIVATE
+
+ set(dwarves_LIB_SRCS dwarves.c dwarves_fprintf.c gobuffer strings
+ ctf_encoder.c ctf_loader.c libctf.c btf_encoder.c btf_loader.c libbtf.c
+- dwarf_loader.c dutil.c elf_symtab.c rbtree.c)
++ dwarf_loader.c dutil.c elf_symtab.c rbtree.c obstack.c)
+ add_library(dwarves SHARED ${dwarves_LIB_SRCS} $<TARGET_OBJECTS:bpf>)
+ set_target_properties(dwarves PROPERTIES VERSION 1.0.0 SOVERSION 1)
+ set_target_properties(dwarves PROPERTIES INTERFACE_LINK_LIBRARIES "")
+ target_include_directories(dwarves PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include/uapi)
+-target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES})
++target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES} libargp.so libintl.so)
+
+ set(dwarves_emit_LIB_SRCS dwarves_emit.c)
+ add_library(dwarves_emit SHARED ${dwarves_emit_LIB_SRCS})
+@@ -153,9 +153,10 @@ install(FILES dwarves.h dwarves_emit.h dwarves_reorgan
+ btf_encoder.h config.h ctf_encoder.h ctf.h
+ elfcreator.h elf_symtab.h hash.h libbtf.h libctf.h
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/dwarves/)
+-install(FILES man-pages/pahole.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1/)
++install(FILES man-pages/pahole.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1/)
+ install(PROGRAMS ostra/ostra-cg DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+ install(PROGRAMS btfdiff fullcircle DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
++install(FILES changes-v1.17 README README.btf DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/dwarves)
+ install(FILES ostra/python/ostra.py DESTINATION ${CMAKE_INSTALL_PREFIX}/share/dwarves/runtime/python)
+ install(FILES lib/Makefile lib/ctracer_relay.c lib/ctracer_relay.h lib/linux.blacklist.cu
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/dwarves/runtime)
Index: devel/dwarves/files/patch-dtagnames.c
===================================================================
--- /dev/null
+++ devel/dwarves/files/patch-dtagnames.c
@@ -0,0 +1,35 @@
+--- dtagnames.c.orig 2019-05-01 15:06:45 UTC
++++ dtagnames.c
+@@ -7,16 +7,31 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
+-#include <malloc.h>
++#ifdef __FreeBSD__
++#include <err.h>
++#include <malloc_np.h>
++#else
++#endif
+
+ #include "dwarves.h"
+ #include "dutil.h"
+
+ static void print_malloc_stats(void)
+ {
++#ifdef __FreeBSD__
++ int error;
++ size_t allocated, sz;
++
++ sz = sizeof(allocated);
++ error = mallctl("stats.active", &allocated, &sz, NULL, 0);
++ if (error != 0)
++ errc(1, error, "mallctl(stats.active)");
++ fprintf(stderr, "size: %zu\n", allocated);
++#else
+ struct mallinfo m = mallinfo();
+
+ fprintf(stderr, "size: %u\n", m.uordblks);
++#endif
+ }
+
+ static int class__tag_name(struct tag *tag, struct cu *cu __unused,
Index: devel/dwarves/files/patch-dwarves__fprintf.c
===================================================================
--- /dev/null
+++ devel/dwarves/files/patch-dwarves__fprintf.c
@@ -0,0 +1,25 @@
+--- dwarves_fprintf.c.orig 2020-05-06 22:11:18 UTC
++++ dwarves_fprintf.c
+@@ -7,6 +7,8 @@
+ Copyright (C) 2007..2009 Arnaldo Carvalho de Melo <acme@redhat.com>
+ */
+
++#include <sys/param.h>
++
+ #include <dwarf.h>
+ #include <errno.h>
+ #include <stdio.h>
+@@ -1910,12 +1912,7 @@ void cus__print_error_msg(const char *progname, const
+ void dwarves__fprintf_init(uint16_t user_cacheline_size)
+ {
+ if (user_cacheline_size == 0) {
+- long sys_cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
+-
+- if (sys_cacheline_size > 0)
+- cacheline_size = sys_cacheline_size;
+- else
+- cacheline_size = 64; /* Fall back to a sane value */
++ cacheline_size = CACHE_LINE_SIZE;
+ } else
+ cacheline_size = user_cacheline_size;
+ }
Index: devel/dwarves/files/patch-freebsd__compat.h
===================================================================
--- /dev/null
+++ devel/dwarves/files/patch-freebsd__compat.h
@@ -0,0 +1,52 @@
+--- freebsd_compat.h.orig 2020-05-06 23:35:19 UTC
++++ freebsd_compat.h
+@@ -0,0 +1,49 @@
++#pragma once
++
++#include <sys/cdefs.h>
++#include <sys/stat.h>
++#include <errno.h>
++#include <limits.h>
++#include <stdint.h>
++#include <stdlib.h>
++
++#include <libintl.h>
++
++/* asm/bitsperlong.h */
++#if defined(__ILP32__)
++#define __BITS_PER_LONG 32
++#elif defined(__LP64__)
++#define __BITS_PER_LONG 64
++#else
++#error "I'm a teapot"
++#endif
++
++/* asm/types.h */
++typedef uint8_t __u8;
++typedef uint16_t __u16;
++typedef uint32_t __u32;
++typedef uint64_t __u64;
++typedef int8_t __s8;
++typedef int16_t __s16;
++typedef int32_t __s32;
++typedef int64_t __s64;
++
++/* linux/types.h */
++typedef uint16_t __be16;
++typedef uint32_t __be32;
++typedef uint64_t __be64;
++typedef uint16_t __le16;
++typedef uint32_t __le32;
++typedef uint64_t __le64;
++#define __aligned_u64 __u64 __attribute__((aligned(8)))
++
++/* "exitfail.h" */
++#define exit_failure EXIT_FAILURE
++
++/* search.h */
++static inline void
++tdestroy(void *vroot __unused, void (*freefct)(void *) __unused)
++{
++
++ /* XXX: Just leak the memory for now. */
++}
Index: devel/dwarves/files/patch-lib_bpf_src_btf.c
===================================================================
--- /dev/null
+++ devel/dwarves/files/patch-lib_bpf_src_btf.c
@@ -0,0 +1,47 @@
+--- lib/bpf/src/btf.c.orig 2020-03-12 19:57:29 UTC
++++ lib/bpf/src/btf.c
+@@ -436,6 +436,7 @@ done:
+ return btf;
+ }
+
++#ifndef __FreeBSD__
+ static bool btf_check_endianness(const GElf_Ehdr *ehdr)
+ {
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+@@ -684,6 +685,7 @@ done:
+ free(log_buf);
+ return err;
+ }
++#endif /* !FreeBSD */
+
+ int btf__fd(const struct btf *btf)
+ {
+@@ -704,6 +706,7 @@ const char *btf__name_by_offset(const struct btf *btf,
+ return NULL;
+ }
+
++#ifndef __FreeBSD__
+ int btf__get_from_id(__u32 id, struct btf **btf)
+ {
+ struct bpf_btf_info btf_info = { 0 };
+@@ -767,6 +770,7 @@ exit_free:
+
+ return err;
+ }
++#endif /* !FreeBSD */
+
+ int btf__get_map_kv_tids(const struct btf *btf, const char *map_name,
+ __u32 expected_key_size, __u32 expected_value_size,
+@@ -2936,6 +2940,7 @@ static int btf_dedup_remap_types(struct btf_dedup *d)
+ return 0;
+ }
+
++#ifndef __FreeBSD__
+ static struct btf *btf_load_raw(const char *path)
+ {
+ struct btf *btf;
+@@ -3021,3 +3026,4 @@ struct btf *libbpf_find_kernel_btf(void)
+ pr_warn("failed to find valid kernel BTF\n");
+ return ERR_PTR(-ESRCH);
+ }
++#endif /* !FreeBSD */
Index: devel/dwarves/files/patch-lib_bpf_src_libbpf.c
===================================================================
--- /dev/null
+++ devel/dwarves/files/patch-lib_bpf_src_libbpf.c
@@ -0,0 +1,63 @@
+--- lib/bpf/src/libbpf.c.orig 2020-03-12 19:57:29 UTC
++++ lib/bpf/src/libbpf.c
+@@ -29,18 +29,12 @@
+ #include <linux/kernel.h>
+ #include <linux/bpf.h>
+ #include <linux/btf.h>
+-#include <linux/filter.h>
+ #include <linux/list.h>
+ #include <linux/limits.h>
+-#include <linux/perf_event.h>
+-#include <linux/ring_buffer.h>
+-#include <linux/version.h>
+-#include <sys/epoll.h>
+ #include <sys/ioctl.h>
+ #include <sys/mman.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+-#include <sys/vfs.h>
+ #include <sys/utsname.h>
+ #include <sys/resource.h>
+ #include <tools/libc_compat.h>
+@@ -73,11 +67,13 @@
+
+ #define __printf(a, b) __attribute__((format(printf, a, b)))
+
++#ifndef __FreeBSD__
+ static struct bpf_map *bpf_object__add_map(struct bpf_object *obj);
+ static struct bpf_program *bpf_object__find_prog_by_idx(struct bpf_object *obj,
+ int idx);
+ static const struct btf_type *
+ skip_mods_and_typedefs(const struct btf *btf, __u32 id, __u32 *res_id);
++#endif /* !__FreeBSD__ */
+
+ static int __base_pr(enum libbpf_print_level level, const char *format,
+ va_list args)
+@@ -111,6 +107,7 @@ void libbpf_print(enum libbpf_print_level level, const
+ va_end(args);
+ }
+
++#ifndef __FreeBSD__
+ static void pr_perm_msg(int err)
+ {
+ struct rlimit limit;
+@@ -597,13 +594,7 @@ bpf_object__init_prog_names(struct bpf_object *obj)
+
+ static __u32 get_kernel_version(void)
+ {
+- __u32 major, minor, patch;
+- struct utsname info;
+-
+- uname(&info);
+- if (sscanf(info.release, "%u.%u.%u", &major, &minor, &patch) != 3)
+- return 0;
+- return KERNEL_VERSION(major, minor, patch);
++ return 0x50000;
+ }
+
+ static const struct btf_member *
+@@ -8396,3 +8387,4 @@ void bpf_object__destroy_skeleton(struct bpf_object_sk
+ free(s->progs);
+ free(s);
+ }
++#endif /* !__FreeBSD__ */
Index: devel/dwarves/pkg-descr
===================================================================
--- /dev/null
+++ devel/dwarves/pkg-descr
@@ -0,0 +1,5 @@
+Pahole and the dwarves is a collection of libraries and tools for manipulating
+DWARF debuginfo in ELF binaries, as well as BTF and CTF compressed type
+metadata for tracing (i.e., Dtrace, eBPF).
+
+WWW: http://acmel.wordpress.com
Index: devel/dwarves/pkg-plist
===================================================================
--- /dev/null
+++ devel/dwarves/pkg-plist
@@ -0,0 +1,48 @@
+bin/btfdiff
+bin/codiff
+bin/ctracer
+bin/dtagnames
+bin/fullcircle
+bin/pahole
+bin/pdwtags
+bin/pfunct
+bin/pglobal
+bin/prefcnt
+bin/scncopy
+bin/syscse
+bin/ostra-cg
+include/dwarves/btf_encoder.h
+include/dwarves/config.h
+include/dwarves/ctf_encoder.h
+include/dwarves/ctf.h
+include/dwarves/dutil.h
+include/dwarves/dwarves.h
+include/dwarves/dwarves_emit.h
+include/dwarves/dwarves_reorganize.h
+include/dwarves/elfcreator.h
+include/dwarves/elf_symtab.h
+include/dwarves/gobuffer.h
+include/dwarves/hash.h
+include/dwarves/libbtf.h
+include/dwarves/libctf.h
+include/dwarves/list.h
+include/dwarves/rbtree.h
+include/dwarves/strings.h
+lib/libdwarves.so
+lib/libdwarves.so.1
+lib/libdwarves.so.1.0.0
+lib/libdwarves_emit.so
+lib/libdwarves_emit.so.1
+lib/libdwarves_emit.so.1.0.0
+lib/libdwarves_reorganize.so
+lib/libdwarves_reorganize.so.1
+lib/libdwarves_reorganize.so.1.0.0
+%%DATADIR%%/runtime/Makefile
+%%DATADIR%%/runtime/linux.blacklist.cu
+%%DATADIR%%/runtime/ctracer_relay.c
+%%DATADIR%%/runtime/ctracer_relay.h
+%%DATADIR%%/runtime/python/ostra.py
+%%DOCSDIR%%/changes-v1.17
+%%DOCSDIR%%/README
+%%DOCSDIR%%/README.btf
+%%MANPAGES%%man/man1/pahole.1.gz
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 11, 3:36 PM (2 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31238107
Default Alt Text
D24746.id71492.diff (13 KB)
Attached To
Mode
D24746: devel/dwarves: Add new port
Attached
Detach File
Event Timeline
Log In to Comment