* [PATCH 1/2] smartweb: Enable LTO
@ 2023-03-28 18:54 Tom Rini
2023-03-28 18:54 ` [PATCH 2/2] linker_lists: Rework start/end macros to not rely on undefined behavior Tom Rini
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Tom Rini @ 2023-03-28 18:54 UTC (permalink / raw)
To: u-boot; +Cc: Heiko Schocher
In order to prepare for slight size growth due to reworking linker list
support, enable LTO here to save more space again.
Signed-off-by: Tom Rini <trini@konsulko.com>
---
Cc: Heiko Schocher <hs@denx.de>
---
configs/smartweb_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/configs/smartweb_defconfig b/configs/smartweb_defconfig
index 4cbdab0b37d8..836e0c002dee 100644
--- a/configs/smartweb_defconfig
+++ b/configs/smartweb_defconfig
@@ -24,6 +24,7 @@ CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
CONFIG_SPL=y
CONFIG_ENV_OFFSET_REDUND=0x180000
CONFIG_SYS_LOAD_ADDR=0x22000000
+CONFIG_LTO=y
CONFIG_FIT=y
CONFIG_NAND_BOOT=y
CONFIG_BOOTDELAY=3
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] linker_lists: Rework start/end macros to not rely on undefined behavior
2023-03-28 18:54 [PATCH 1/2] smartweb: Enable LTO Tom Rini
@ 2023-03-28 18:54 ` Tom Rini
2023-03-29 20:02 ` Simon Glass
` (2 more replies)
2023-03-29 4:41 ` [PATCH 1/2] smartweb: Enable LTO Heiko Schocher
2023-04-04 18:47 ` Tom Rini
2 siblings, 3 replies; 7+ messages in thread
From: Tom Rini @ 2023-03-28 18:54 UTC (permalink / raw)
To: u-boot; +Cc: AdityaK, Andrew Pinski
Per the GCC bug listed below, the way we do linker lists is relying on
undefined behavior that seems to work in gcc, but doesn't always work in
clang. Andrew suggests rewriting our start/end macros in a different way
(as implemented here, from what he said in comment 1) to avoid these
problems.
Reported-by: AdityaK <appujee@google.com>
Suggested-by: Andrew Pinski <pinskia@gcc.gnu.org>
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108915
Signed-off-by: Tom Rini <trini@konsulko.com>
---
Andrew, please feel free to reply with any further tags you want here, I
wasn't exactly sure of the best way to attribute this to you. Thanks!
---
include/linker_lists.h | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/linker_lists.h b/include/linker_lists.h
index d3da9d44e853..f9a2ee0c762a 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -127,7 +127,9 @@
static char start[0] __aligned(CONFIG_LINKER_LIST_ALIGN) \
__attribute__((unused)) \
__section("__u_boot_list_2_"#_list"_1"); \
- (_type *)&start; \
+ _type * tmp = (_type *)&start; \
+ asm("":"+r"(tmp)); \
+ tmp; \
})
/**
@@ -153,7 +155,9 @@
({ \
static char end[0] __aligned(4) __attribute__((unused)) \
__section("__u_boot_list_2_"#_list"_3"); \
- (_type *)&end; \
+ _type * tmp = (_type *)&end; \
+ asm("":"+r"(tmp)); \
+ tmp; \
})
/**
* ll_entry_count() - Return the number of elements in linker-generated array
@@ -247,7 +251,9 @@
({ \
static char start[0] __aligned(4) __attribute__((unused)) \
__section("__u_boot_list_1"); \
- (_type *)&start; \
+ _type * tmp = (_type *)&start; \
+ asm("":"+r"(tmp)); \
+ tmp; \
})
/**
@@ -270,7 +276,9 @@
({ \
static char end[0] __aligned(4) __attribute__((unused)) \
__section("__u_boot_list_3"); \
- (_type *)&end; \
+ _type * tmp = (_type *)&end; \
+ asm("":"+r"(tmp)); \
+ tmp; \
})
#endif /* __ASSEMBLY__ */
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] smartweb: Enable LTO
2023-03-28 18:54 [PATCH 1/2] smartweb: Enable LTO Tom Rini
2023-03-28 18:54 ` [PATCH 2/2] linker_lists: Rework start/end macros to not rely on undefined behavior Tom Rini
@ 2023-03-29 4:41 ` Heiko Schocher
2023-04-04 18:47 ` Tom Rini
2 siblings, 0 replies; 7+ messages in thread
From: Heiko Schocher @ 2023-03-29 4:41 UTC (permalink / raw)
To: Tom Rini, u-boot
Hello Tom,
On 28.03.23 20:54, Tom Rini wrote:
> In order to prepare for slight size growth due to reworking linker list
> support, enable LTO here to save more space again.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> Cc: Heiko Schocher <hs@denx.de>
> ---
> configs/smartweb_defconfig | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Heiko Schocher <hs@denx.de>
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs@denx.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] linker_lists: Rework start/end macros to not rely on undefined behavior
2023-03-28 18:54 ` [PATCH 2/2] linker_lists: Rework start/end macros to not rely on undefined behavior Tom Rini
@ 2023-03-29 20:02 ` Simon Glass
2023-03-29 20:52 ` Andrew Pinski
2023-04-04 18:47 ` Tom Rini
2 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2023-03-29 20:02 UTC (permalink / raw)
To: Tom Rini; +Cc: u-boot, AdityaK, Andrew Pinski
On Wed, 29 Mar 2023 at 07:55, Tom Rini <trini@konsulko.com> wrote:
>
> Per the GCC bug listed below, the way we do linker lists is relying on
> undefined behavior that seems to work in gcc, but doesn't always work in
> clang. Andrew suggests rewriting our start/end macros in a different way
> (as implemented here, from what he said in comment 1) to avoid these
> problems.
>
> Reported-by: AdityaK <appujee@google.com>
> Suggested-by: Andrew Pinski <pinskia@gcc.gnu.org>
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108915
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> Andrew, please feel free to reply with any further tags you want here, I
> wasn't exactly sure of the best way to attribute this to you. Thanks!
> ---
> include/linker_lists.h | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] linker_lists: Rework start/end macros to not rely on undefined behavior
2023-03-28 18:54 ` [PATCH 2/2] linker_lists: Rework start/end macros to not rely on undefined behavior Tom Rini
2023-03-29 20:02 ` Simon Glass
@ 2023-03-29 20:52 ` Andrew Pinski
2023-04-04 18:47 ` Tom Rini
2 siblings, 0 replies; 7+ messages in thread
From: Andrew Pinski @ 2023-03-29 20:52 UTC (permalink / raw)
To: Tom Rini; +Cc: u-boot, AdityaK
On Tue, Mar 28, 2023 at 11:54 AM Tom Rini <trini@konsulko.com> wrote:
>
> Per the GCC bug listed below, the way we do linker lists is relying on
> undefined behavior that seems to work in gcc, but doesn't always work in
> clang. Andrew suggests rewriting our start/end macros in a different way
> (as implemented here, from what he said in comment 1) to avoid these
> problems.
>
> Reported-by: AdityaK <appujee@google.com>
> Suggested-by: Andrew Pinski <pinskia@gcc.gnu.org>
Suggested-by: Andrew Pinski <apinski@marvell.com>
Other than that it looks good.
Reviewed-by: Andrew Pinski <apinski@marvell.com>
Thanks,
Andrew Pinski
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108915
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> Andrew, please feel free to reply with any further tags you want here, I
> wasn't exactly sure of the best way to attribute this to you. Thanks!
> ---
> include/linker_lists.h | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/include/linker_lists.h b/include/linker_lists.h
> index d3da9d44e853..f9a2ee0c762a 100644
> --- a/include/linker_lists.h
> +++ b/include/linker_lists.h
> @@ -127,7 +127,9 @@
> static char start[0] __aligned(CONFIG_LINKER_LIST_ALIGN) \
> __attribute__((unused)) \
> __section("__u_boot_list_2_"#_list"_1"); \
> - (_type *)&start; \
> + _type * tmp = (_type *)&start; \
> + asm("":"+r"(tmp)); \
> + tmp; \
> })
>
> /**
> @@ -153,7 +155,9 @@
> ({ \
> static char end[0] __aligned(4) __attribute__((unused)) \
> __section("__u_boot_list_2_"#_list"_3"); \
> - (_type *)&end; \
> + _type * tmp = (_type *)&end; \
> + asm("":"+r"(tmp)); \
> + tmp; \
> })
> /**
> * ll_entry_count() - Return the number of elements in linker-generated array
> @@ -247,7 +251,9 @@
> ({ \
> static char start[0] __aligned(4) __attribute__((unused)) \
> __section("__u_boot_list_1"); \
> - (_type *)&start; \
> + _type * tmp = (_type *)&start; \
> + asm("":"+r"(tmp)); \
> + tmp; \
> })
>
> /**
> @@ -270,7 +276,9 @@
> ({ \
> static char end[0] __aligned(4) __attribute__((unused)) \
> __section("__u_boot_list_3"); \
> - (_type *)&end; \
> + _type * tmp = (_type *)&end; \
> + asm("":"+r"(tmp)); \
> + tmp; \
> })
>
> #endif /* __ASSEMBLY__ */
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] smartweb: Enable LTO
2023-03-28 18:54 [PATCH 1/2] smartweb: Enable LTO Tom Rini
2023-03-28 18:54 ` [PATCH 2/2] linker_lists: Rework start/end macros to not rely on undefined behavior Tom Rini
2023-03-29 4:41 ` [PATCH 1/2] smartweb: Enable LTO Heiko Schocher
@ 2023-04-04 18:47 ` Tom Rini
2 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2023-04-04 18:47 UTC (permalink / raw)
To: u-boot; +Cc: Heiko Schocher
[-- Attachment #1: Type: text/plain, Size: 335 bytes --]
On Tue, Mar 28, 2023 at 02:54:50PM -0400, Tom Rini wrote:
> In order to prepare for slight size growth due to reworking linker list
> support, enable LTO here to save more space again.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> Reviewed-by: Heiko Schocher <hs@denx.de>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] linker_lists: Rework start/end macros to not rely on undefined behavior
2023-03-28 18:54 ` [PATCH 2/2] linker_lists: Rework start/end macros to not rely on undefined behavior Tom Rini
2023-03-29 20:02 ` Simon Glass
2023-03-29 20:52 ` Andrew Pinski
@ 2023-04-04 18:47 ` Tom Rini
2 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2023-04-04 18:47 UTC (permalink / raw)
To: u-boot; +Cc: AdityaK, Andrew Pinski
[-- Attachment #1: Type: text/plain, Size: 731 bytes --]
On Tue, Mar 28, 2023 at 02:54:51PM -0400, Tom Rini wrote:
> Per the GCC bug listed below, the way we do linker lists is relying on
> undefined behavior that seems to work in gcc, but doesn't always work in
> clang. Andrew suggests rewriting our start/end macros in a different way
> (as implemented here, from what he said in comment 1) to avoid these
> problems.
>
> Reported-by: AdityaK <appujee@google.com>
> Suggested-by: Andrew Pinski <apinski@marvell.com>
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108915
> Signed-off-by: Tom Rini <trini@konsulko.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Andrew Pinski <apinski@marvell.com>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-04-04 18:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28 18:54 [PATCH 1/2] smartweb: Enable LTO Tom Rini
2023-03-28 18:54 ` [PATCH 2/2] linker_lists: Rework start/end macros to not rely on undefined behavior Tom Rini
2023-03-29 20:02 ` Simon Glass
2023-03-29 20:52 ` Andrew Pinski
2023-04-04 18:47 ` Tom Rini
2023-03-29 4:41 ` [PATCH 1/2] smartweb: Enable LTO Heiko Schocher
2023-04-04 18:47 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.