From: "Pali Rohár" <pali@kernel.org>
To: Simon Glass <sjg@chromium.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
Bin Meng <bmeng.cn@gmail.com>,
Andre Przywara <andre.przywara@arm.com>,
Andrew Scull <ascull@google.com>,
Fabio Estevam <festevam@denx.de>,
Hai Pham <hai.pham.ud@renesas.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
Sean Anderson <seanga2@gmail.com>
Subject: Re: [PATCH 24/31] build: Disable weak symbols for MSYS2
Date: Tue, 25 Apr 2023 18:21:08 +0200 [thread overview]
Message-ID: <20230425162108.ulsjkpcvxvqbj44v@pali> (raw)
In-Reply-To: <20230424230836.630907-25-sjg@chromium.org>
On Monday 24 April 2023 17:08:29 Simon Glass wrote:
> Weak symbols are not well supported by the PE format, so disable them.
They are supported by PE format. This is likely issue of (older)
toolchain. What about rather requiring better toolchain version and
fix special cases of weak functions do not work correctly?
> We need to manually ensure that only one function is present in the source
> code.
>
> Add a Kconfig option to control this and enable it when building for
> Windows.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Kconfig | 15 +++++++++++++++
> include/linux/compiler_attributes.h | 4 ++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/Kconfig b/Kconfig
> index f24e4f0a331e..ca1402d09d10 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -72,6 +72,21 @@ config CLANG_VERSION
> int
> default $(shell,$(srctree)/scripts/clang-version.sh $(CC))
>
> +config CC_IS_MSYS
> + def_bool $(success,uname -o | grep -q Msys)
> +
> +config WEAK_SYMBOLS
> + bool "Enable use of weak symbols"
> + default y if !CC_IS_MSYS
> + help
> + The Portable Executable (PE) format used by Windows does not support
> + weak symbols very well. Even where it can be made to work, the __weak
> + function attribute cannot be made to work with PE. Supporting weak
> + symbols would involve changing the source code in undesirable ways.
> +
> + This option controls whether weak symbols are used, or not. When
> + disabled, the __weak function attribute does nothing.
> +
> choice
> prompt "Optimization level"
> default CC_OPTIMIZE_FOR_SIZE
> diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h
> index 44c9a08d7346..c954109a065b 100644
> --- a/include/linux/compiler_attributes.h
> +++ b/include/linux/compiler_attributes.h
> @@ -268,6 +268,10 @@
> * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-weak-function-attribute
> * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-weak-variable-attribute
> */
> +#ifdef CONFIG_WEAK_SYMBOLS
> #define __weak __attribute__((__weak__))
> +#else
> +#define __weak
> +#endif
>
> #endif /* __LINUX_COMPILER_ATTRIBUTES_H */
> --
> 2.40.0.634.g4ca3ef3211-goog
>
next prev parent reply other threads:[~2023-04-25 16:21 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-24 23:08 [PATCH 00/31] Allow building sandbox with MSYS2 Simon Glass
2023-04-24 23:08 ` [PATCH 01/31] patman: Declare the future Series memory Simon Glass
2023-04-24 23:08 ` [PATCH 02/31] u_boot_pylib: Correct name of readme Simon Glass
2023-04-24 23:08 ` [PATCH 03/31] u_boot_pylib: Make pty optional Simon Glass
2023-04-25 15:57 ` Tom Rini
2023-04-24 23:08 ` [PATCH 04/31] binman: Avoid using a symlink Simon Glass
2023-04-24 23:08 ` [PATCH 05/31] binman: Don't require a HOME directory Simon Glass
2023-04-24 23:08 ` [PATCH 06/31] pylibfdt: Allow building on Windows Simon Glass
2023-04-25 16:18 ` Pali Rohár
2023-04-24 23:08 ` [PATCH 07/31] Fix Makefile warning about parallel targets Simon Glass
2023-04-24 23:08 ` [PATCH 08/31] mkimage: Correct checking of configuration node Simon Glass
2023-04-24 23:08 ` [PATCH 09/31] Kbuild: Detect including an MSYS2 path Simon Glass
2023-04-24 23:08 ` [PATCH 10/31] sandbox: Provide a linker script for MSYS2 Simon Glass
2023-04-25 16:21 ` Pali Rohár
2023-04-25 18:01 ` Simon Glass
2023-04-25 18:11 ` Pali Rohár
2023-04-25 19:23 ` Simon Glass
2023-04-25 19:33 ` Pali Rohár
2023-04-26 0:50 ` Simon Glass
2023-04-26 7:13 ` Pali Rohár
2023-04-26 7:22 ` Pali Rohár
2023-04-24 23:08 ` [PATCH 11/31] sandbox: Provide an EFI link script for PE Simon Glass
2023-04-24 23:08 ` [PATCH 12/31] sandbox: Drop dead code from Makefile Simon Glass
2023-04-24 23:08 ` [PATCH 13/31] sandbox: Disable raw Ethernet on MSYS2 Simon Glass
2023-04-24 23:08 ` [PATCH 14/31] sandbox: Drop signal handling for MSYS2 Simon Glass
2023-04-25 1:57 ` Heinrich Schuchardt
2023-04-24 23:08 ` [PATCH 15/31] sandbox: Correct SDL.h header inclusion Simon Glass
2023-04-24 23:08 ` [PATCH 16/31] sandbox: Include errno.h in the test header Simon Glass
2023-04-24 23:08 ` [PATCH 17/31] sandbox: Allow weak symbols to be dropped Simon Glass
2023-04-25 2:33 ` Heinrich Schuchardt
2023-04-29 18:41 ` Simon Glass
2023-04-25 2:44 ` Bin Meng
2023-04-25 16:31 ` Pali Rohár
2023-04-29 18:41 ` Simon Glass
2023-04-30 9:43 ` Pali Rohár
2023-04-29 18:41 ` Simon Glass
2023-04-30 15:10 ` Bin Meng
2023-04-24 23:08 ` [PATCH 18/31] sections: Drop use of linux/types.h Simon Glass
2023-04-24 23:08 ` [PATCH 19/31] sandbox: Drop incorrect inclusion " Simon Glass
2023-04-24 23:08 ` [PATCH 20/31] sandbox: Drop inclusion of os.h in sscanf.c Simon Glass
2023-04-24 23:08 ` [PATCH 21/31] test: Avoid strange symbols in the assembler file Simon Glass
2023-04-25 2:29 ` Heinrich Schuchardt
2023-04-24 23:08 ` [PATCH 22/31] sandbox: Fix up setting of monitor_len on MSYS2 Simon Glass
2023-04-24 23:08 ` [PATCH 23/31] ctype: Avoid using a symlink Simon Glass
2023-04-24 23:08 ` [PATCH 24/31] build: Disable weak symbols for MSYS2 Simon Glass
2023-04-25 16:21 ` Pali Rohár [this message]
2023-04-29 18:41 ` Simon Glass
2023-04-24 23:08 ` [PATCH 25/31] Makefile: Disable unsupported compiler options with PE Simon Glass
2023-04-25 15:59 ` Tom Rini
2023-04-25 16:22 ` Pali Rohár
2023-04-24 23:08 ` [PATCH 26/31] Makefile: Correct the ans1_compiler rule for MSYS2 Simon Glass
2023-04-25 16:23 ` Pali Rohár
2023-04-24 23:08 ` [PATCH 27/31] Makefile: Disable LTO when building with MSYS2 Simon Glass
2023-04-25 16:27 ` Pali Rohár
2023-04-26 1:04 ` Simon Glass
2023-04-26 7:07 ` Pali Rohár
2023-04-27 16:25 ` Simon Glass
2023-04-27 16:48 ` Pali Rohár
2023-04-27 17:34 ` Tom Rini
2023-04-28 7:37 ` Marek Behún
2023-04-28 13:03 ` Tom Rini
2023-04-24 23:08 ` [PATCH 28/31] doc: Update the MSYS2 packages and versions Simon Glass
2023-04-24 23:08 ` [PATCH 29/31] doc: Show how to build sandbox for MSYS2 Simon Glass
2023-04-25 2:20 ` Heinrich Schuchardt
2023-04-25 2:54 ` Heinrich Schuchardt
2023-04-25 3:01 ` Bin Meng
2023-04-25 3:12 ` Heinrich Schuchardt
2023-04-24 23:08 ` [PATCH 30/31] Makefile: Drop unwind tables Simon Glass
2023-04-24 23:08 ` [PATCH 31/31] CI: Enable sandbox build for Windows Simon Glass
2023-04-25 2:59 ` [PATCH 00/31] Allow building sandbox with MSYS2 Heinrich Schuchardt
2023-04-25 16:04 ` Tom Rini
2023-04-25 18:01 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230425162108.ulsjkpcvxvqbj44v@pali \
--to=pali@kernel.org \
--cc=andre.przywara@arm.com \
--cc=ascull@google.com \
--cc=bmeng.cn@gmail.com \
--cc=festevam@denx.de \
--cc=hai.pham.ud@renesas.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=seanga2@gmail.com \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox