public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] Support building on macOS/arm64
@ 2021-03-20 20:43 Jessica Clarke
  2021-03-22 20:35 ` Tom Rini
  2021-03-29  0:29 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Jessica Clarke @ 2021-03-20 20:43 UTC (permalink / raw)
  To: u-boot

On Arm-based Macs, -no_pie is ignored and gives a linker warning.
Moreover, the build falls over with:

  ld: Absolute addressing not allowed in arm64 code but used in '_image_type_ptr_aisimage' referencing '_image_type_aisimage'

for dumpimage and mkimage, since we put data structs in text sections
not data sections and so cannot have dynamic relocations. Instead, move
the sections to __DATA and drop disabling PIE.

Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
---
 Makefile          | 5 -----
 tools/imagetool.h | 4 ++--
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 3ebb38b113..df3354d9f8 100644
--- a/Makefile
+++ b/Makefile
@@ -324,11 +324,6 @@ HOSTCC       = $(call os_x_before, 10, 5, "cc", "gcc")
 KBUILD_HOSTCFLAGS  += $(call os_x_before, 10, 4, "-traditional-cpp")
 KBUILD_HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
 
-# since Lion (10.7) ASLR is on by default, but we use linker generated lists
-# in some host tools which is a problem then ... so disable ASLR for these
-# tools
-KBUILD_HOSTLDFLAGS += $(call os_x_before, 10, 7, "", "-Xlinker -no_pie")
-
 # macOS Mojave (10.14.X) 
 # Undefined symbols for architecture x86_64: "_PyArg_ParseTuple"
 KBUILD_HOSTLDFLAGS += $(call os_x_after, 10, 14, "-lpython -dynamclib", "")
diff --git a/tools/imagetool.h b/tools/imagetool.h
index 8726792c8c..2801ea9e9f 100644
--- a/tools/imagetool.h
+++ b/tools/imagetool.h
@@ -273,14 +273,14 @@ int rockchip_copy_image(int fd, struct image_tool_params *mparams);
 
 #define INIT_SECTION(name)  do {					\
 		unsigned long name ## _len;				\
-		char *__cat(pstart_, name) = getsectdata("__TEXT",	\
+		char *__cat(pstart_, name) = getsectdata("__DATA",	\
 			#name, &__cat(name, _len));			\
 		char *__cat(pstop_, name) = __cat(pstart_, name) +	\
 			__cat(name, _len);				\
 		__cat(__start_, name) = (void *)__cat(pstart_, name);	\
 		__cat(__stop_, name) = (void *)__cat(pstop_, name);	\
 	} while (0)
-#define SECTION(name)   __attribute__((section("__TEXT, " #name)))
+#define SECTION(name)   __attribute__((section("__DATA, " #name)))
 
 struct image_type_params **__start_image_type, **__stop_image_type;
 #else
-- 
2.31.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] Support building on macOS/arm64
  2021-03-20 20:43 [PATCH] Support building on macOS/arm64 Jessica Clarke
@ 2021-03-22 20:35 ` Tom Rini
  2021-03-29  0:29 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2021-03-22 20:35 UTC (permalink / raw)
  To: u-boot

On Sat, Mar 20, 2021 at 08:43:05PM +0000, Jessica Clarke wrote:

> On Arm-based Macs, -no_pie is ignored and gives a linker warning.
> Moreover, the build falls over with:
> 
>   ld: Absolute addressing not allowed in arm64 code but used in '_image_type_ptr_aisimage' referencing '_image_type_aisimage'
> 
> for dumpimage and mkimage, since we put data structs in text sections
> not data sections and so cannot have dynamic relocations. Instead, move
> the sections to __DATA and drop disabling PIE.
> 
> Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>

Looking at this, and throwing CI at it to make sure everything is fine
elsewhere, this looks good and I'll pick it up for this release.

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210322/7d58e177/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Support building on macOS/arm64
  2021-03-20 20:43 [PATCH] Support building on macOS/arm64 Jessica Clarke
  2021-03-22 20:35 ` Tom Rini
@ 2021-03-29  0:29 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2021-03-29  0:29 UTC (permalink / raw)
  To: u-boot

On Sat, Mar 20, 2021 at 08:43:05PM +0000, Jessica Clarke wrote:

> On Arm-based Macs, -no_pie is ignored and gives a linker warning.
> Moreover, the build falls over with:
> 
>   ld: Absolute addressing not allowed in arm64 code but used in '_image_type_ptr_aisimage' referencing '_image_type_aisimage'
> 
> for dumpimage and mkimage, since we put data structs in text sections
> not data sections and so cannot have dynamic relocations. Instead, move
> the sections to __DATA and drop disabling PIE.
> 
> Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210328/d13215a9/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-29  0:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-20 20:43 [PATCH] Support building on macOS/arm64 Jessica Clarke
2021-03-22 20:35 ` Tom Rini
2021-03-29  0:29 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox