From 3c5938e7d4064541eab1d5e02de61237e05a1699 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 23 Nov 2016 18:35:58 -0500 Subject: dumpelf: add support for dumping notes --- paxinc.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'paxinc.h') diff --git a/paxinc.h b/paxinc.h index 82f7d1f..6d433b9 100644 --- a/paxinc.h +++ b/paxinc.h @@ -102,6 +102,12 @@ const char *strfileperms(const char *fname); } else { errf("ESET failed :( (size(Y) == %i)", (int)sizeof(Y)); } \ } while (0) +/* alignment helpers */ +#define ALIGN_DOWN(base, size) ((base) & -((__typeof__(base)) (size))) +#define ALIGN_UP(base, size) ALIGN_DOWN((base) + (size) - 1, (size)) +#define PTR_ALIGN_DOWN(base, size) ((__typeof__(base))ALIGN_DOWN((uintptr_t)(base), (size))) +#define PTR_ALIGN_UP(base, size) ((__typeof__(base))ALIGN_UP ((uintptr_t)(base), (size))) + /* helper functions for showing errors */ extern const char *NORM, *RED, *YELLOW; void color_init(bool disable); -- cgit v1.2.3-65-gdbad