summaryrefslogtreecommitdiff
path: root/tools/imagetool.h
diff options
context:
space:
mode:
authorSergey V. Lobanov <sergey@lobanov.in>2022-01-25 02:29:44 +0300
committerTom Rini <trini@konsulko.com>2022-01-31 10:17:16 -0500
commit54ee416050f1d0b3c93d6ec1708f5925e57aa6bf (patch)
tree64cbf7e8d98c7bedce56aa0aa481797f917afd19 /tools/imagetool.h
parent1047af5c65b00b822fd72d1750f3141615f7002d (diff)
mkimage: fix segfault on MacOS arm64
mkimage segfaults due to the ASLR mechanism on MacOS arm64 It is required to use _dyld_get_image_vmaddr_slide() to prevent segfault on MacOS arm64 This patch is based on the discussion https://github.com/u-boot/u-boot/commit/3b142045e8a7f0ab17b6099e9226296af45967d0 Thanks to Jessica Clarke, Ronny Kotzschmar and ptpt52 github user Reviewed-by: Jessica Clarke <jrtc27@jrtc27.com> Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
Diffstat (limited to 'tools/imagetool.h')
-rw-r--r--tools/imagetool.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/imagetool.h b/tools/imagetool.h
index 413e97cbeb..a4105515d8 100644
--- a/tools/imagetool.h
+++ b/tools/imagetool.h
@@ -275,11 +275,13 @@ int rockchip_copy_image(int fd, struct image_tool_params *mparams);
* b) we need a API call to get the respective section symbols */
#if defined(__MACH__)
#include <mach-o/getsect.h>
+#include <mach-o/dyld.h>
#define INIT_SECTION(name) do { \
unsigned long name ## _len; \
char *__cat(pstart_, name) = getsectdata("__DATA", \
#name, &__cat(name, _len)); \
+ __cat(pstart_, name) += _dyld_get_image_vmaddr_slide(0);\
char *__cat(pstop_, name) = __cat(pstart_, name) + \
__cat(name, _len); \
__cat(__start_, name) = (void *)__cat(pstart_, name); \