mirror of
https://xff.cz/git/u-boot/
synced 2025-10-27 08:33:10 +01:00
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
3b142045e8
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>
This commit is contained in:
committed by
Tom Rini
parent
1047af5c65
commit
54ee416050
@@ -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 */
|
* b) we need a API call to get the respective section symbols */
|
||||||
#if defined(__MACH__)
|
#if defined(__MACH__)
|
||||||
#include <mach-o/getsect.h>
|
#include <mach-o/getsect.h>
|
||||||
|
#include <mach-o/dyld.h>
|
||||||
|
|
||||||
#define INIT_SECTION(name) do { \
|
#define INIT_SECTION(name) do { \
|
||||||
unsigned long name ## _len; \
|
unsigned long name ## _len; \
|
||||||
char *__cat(pstart_, name) = getsectdata("__DATA", \
|
char *__cat(pstart_, name) = getsectdata("__DATA", \
|
||||||
#name, &__cat(name, _len)); \
|
#name, &__cat(name, _len)); \
|
||||||
|
__cat(pstart_, name) += _dyld_get_image_vmaddr_slide(0);\
|
||||||
char *__cat(pstop_, name) = __cat(pstart_, name) + \
|
char *__cat(pstop_, name) = __cat(pstart_, name) + \
|
||||||
__cat(name, _len); \
|
__cat(name, _len); \
|
||||||
__cat(__start_, name) = (void *)__cat(pstart_, name); \
|
__cat(__start_, name) = (void *)__cat(pstart_, name); \
|
||||||
|
|||||||
Reference in New Issue
Block a user