summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * | efi_loader: simplify show_efi_boot_order()Heinrich Schuchardt2021-05-251-14/+1
| | | | | | | | | | | | | | | | | | | | | To print a UTF-16 string use %ls instead of converting string to UTF-8. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
| * | efi_loader: simplify show_efi_boot_opt_data()Heinrich Schuchardt2021-05-251-12/+1
| | | | | | | | | | | | | | | | | | | | | To print a UTF-16 string use %ls instead of converting string to UTF-8. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
| * | efi_loader: path length in efi_dp_from_name()Heinrich Schuchardt2021-05-251-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch efi_dp_from_name() only accommodated a maximum file path length of 31 characters. This leads to boot failures due to file name truncation. Allow arbitrary path lengths. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * | efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabledMasahisa Kojima2021-05-255-68/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is preparation for PE/COFF measurement support. PE/COFF image hash calculation is same in both UEFI Secure Boot image verification and measurement in measured boot. PE/COFF image parsing functions are gathered into efi_image_loader.c, and exposed even if UEFI Secure Boot is not enabled. This commit also adds the EFI_SIGNATURE_SUPPORT option to decide if efi_signature.c shall be compiled. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * | efi_loader: remove weak efi_get_public_key_data()Heinrich Schuchardt2021-05-251-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Configuring a system with CONFIG_EFI_CAPSULE_AUTHENTICATE=y but without a method to retrieve the public key data is a misconfiguration. We should get a build failure for it. Therefore remove the weak efi_get_public_key_data() implementation. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * | doc: usage: modify mmc man-pageJaehoon Chung2021-05-251-1/+2
| |/ | | | | | | | | | | | | | | | | Modify mmc man-page. - Change a description about mmc erase command. - Add whitespace to distinguish. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* | Merge tag 'mips-pull-2021-05-25' of ↵Tom Rini2021-05-2517-709/+81
|\ \ | |/ |/| | | | | | | | | https://source.denx.de/u-boot/custodians/u-boot-mips - MIPS: octeon: fix CFI flash setup - MIPS: remove qemu_mips boards
| * doc: update and fix Qemu MIPS documentationDaniel Schwierzeck2021-05-251-195/+78
| | | | | | | | | | | | Update description to use the MIPS Malta board for Qemu. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
| * MIPS: remove deprecated qemu_mips boardDaniel Schwierzeck2021-05-2515-512/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove qemu_mips boards because DM migration doesn't make sense. The board support for qemu_mips is already marked as deprecated in Qemu in favour of the Malta board. Also qemu_mips support has been removed from Linux a long time ago. The official replacement is the Malta board. The same Malta U-Boot image can be used with Qemu and on physical hardware. All combinations of Big Endian and Little Endian as well as 32 bit and 64 bit are supported. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
| * mips: octeon: octeon_ebb7304_defconfig: Fix CFI flash setupStefan Roese2021-05-251-2/+3
|/ | | | | | | | | | This patch makes the necessary adjustments in the defconfig to fully support the CFI flash on the Octeon EBB7304. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Aaron Williams <awilliams@marvell.com> Cc: Chandrakala Chavva <cchavva@marvell.com> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
* Prepare v2021.07-rc3Tom Rini2021-05-241-1/+1
| | | | Signed-off-by: Tom Rini <trini@konsulko.com>
* Merge branch '2021-05-24-add-lto-support'Tom Rini2021-05-24110-187/+523
|\ | | | | | | | | | | | | | | | | - Add LTO (link time optimization) support to the build system and enable it on a few boards. This is an alternative to using -ffunction-sections/-fdata-sections and --gc-sections at link time to remove unused code. This can result in notable savings, but needs testing on each platform before use as it can expose problems by optimizing away various functionally necessary calls.
| * stackprot: Make our test a bit more complexTom Rini2021-05-241-0/+7
| | | | | | | | | | | | | | | | | | | | | | With better compiler optimizations available, a compiler may see we do nothing with our buffer after calling memset and omit the call, thus causing us to not smash the stack. Add a comment to explain why we now also have a printf call, so that the test will pass as the memset will not be omitted. Reported-by: Marek Behún <marek.behun@nic.cz> Signed-off-by: Tom Rini <trini@konsulko.com>
| * ARM: enable LTO for some boardsMarek Behún2021-05-2414-0/+14
| | | | | | | | | | | | | | | | | | | | Enable LTO for some boards that were tested by people on U-Boot Mailing List. Signed-off-by: Marek Behún <marek.behun@nic.cz> Tested-by: Adam Ford <aford173@gmail.com> Tested-by: Pali Rohár <pali@kernel.org> Tested-by: Tim Harvey <tharvey@gateworks.com>
| * ARM: don't use --gc-sections with LTO when using private libgccMarek Behún2021-05-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | When using LTO, we can throw away the --gc-sections flag, but only if using private libgcc. When using system's libgcc, --gc-sections is still needed, otherwise linking will fail due to undefined references to libc's symbols. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * ARM: don't use -ffunction-sections/-fdata-sections with LTO buildMarek Behún2021-05-241-2/+6
| | | | | | | | | | | | | | | | When building with LTO, using -ffunction-sections/-fdata-sections is not useful anymore. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * ARM: make LTO availableMarek Behún2021-05-242-0/+3
| | | | | | | | | | | | | | Make LTO available for ARM architecture. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * ata: ahci: fix ahci_link_up() type mismatch for LTOMarek Behún2021-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building highbank_defconfig with LTO, the compiler complains about type mismatch of function ahci_link_up(). The third parameter of this function is of type u8 in drivers/ata/ahci.c, but of type int in board/highbank/ahci.c. There is no reason in using u8, and the code using this function actually passes an int variable into the function (so it is implicitly converted to u8). Change the type of this parameter to int in drivers/ata/ahci.c. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * armv8: SPL: discard relocation informationMarek Behún2021-05-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | For some reason when building SPL for ARMv8 with LTO, the relocation information is not discarded. Discard it explicitly in the linker script. This fixes LTO build for imx8mm_venice_defconfig. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * ARM: omap3: fix LTO for DM3730 (and possibly other omap3 boards)Marek Behún2021-05-241-0/+1
| | | | | | | | | | | | | | Adam Ford says that DM3730 needs board.c compiled without LTO flags. Signed-off-by: Marek Behún <marek.behun@nic.cz> Tested-by: Adam Ford <aford173@gmail.com>
| * ARM: fix LTO for rockchip and samsungMarek Behún2021-05-242-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building with LTO, the compiler complains about type mismatch of function usb_gadget_handle_interrupts(). This function is defined without parameters in files arch/arm/mach-rockchip/board.c board/samsung/common/exynos5-dt.c but it should have one parameter, int index. Fix this. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
| * ARM: fix LTO for seaboardMarek Behún2021-05-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When seaboard_defconfig is compiled with LTO, the compiler complains about some instructions not being supported in ARM mode. This is caused by arch/arm/mach-tegra/tegra20/warmboot_avp.c having different CFLAGS declared in Makefile. This file needs to be compiled without LTO. Fix this by removing -flto for this file. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * ARM: imx8m: fix imx_eqos_txclk_set_rate() type mismatch for LTOMarek Behún2021-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When building imx8mp_evk_defconfig with LTO, the compiler complains about type mismatch of function imx_eqos_txclk_set_rate() in file drivers/net/dwc_eth_qos.c:845:12 which contains a weak definition of this function, vs file arch/arm/mach-imx/imx8m/clock_imx8mm.c which contains an implementation. Change the type of this function in the implementation to fix this. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * ARM: kona: fix clk_bsc_enable() type mismatch for LTOMarek Behún2021-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | When building with LTO, the compiler complains about type mismatch of function clk_bsc_enable() in file: arch/arm/cpu/armv7/kona-common/clk-stubs.c vs other files that define or use this function: warning: type of ‘clk_bsc_enable’ does not match original declaration. Change the type of this function to that of the other usages. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * ARM: fix LTO for keystoneMarek Behún2021-05-241-0/+1
| | | | | | | | | | | | | | | | | | When building keystone with LTO the compiler complains: Error: selected processor does not support `smc #0' in Thumb mode Fix this by removing -flto for the file implementing these SMC calls. Signed-off-by: Marek Behún <marek.behun@nic.cz>
| * ARM: fix LTO for apf27Marek Behún2021-05-241-1/+1
| | | | | | | | | | | | | | | | When apf27_defconfig is built with LTO, linking complains about undefined reference to `nand_boot`. This is because it is referenced from inline assembly. Make it visible. Signed-off-by: Marek Behún <marek.behun@nic.cz>
| * ARM: fix LTO for imx28_xeaMarek Behún2021-05-242-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | When imx28_xea_defconfig is built with LTO, the compiler complains about the two different declarations of _start: include/asm-generic/sections.h as extern void _start(void); arch/arm/cpu/arm926ejs/mxs/mxs.c as extern uint32_t _start; Fix this. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * ARM: fix LTO build for some thumb-interwork casesMarek Behún2021-05-242-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Fix LTO build for some thumb-interwork usecases (such as for da850evm_defconfig), where inline assmebly such as mrc p15,0,r2,c1,c0,0 causes the compiler to fail during LTO linking with Error: selected processor does not support `mrc p15,0,r2,c1,c0,0' in Thumb mode Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * ARM: make gd a function call for LTO and set via set_gd()Marek Behún2021-05-245-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On ARM, the gd pointer is stored in registers r9 / x18. For this the -ffixed-r9 / -ffixed-x18 flag is used when compiling, but using global register variables causes errors when building with LTO, and these errors are very difficult to overcome. Richard Biener says [1]: Note that global register vars shouldn't be used with LTO and if they are restricted to just a few compilation units the recommended fix is to build those CUs without -flto. We cannot do this for U-Boot since all CUs use -ffixed-reg flag. It seems that with LTO we could in fact store the gd pointer differently and gain performance or size benefit by allowing the compiler to use r9 / x18. But this would need more work. So for now, when building with LTO, go the clang way, and instead of declaring gd a global register variable, we make it a function call via macro. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68384 Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * ARM: global_data: make set_gd() work for armv5 and armv6Marek Behún2021-05-241-1/+3
| | | | | | | | | | | | | | | | The Thumb instruction `ldr` is able to move high registers only from armv7. For armv5 and armv6 we have to use `mov`. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * sandbox: enable LTO by defaultMarek Behún2021-05-241-0/+1
| | | | | | | | | | | | | | Build sandbox targets with LTO by default. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * sandbox: make LTO availableMarek Behún2021-05-242-0/+5
| | | | | | | | | | | | | | Make LTO available for sandbox architecture. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * sandbox: use sections instead of symbols for getopt array boundariesMarek Behún2021-05-245-11/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | In style of linked lists, instead of declaring symbols for boundaries of getopt options array in the linker script, declare corresponding sections and retrieve the boundaries via static inline functions. Without this clang's LTO produces binary without any getopt options, because for some reason it thinks that array is empty (start and end symbols are at the same address). Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * sandbox: errno: avoid conflict with libc's errnoMarek Behún2021-05-242-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building with LTO, the system libc's `errno` variable used in arch/sandbox/cpu/os.c conflicts with U-Boot's `errno` (defined in lib/errno.c) with the following error: .../ld: errno@@GLIBC_PRIVATE: TLS definition in /lib64/libc.so.6 section .tbss mismatches non-TLS reference in /tmp/u-boot.EQlEXz.ltrans0.ltrans.o To avoid this conflict use different asm label for this variable when CONFIG_SANDBOX is enabled. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
| * build: link with --build-id=noneMarek Behún2021-05-242-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some toolchains are compiled so that they pass a --build-id=something parameter to the linker implicitly. This causes U-Boot LTO linking to fail with something like: ld: section .note.gnu.build-id LMA ... overlaps section .text LMA ... because U-Boot's link scripts do not currently handle .note.gnu.build-id section. Fix this by explicitly disabling build-id. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * build: support building with Link Time OptimizationsMarek Behún2021-05-246-3/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add plumbing for building U-Boot with Link Time Optimizations. When building with LTO, $(PLATFORM_LIBS) has to be in --whole-archive / --no-whole-archive group, otherwise some functions declared in assembly may not be resolved and linking may fail. Note: clang may throw away linker list symbols it thinks are unused when compiling with LTO. To force these symbols to be included, we refer to them via the __ADDRESSABLE macro in a C file generated from compiled built-in.o files before linking. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * build: use thin archives instead of incremental linkingMarek Behún2021-05-244-15/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we use incremental linking (ld -r) to link several object files from one directory into one built-in.o object file containing the linked code from that directory (and its subdirectories). Linux has, some time ago, moved to thin archives instead. Thin archives are archives (.a) that do not really contain the object files, only references to them. Using thin archives instead of incremental linking - saves disk space - apparently works better with dead code elimination - makes things easier for LTO The third point is the important one for us. With incremental linking there are several options how to do LTO, and that would unnecessarily complicate things. We have to use the --whole-archive/--no-whole-archive linking option instead of --start-group/--end-group, otherwise linking may fail because of unresolved symbols, or the resulting binary will be unusable. We also need to use the P flag for ar, otherwise final linking may fail. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * Makefile, Makefile.spl: cosmetic changeMarek Behún2021-05-242-11/+18
| | | | | | | | | | | | | | Indent the linking commands so that they look cosmetically better. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * lib: crc32: put the crc_table variable into efi_runtime_rodata sectionMarek Behún2021-05-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When compiling with LTO, the compiler fails with an error saying that `crc_table` causes a section type conflict with `efi_var_buf`. This is because both are declared to be in the same section (via macro `__efi_runtime_data`), but one is const while the other is not. Put this variable into the section .rodata.efi_runtime, instead of .data.efi_runtime, via macro __efi_runtime_rodata. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Heinrich Schuchardt <xypron.gpk@gmx.de>
| * efi_selftest: compiler flags for efi_selftest_miniapp_exception.oMarek Behún2021-05-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Add $(CFLAGS_EFI) and remove $(CFLAGS_NON_EFI) for efi_selftest_miniapp_exception.o. The removal is needed when compiling with LTO - this object file needs to be compiled without -flto. The adding is for consistency with other miniapps. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: add macro for const EFI runtime dataMarek Behún2021-05-241-0/+17
| | | | | | | | | | | | | | | | Add macro __efi_runtime_rodata, for const variables with similar purpose as those using __efi_runtime_data. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: add Sphinx doc for __efi_runtime and __efi_runtime_dataMarek Behún2021-05-241-3/+26
| | | | | | | | | | | | | | | | Document the macros __efi_runtime and __efi_runtime_data in Sphinx style. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| * efi_loader: fix warning when linking with LTOMarek Behún2021-05-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When linking with LTO, the compiler complains about type mismatch of variables `__efi_runtime_start`, `__efi_runtime_stop`, `__efi_runtime_rel_start` and `__efi_runtime_rel_stop`: include/efi_loader.h:218:21: warning: type of ‘__efi_runtime_start’ does not match original declaration [-Wlto-type-mismatch] 218 | extern unsigned int __efi_runtime_start, __efi_runtime_stop; | ^ arch/sandbox/lib/sections.c:7:6: note: ‘__efi_runtime_start’ was previously declared here 7 | char __efi_runtime_start[0] __attribute__((section(".__efi_run | ^ Change the type to char[] in include/efi_loader.h. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * string: make memcpy(), memset(), memcmp() and memmove() visible for LTOMarek Behún2021-05-241-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems that sometimes (happening on ARM64, for example with turris_mox_defconfig) GCC, when linking with LTO, changes the symbol names of some functions, for example lib/string.c's memcpy() function to memcpy.isra.0. This is a problem however when GCC for a code such as this: struct some_struct *info = get_some_struct(); struct some struct tmpinfo; tmpinfo = *info; emits a call to memcpy() by builtin behaviour, to copy *info to tmpinfo. This then results in the following linking error: .../lz4.c:93: undefined reference to `memcpy' .../uuid.c:206: more undefined references to `memcpy' follow GCC's documentation says this about -nodefaultlibs option: The compiler may generate calls to "memcmp", "memset", "memcpy" and "memmove". These entries are usually resolved by entries in libc. These entry points should be supplied through some other mechanism when this option is specified. Make these functions visible by using the __used macro to avoid this error. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * test/py: improve regular expression for ut subtest symbol matcherMarek Behún2021-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve the regular expression that matches unittest symbols in u-boot.sym. Currently we do not enforce no prefix in symbol string, but with the soon to come change in linker lists declaring lists and entries with the __ADDRESSABLE macro (because of LTO), the symbol file will contain for every symbol of the form _u_boot_list_2_ut_X_2_Y also symbol __UNIQUE_ID___addressable__u_boot_list_2_ut_X_2_YN, (where N at the end is some number). In order to avoid matching these additional symbols, ensure that the character before "_u_boot_list_2_ut" is not a symbol name character. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * compiler.h: align the __ADDRESSABLE macro with Linux' versionMarek Behún2021-05-241-1/+1
| | | | | | | | | | | | | | Use UNIQUE_ID in the __ADDRESSABLE macro. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * treewide: Convert macro and uses of __section(foo) to __section("foo")Marek Behún2021-05-2452-107/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit does the same thing as Linux commit 33def8498fdd. Use a more generic form for __section that requires quotes to avoid complications with clang and gcc differences. Remove the quote operator # from compiler_attributes.h __section macro. Convert all unquoted __section(foo) uses to quoted __section("foo"). Also convert __attribute__((section("foo"))) uses to __section("foo") even if the __attribute__ has multiple list entry forms. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
| * checkpatch: require quotes around section name in the __section() macroMarek Behún2021-05-241-1/+1
| | | | | | | | | | | | | | This is how Linux does this now, see Linux commit 339f29d91acf. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
| * regmap: fix a serious pointer casting bugMarek Behún2021-05-241-2/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a serious bug in regmap_read() and regmap_write() functions where an uint pointer is cast to (void *) which is then cast to (u8 *), (u16 *), (u32 *) or (u64 *), depending on register width of the map. For example given a regmap with 16-bit register width the code int val = 0x12340000; regmap_read(map, 0, &val); only changes the lower 16 bits of val on little-endian machines. The upper 16 bits will remain 0x1234. Nobody noticed this probably because this bug can be triggered with regmap_write() only on big-endian architectures (which are not used by many people anymore), and on little endian this bug has consequences only if register width is 8 or 16 bits and also the memory place to which regmap_read() should store it's result has non-zero upper bits, which it seems doesn't happen anywhere in U-Boot normally. CI managed to trigger this bug in unit test of dm_test_devm_regmap_field when compiled for sandbox_defconfig using LTO. Fix this by utilizing an union { u8; u16; u32; u64; } and reading data into this union / writing data from this union. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Simon Glass <sjg@chromium.org> Cc: Heiko Schocher <hs@denx.de> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Pratyush Yadav <p.yadav@ti.com>
| * test: Avoid random numbers in dm_test_devm_regmap()Simon Glass2021-05-241-2/+1
| | | | | | | | | | | | | | | | | | | | There is no good reason to use a sequence from rand() here. We may as well invent our own sequence. This should molify Coverity which does not use rand() being used. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 312949)