Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings #17

Open
wants to merge 5 commits into
base: aspeed-master-v2019.04
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,12 @@ LDFLAGS_u-boot += $(LDFLAGS_FINAL)
# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker)

# Avoid 'warning: u-boot-spl has a LOAD segment with RWX permissions'
LDFLAGS_u-boot += $(call ld-option,--no-warn-rwx-segments)

# Avoid 'missing .note.GNU-stack section implies executable stack'
LDFLAGS_u-boot += -z noexecstack

ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),)
LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
endif
Expand Down
1 change: 1 addition & 0 deletions board/work-microwave/work_92105/work_92105_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <asm/gpio.h>
#include <spi.h>
#include <i2c.h>
#include <timestamp.h>
#include <version.h>
#include <vsprintf.h>

Expand Down
2 changes: 2 additions & 0 deletions cmd/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

#include <common.h>
#include <command.h>
#include <timestamp.h>
#include <version.h>
#include <version_string.h>
#include <linux/compiler.h>
#ifdef CONFIG_SYS_COREBOOT
#include <asm/arch/sysinfo.h>
Expand Down
2 changes: 1 addition & 1 deletion common/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <autoboot.h>
#include <cli.h>
#include <console.h>
#include <version.h>
#include <version_string.h>

/*
* Board-specific Platform code can reimplement show_boot_progress () if needed
Expand Down
3 changes: 3 additions & 0 deletions common/spl/spl.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#include <asm/u-boot.h>
#include <nand.h>
#include <fat.h>
#if CONFIG_IS_ENABLED(BANNER_PRINT)
#include <timestamp.h>
#endif
#include <version.h>
#include <image.h>
#include <malloc.h>
Expand Down
3 changes: 1 addition & 2 deletions drivers/video/cfb_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

#include <common.h>
#include <fdtdec.h>
#include <version.h>
#include <version_string.h>
#include <malloc.h>
#include <video.h>
#include <linux/compiler.h>
Expand Down Expand Up @@ -116,7 +116,6 @@
* Console device
*/

#include <version.h>
#include <linux/types.h>
#include <stdio_dev.h>
#include <video_font.h>
Expand Down
5 changes: 1 addition & 4 deletions include/configs/evb_ast2600_spl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@
#define CONFIG_SPL_LOAD_FIT_ADDRESS 0x00010000

/* Extra ENV for Boot Command */
#define STR_HELPER(n) #n
#define STR(n) STR_HELPER(n)

#undef CONFIG_EXTRA_ENV_SETTINGS
#define CONFIG_EXTRA_ENV_SETTINGS \
"loadaddr=" STR(CONFIG_SYS_LOAD_ADDR) "\0" \
"loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
"bootspi=fdt addr 20100000 && fdt header get fitsize totalsize && cp.b 20100000 ${loadaddr} ${fitsize} && bootm; echo Error loading kernel FIT image\0" \
"verify=yes\0" \
""
Expand Down
5 changes: 1 addition & 4 deletions include/configs/evb_ast2600_spl_emmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@
#define CONFIG_SPL_BSS_MAX_SIZE 0x00100000

/* Extra ENV for Boot Command */
#define STR_HELPER(n) #n
#define STR(n) STR_HELPER(n)

#undef CONFIG_EXTRA_ENV_SETTINGS
#define CONFIG_EXTRA_ENV_SETTINGS \
"loadaddr=" STR(CONFIG_SYS_LOAD_ADDR) "\0" \
"loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
"bootside=a\0" \
"rootfs=rofs-a\0" \
"setmmcargs=setenv bootargs ${bootargs} rootwait root=PARTLABEL=${rootfs}\0" \
Expand Down
5 changes: 1 addition & 4 deletions include/configs/evb_ast2600a1_spl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@
#define CONFIG_SPL_LOAD_FIT_ADDRESS 0x00010000

/* Extra ENV for Boot Command */
#define STR_HELPER(n) #n
#define STR(n) STR_HELPER(n)

#undef CONFIG_EXTRA_ENV_SETTINGS
#define CONFIG_EXTRA_ENV_SETTINGS \
"loadaddr=" STR(CONFIG_SYS_LOAD_ADDR) "\0" \
"loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
"bootspi=fdt addr 20100000 && fdt header get fitsize totalsize && cp.b 20100000 ${loadaddr} ${fitsize} && bootm; echo Error loading kernel FIT image\0" \
"verify=yes\0" \
""
Expand Down
8 changes: 7 additions & 1 deletion include/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,13 @@ image_set_hdr_b(comp) /* image_set_comp */

static inline void image_set_name(image_header_t *hdr, const char *name)
{
strncpy(image_get_name(hdr), name, IH_NMLEN);
/*
* This is equivalent to: strncpy(image_get_name(hdr), name, IH_NMLEN);
*
* Use the tortured code below to avoid a warning with gcc 12. We do not
* want to include a nul terminator if the name is of length IH_NMLEN
*/
memcpy(image_get_name(hdr), name, strnlen(name, IH_NMLEN));
}

int image_check_hcrc(const image_header_t *hdr);
Expand Down
5 changes: 0 additions & 5 deletions include/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@
#ifndef __VERSION_H__
#define __VERSION_H__

#include <timestamp.h>

#ifndef DO_DEPS_ONLY
#include "generated/version_autogenerated.h"
#endif

#define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \
U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING

#ifndef __ASSEMBLY__
extern const char version_string[];
#endif /* __ASSEMBLY__ */
#endif /* __VERSION_H__ */
8 changes: 8 additions & 0 deletions include/version_string.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0+ */

#ifndef __VERSION_STRING_H__
#define __VERSION_STRING_H__

extern const char version_string[];

#endif /* __VERSION_STRING_H__ */
2 changes: 1 addition & 1 deletion lib/display_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <common.h>
#include <console.h>
#include <div64.h>
#include <version.h>
#include <version_string.h>
#include <linux/ctype.h>
#include <asm/io.h>

Expand Down
2 changes: 1 addition & 1 deletion scripts/Makefile.build
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ ifdef builtin-target
quiet_cmd_link_o_target = LD $@
# If the list of objects to link is empty, just create an empty built-in.o
cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \
$(LD) $(ld_flags) -z noexecstack -r -o $@ $(filter $(obj-y), $^) \
$(cmd_secanalysis),\
rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@)

Expand Down
6 changes: 4 additions & 2 deletions scripts/Makefile.lib
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,11 @@ cmd_efi_objcopy = $(OBJCOPY) -j .header -j .text -j .sdata -j .data -j \
$(obj)/%.efi: $(obj)/%_efi.so
$(call cmd,efi_objcopy)

KBUILD_EFILDFLAGS = -nostdlib -zexecstack -znocombreloc -znorelro
KBUILD_EFILDFLAGS += $(call ld-option,--no-warn-rwx-segments)
quiet_cmd_efi_ld = LD $@
cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \
-Bsymbolic -s $^ -o $@
cmd_efi_ld = $(LD) $(KBUILD_EFILDFLAGS) -T $(EFI_LDS_PATH) \
-shared -Bsymbolic -s $^ -o $@

EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)

Expand Down
6 changes: 6 additions & 0 deletions scripts/Makefile.spl
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,12 @@ LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
LDFLAGS_$(SPL_BIN) += $(call ld-option, --no-dynamic-linker)

# Avoid 'warning: u-boot-spl has a LOAD segment with RWX permissions'
LDFLAGS_$(SPL_BIN) += $(call ld-option,--no-warn-rwx-segments)

# Avoid 'missing .note.GNU-stack section implies executable stack'
LDFLAGS_$(SPL_BIN) += -z noexecstack

# Pick the best-match (i.e. SPL_TEXT_BASE for SPL, TPL_TEXT_BASE for TPL)
ifneq ($(CONFIG_$(SPL_TPL_)TEXT_BASE),)
LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_$(SPL_TPL_)TEXT_BASE)
Expand Down
2 changes: 1 addition & 1 deletion test/print_ut.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <efi_api.h>
#endif
#include <display_options.h>
#include <version.h>
#include <version_string.h>

#define FAKE_BUILD_TAG "jenkins-u-boot-denx_uboot_dm-master-build-aarch64" \
"and a lot more text to come"
Expand Down