~jpsamaroo/pahole

86099e6aa8e497fcf3f37df329ce7c4f42c75706 — Julian P Samaroo 1 year, 3 months ago 4cfd420 master
Add musl build support
5 files changed, 26 insertions(+), 16 deletions(-)

M CMakeLists.txt
M dtagnames.c
M dutil.h
M dwarves_fprintf.c
M hash.h
M CMakeLists.txt => CMakeLists.txt +13 -13
@@ 91,57 91,57 @@ 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} /usr/lib/libargp.a /usr/lib/libobstack.so)

set(dwarves_emit_LIB_SRCS dwarves_emit.c)
add_library(dwarves_emit SHARED ${dwarves_emit_LIB_SRCS})
set_target_properties(dwarves_emit PROPERTIES VERSION 1.0.0 SOVERSION 1)
target_link_libraries(dwarves_emit dwarves)
target_link_libraries(dwarves_emit dwarves /usr/lib/libargp.a /usr/lib/libobstack.so)

set(dwarves_reorganize_LIB_SRCS dwarves_reorganize.c)
add_library(dwarves_reorganize SHARED ${dwarves_reorganize_LIB_SRCS})
set_target_properties(dwarves_reorganize PROPERTIES VERSION 1.0.0 SOVERSION 1)
target_link_libraries(dwarves_reorganize dwarves)
target_link_libraries(dwarves_reorganize dwarves /usr/lib/libargp.a /usr/lib/libobstack.so)

set(codiff_SRCS codiff.c)
add_executable(codiff ${codiff_SRCS})
target_link_libraries(codiff dwarves)
target_link_libraries(codiff dwarves /usr/lib/libargp.a /usr/lib/libobstack.so)

set(ctracer_SRCS ctracer.c)
add_executable(ctracer ${ctracer_SRCS})
target_link_libraries(ctracer dwarves dwarves_emit dwarves_reorganize ${ELF_LIBRARY})
target_link_libraries(ctracer dwarves dwarves_emit dwarves_reorganize ${ELF_LIBRARY} /usr/lib/libargp.a /usr/lib/libobstack.so)

set(dtagnames_SRCS dtagnames.c)
add_executable(dtagnames ${dtagnames_SRCS})
target_link_libraries(dtagnames dwarves)
target_link_libraries(dtagnames dwarves /usr/lib/libargp.a /usr/lib/libobstack.so)

set(pahole_SRCS pahole.c)
add_executable(pahole ${pahole_SRCS})
target_link_libraries(pahole dwarves dwarves_reorganize)
target_link_libraries(pahole dwarves dwarves_reorganize /usr/lib/libargp.a /usr/lib/libobstack.so)

set(pdwtags_SRCS pdwtags.c)
add_executable(pdwtags ${pdwtags_SRCS})
add_executable(pdwtags ${pdwtags_SRCS} /usr/lib/libargp.a /usr/lib/libobstack.so)
target_link_libraries(pdwtags dwarves)

set(pglobal_SRCS pglobal.c)
add_executable(pglobal ${pglobal_SRCS})
target_link_libraries(pglobal dwarves)
target_link_libraries(pglobal dwarves /usr/lib/libargp.a /usr/lib/libobstack.so)

set(pfunct_SRCS pfunct.c)
add_executable(pfunct ${pfunct_SRCS})
target_link_libraries(pfunct dwarves dwarves_emit ${ELF_LIBRARY})
target_link_libraries(pfunct dwarves dwarves_emit ${ELF_LIBRARY} /usr/lib/libargp.a /usr/lib/libobstack.so)

set(prefcnt_SRCS prefcnt.c)
add_executable(prefcnt ${prefcnt_SRCS})
target_link_libraries(prefcnt dwarves)
target_link_libraries(prefcnt dwarves /usr/lib/libargp.a /usr/lib/libobstack.so)

set(scncopy_SRCS scncopy.c elfcreator.c)
add_executable(scncopy ${scncopy_SRCS})
target_link_libraries(scncopy dwarves ${ELF_LIBRARY})
target_link_libraries(scncopy dwarves ${ELF_LIBRARY} /usr/lib/libargp.a /usr/lib/libobstack.so)

set(syscse_SRCS syscse.c)
add_executable(syscse ${syscse_SRCS})
target_link_libraries(syscse dwarves)
target_link_libraries(syscse dwarves /usr/lib/libargp.a /usr/lib/libobstack.so)

install(TARGETS codiff ctracer dtagnames pahole pdwtags
		pfunct pglobal prefcnt scncopy syscse RUNTIME DESTINATION

M dtagnames.c => dtagnames.c +2 -2
@@ 14,9 14,9 @@

static void print_malloc_stats(void)
{
	struct mallinfo m = mallinfo();
	//struct mallinfo m = mallinfo();

	fprintf(stderr, "size: %u\n", m.uordblks);
	fprintf(stderr, "size: %u\n", 0);
}

static int class__tag_name(struct tag *tag, struct cu *cu __unused,

M dutil.h => dutil.h +4 -0
@@ 15,8 15,12 @@
#include <elf.h>
#include <gelf.h>
#include <asm/bitsperlong.h>
#include <linux/stddef.h>
#include <linux/limits.h>
#include <limits.h>
#include "rbtree.h"
#include "list.h"
#include <obstack.h>

#define BITS_PER_LONG __BITS_PER_LONG


M dwarves_fprintf.c => dwarves_fprintf.c +4 -1
@@ 1910,8 1910,11 @@ void cus__print_error_msg(const char *progname, const struct cus *cus,
void dwarves__fprintf_init(uint16_t user_cacheline_size)
{
	if (user_cacheline_size == 0) {
#ifdef _SC_LEVEL1_DCACHE_LINESIZE
		long sys_cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);

#else
		long sys_cacheline_size = 64;
#endif
		if (sys_cacheline_size > 0)
			cacheline_size = sys_cacheline_size;
		else

M hash.h => hash.h +3 -0
@@ 21,6 21,9 @@
/*  2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */
#define GOLDEN_RATIO_PRIME_64 0x9e37fffffffc0001UL

#ifndef __WORDSIZE
#define __WORDSIZE 64
#endif
#if __WORDSIZE == 32
#define GOLDEN_RATIO_PRIME GOLDEN_RATIO_PRIME_32
#define hash_long(val, bits) hash_32(val, bits)