void-packages/srcpkgs/heaptrack/patches/musl-fixes.patch
Đoàn Trần Công Danh 200bed5c06 srcpkgs/h*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

68 lines
1.5 KiB
Diff

# reason: fix sources to work correctly with musl
--- a/src/track/heaptrack_inject.cpp
+++ b/src/track/heaptrack_inject.cpp
@@ -27,6 +27,7 @@
#include <link.h>
#include <malloc.h>
#include <unistd.h>
+#include <dlfcn.h>
#include <sys/mman.h>
--- a/src/track/libheaptrack.cpp
+++ b/src/track/libheaptrack.cpp
@@ -72,7 +72,7 @@
return chrono::duration_cast<chrono::milliseconds>(clock::now() - startTime());
}
-__pid_t gettid()
+pid_t gettid()
{
return syscall(SYS_gettid);
}
--- a/src/track/heaptrack_inject.cpp
+++ b/src/track/heaptrack_inject.cpp
@@ -38,9 +38,10 @@
* @brief Experimental support for symbol overloading after runtime injection.
*/
-#if __WORDSIZE == 64
+#include <limits.h>
+#if ULONG_MAX == 0xffffffffffffffff
#define ELF_R_SYM(i) ELF64_R_SYM(i)
-#elif __WORDSIZE == 32
+#elif ULONG_MAX == 0xffffffff
#define ELF_R_SYM(i) ELF32_R_SYM(i)
#else
#error unsupported word size
# simplify stdint.h include which failed on musl due to obscure assumptions
--- a/3rdparty/libbacktrace/backtrace.h
+++ b/3rdparty/libbacktrace/backtrace.h
@@ -36,24 +36,8 @@
#include <stddef.h>
#include <stdio.h>
-/* We want to get a definition for uintptr_t, but we still care about
- systems that don't have <stdint.h>. */
-#if defined(__GLIBC__) && __GLIBC__ >= 2
-
-#include <stdint.h>
-
-#elif defined(HAVE_STDINT_H)
-
#include <stdint.h>
-#else
-
-/* Systems that don't have <stdint.h> must provide gstdint.h, e.g.,
- from GCC_HEADER_STDINT in configure.ac. */
-#include "gstdint.h"
-
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif