From 594971b59caa1d75f0179de8d612375f410a7566 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Thu, 21 Mar 2024 23:29:18 -0700 Subject: Remove obsolete portability patches with C23 and new cproc --- .../0002-Avoid-pointer-arithmetic-on-void.patch | 269 +++++++++++++++++++++ .../0002-Use-__typeof__-instead-of-typeof.patch | 27 --- .../patch/0003-Avoid-empty-initializer-lists.patch | 49 ---- .../0003-Remove-use-of-statement-expressions.patch | 48 ++++ .../0004-Avoid-pointer-arithmetic-on-void.patch | 269 --------------------- ...se-__bswap32-instead-of-__builtin_bswap32.patch | 25 ++ .../0005-Remove-use-of-statement-expressions.patch | 48 ---- ...se-__bswap32-instead-of-__builtin_bswap32.patch | 25 -- pkg/u-boot/ver | 2 +- 9 files changed, 343 insertions(+), 419 deletions(-) create mode 100644 pkg/u-boot/patch/0002-Avoid-pointer-arithmetic-on-void.patch delete mode 100644 pkg/u-boot/patch/0002-Use-__typeof__-instead-of-typeof.patch delete mode 100644 pkg/u-boot/patch/0003-Avoid-empty-initializer-lists.patch create mode 100644 pkg/u-boot/patch/0003-Remove-use-of-statement-expressions.patch delete mode 100644 pkg/u-boot/patch/0004-Avoid-pointer-arithmetic-on-void.patch create mode 100644 pkg/u-boot/patch/0004-Use-__bswap32-instead-of-__builtin_bswap32.patch delete mode 100644 pkg/u-boot/patch/0005-Remove-use-of-statement-expressions.patch delete mode 100644 pkg/u-boot/patch/0006-Use-__bswap32-instead-of-__builtin_bswap32.patch (limited to 'pkg/u-boot') diff --git a/pkg/u-boot/patch/0002-Avoid-pointer-arithmetic-on-void.patch b/pkg/u-boot/patch/0002-Avoid-pointer-arithmetic-on-void.patch new file mode 100644 index 00000000..65b8f60f --- /dev/null +++ b/pkg/u-boot/patch/0002-Avoid-pointer-arithmetic-on-void.patch @@ -0,0 +1,269 @@ +From 2bb631b109219f0e9bea49294b9408269ce9b5ee Mon Sep 17 00:00:00 2001 +From: Michael Forney +Date: Sat, 1 May 2021 01:37:10 -0700 +Subject: [PATCH] Avoid pointer arithmetic on `void *` + +void is an incomplete type, so cannot be used in pointer arithmetic. +--- + tools/aisimage.c | 2 +- + tools/default_image.c | 4 ++-- + tools/mtk_image.c | 6 +++--- + tools/omapimage.c | 10 +++++----- + tools/rkcommon.c | 10 +++++----- + tools/rkspi.c | 6 +++--- + tools/socfpgaimage.c | 2 +- + tools/stm32image.c | 2 +- + tools/zynqmpbif.c | 8 ++++---- + tools/zynqmpimage.c | 8 ++++---- + 10 files changed, 29 insertions(+), 29 deletions(-) + +diff --git a/tools/aisimage.c b/tools/aisimage.c +index b8b3ee3207..58eb596844 100644 +--- a/tools/aisimage.c ++++ b/tools/aisimage.c +@@ -148,7 +148,7 @@ static void aisimage_print_header(const void *hdr) + fprintf(stdout, "AIS cmd : %s\n", + get_table_entry_name(aisimage_cmds, NULL, id)); + ptr += cmd_table[id].nargs + IS_FNC_EXEC(id) + 1; +- if (((void *)ptr - hdr) > ais_img_size) { ++ if ((char *)ptr - (char *)hdr > ais_img_size) { + fprintf(stderr, + "AIS Image not terminated by JMPCLOSE\n"); + return; +diff --git a/tools/default_image.c b/tools/default_image.c +index e164c0c27d..d2e3688908 100644 +--- a/tools/default_image.c ++++ b/tools/default_image.c +@@ -98,8 +98,8 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd, + image_header_t * hdr = (image_header_t *)ptr; + + checksum = crc32(0, +- (const unsigned char *)(ptr + +- sizeof(image_header_t)), ++ (const unsigned char *)ptr + ++ sizeof(image_header_t), + sbuf->st_size - sizeof(image_header_t)); + + time = imagetool_get_source_date(params->cmdname, sbuf->st_mtime); +diff --git a/tools/mtk_image.c b/tools/mtk_image.c +index bde1e5da4b..3038402413 100644 +--- a/tools/mtk_image.c ++++ b/tools/mtk_image.c +@@ -688,7 +688,7 @@ static void mtk_image_set_gen_header(void *ptr, off_t filesize, + hdr->brlyt.total_size_2 = hdr->brlyt.total_size; + + /* GFH header */ +- gfh = (struct gfh_header *)(ptr + sizeof(struct gen_device_header)); ++ gfh = (struct gfh_header *)((char *)ptr + sizeof(struct gen_device_header)); + put_ghf_header(gfh, filesize, sizeof(struct gen_device_header), + loadaddr, GFH_FLASH_TYPE_GEN); + +@@ -714,7 +714,7 @@ static void mtk_image_set_nand_header(void *ptr, off_t filesize, + payload_pages = (filesize + le16_to_cpu(hdr_nand->pagesize) - 1) / + le16_to_cpu(hdr_nand->pagesize); + brlyt = (struct brom_layout_header *) +- (ptr + le16_to_cpu(hdr_nand->pagesize)); ++ ((char *)ptr + le16_to_cpu(hdr_nand->pagesize)); + put_brom_layout_header(brlyt, hdr_media); + brlyt->header_size = cpu_to_le32(2); + brlyt->total_size = cpu_to_le32(payload_pages); +@@ -723,7 +723,7 @@ static void mtk_image_set_nand_header(void *ptr, off_t filesize, + brlyt->unused = cpu_to_le32(1); + + /* GFH header */ +- gfh = (struct gfh_header *)(ptr + 2 * le16_to_cpu(hdr_nand->pagesize)); ++ gfh = (struct gfh_header *)((char *)ptr + 2 * le16_to_cpu(hdr_nand->pagesize)); + put_ghf_header(gfh, filesize, 2 * le16_to_cpu(hdr_nand->pagesize), + loadaddr, GFH_FLASH_TYPE_NAND); + +diff --git a/tools/omapimage.c b/tools/omapimage.c +index c59cdcc79b..90c279fb05 100644 +--- a/tools/omapimage.c ++++ b/tools/omapimage.c +@@ -89,7 +89,7 @@ static void omapimage_print_header(const void *ptr) + { + const struct ch_toc *toc = (struct ch_toc *)ptr; + const struct gp_header *gph = +- (struct gp_header *)(ptr+OMAP_CH_HDR_SIZE); ++ (struct gp_header *)((char *)ptr+OMAP_CH_HDR_SIZE); + uint32_t offset, size; + + while (toc->section_offset != 0xffffffff +@@ -111,7 +111,7 @@ static void omapimage_print_header(const void *ptr) + toc->section_offset, + toc->section_size); + +- omapimage_print_section((struct ch_settings *)(ptr+offset)); ++ omapimage_print_section((struct ch_settings *)((char *)ptr+offset)); + toc++; + } + +@@ -120,7 +120,7 @@ static void omapimage_print_header(const void *ptr) + + static int toc_offset(void *hdr, void *member) + { +- return member - hdr; ++ return (char *)member - (char *)hdr; + } + + static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd, +@@ -128,8 +128,8 @@ static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd, + { + struct ch_toc *toc = (struct ch_toc *)ptr; + struct ch_settings *chs = (struct ch_settings *) +- (ptr + 2 * sizeof(*toc)); +- struct gp_header *gph = (struct gp_header *)(ptr + OMAP_CH_HDR_SIZE); ++ ((char *)ptr + 2 * sizeof(*toc)); ++ struct gp_header *gph = (struct gp_header *)((char *)ptr + OMAP_CH_HDR_SIZE); + + toc->section_offset = toc_offset(ptr, chs); + toc->section_size = sizeof(struct ch_settings); +diff --git a/tools/rkcommon.c b/tools/rkcommon.c +index d55cd2c2d5..8853b2560c 100644 +--- a/tools/rkcommon.c ++++ b/tools/rkcommon.c +@@ -249,7 +249,7 @@ static void rkcommon_set_header0(void *buf, struct image_tool_params *params) + void rkcommon_set_header(void *buf, struct stat *sbuf, int ifd, + struct image_tool_params *params) + { +- struct header1_info *hdr = buf + RK_SPL_HDR_START; ++ struct header1_info *hdr = (void *)((char *)buf + RK_SPL_HDR_START); + + rkcommon_set_header0(buf, params); + +@@ -262,7 +262,7 @@ void rkcommon_set_header(void *buf, struct stat *sbuf, int ifd, + + if (spl_params.boot_file) { + if (rkcommon_need_rc4_spl(params)) +- rkcommon_rc4_encode_spl(buf + RK_SPL_HDR_START, ++ rkcommon_rc4_encode_spl((char *)buf + RK_SPL_HDR_START, + spl_params.init_size, + spl_params.boot_size); + } +@@ -302,8 +302,8 @@ static int rkcommon_parse_header(const void *buf, struct header0_info *header0, + return -ENOSYS; + + hdr1_offset = le16_to_cpu(header0->init_offset) * RK_BLK_SIZE; +- hdr1_sdmmc = (struct header1_info *)(buf + hdr1_offset); +- hdr1_spi = (struct header1_info *)(buf + ++ hdr1_sdmmc = (struct header1_info *)((char *)buf + hdr1_offset); ++ hdr1_spi = (struct header1_info *)((char *)buf + + rkcommon_offset_to_spi(hdr1_offset)); + + for (i = 0; i < ARRAY_SIZE(spl_infos); i++) { +@@ -392,7 +392,7 @@ void rkcommon_rc4_encode_spl(void *buf, unsigned int offset, unsigned int size) + while (remaining > 0) { + int step = (remaining > RK_BLK_SIZE) ? RK_BLK_SIZE : remaining; + +- rc4_encode(buf + offset, step, rc4_key); ++ rc4_encode((char *)buf + offset, step, rc4_key); + offset += RK_BLK_SIZE; + remaining -= step; + } +diff --git a/tools/rkspi.c b/tools/rkspi.c +index f2530f7bde..7bd13f3749 100644 +--- a/tools/rkspi.c ++++ b/tools/rkspi.c +@@ -37,10 +37,10 @@ static void rkspi_set_header(void *buf, struct stat *sbuf, int ifd, + + for (sector = size / RKSPI_SECT_LEN - 1; sector >= 0; sector--) { + debug("sector %u\n", sector); +- memmove(buf + sector * RKSPI_SECT_LEN * 2, +- buf + sector * RKSPI_SECT_LEN, ++ memmove((char *)buf + sector * RKSPI_SECT_LEN * 2, ++ (char *)buf + sector * RKSPI_SECT_LEN, + RKSPI_SECT_LEN); +- memset(buf + sector * RKSPI_SECT_LEN * 2 + RKSPI_SECT_LEN, ++ memset((char *)buf + sector * RKSPI_SECT_LEN * 2 + RKSPI_SECT_LEN, + '\0', RKSPI_SECT_LEN); + } + } +diff --git a/tools/socfpgaimage.c b/tools/socfpgaimage.c +index eba812fec9..a206323d6c 100644 +--- a/tools/socfpgaimage.c ++++ b/tools/socfpgaimage.c +@@ -315,7 +315,7 @@ static void socfpgaimage_print_header_v1(struct socfpga_header_v1 *header) + + static void socfpgaimage_print_header(const void *ptr) + { +- const void *header = ptr + HEADER_OFFSET; ++ const void *header = (char *)ptr + HEADER_OFFSET; + struct socfpga_header_v0 *header_v0; + + if (sfp_verify_buffer(ptr) == 0) { +diff --git a/tools/stm32image.c b/tools/stm32image.c +index 18357c0518..9252362654 100644 +--- a/tools/stm32image.c ++++ b/tools/stm32image.c +@@ -58,7 +58,7 @@ static uint32_t stm32image_checksum(void *start, uint32_t len) + if (len < hdr_len) + return 0; + +- p = start + hdr_len; ++ p = (uint8_t *)((char *)start + hdr_len); + len -= hdr_len; + + while (len > 0) { +diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c +index 82ce0ac1a5..04325afa20 100644 +--- a/tools/zynqmpbif.c ++++ b/tools/zynqmpbif.c +@@ -262,7 +262,7 @@ static int bif_add_blob(const void *data, size_t len, size_t *offset) + + new_size = ROUND(bif_output.data_len + len, 64); + new_data = realloc(bif_output.data, new_size); +- memcpy(new_data + bif_output.data_len, data, len); ++ memcpy((char *)new_data + bif_output.data_len, data, len); + if (offset) + *offset = bif_output.data_len; + bif_output.data = new_data; +@@ -270,11 +270,11 @@ static int bif_add_blob(const void *data, size_t len, size_t *offset) + + /* Readjust internal pointers */ + if (bif_output.header) +- bif_output.header = new_data + header_off; ++ bif_output.header = (void *)((char *)new_data + header_off); + if (bif_output.last_part) +- bif_output.last_part = new_data + last_part_off; ++ bif_output.last_part = (void *)((char *)new_data + last_part_off); + if (bif_output.imgheader) +- bif_output.imgheader = new_data + imgheader_off; ++ bif_output.imgheader = (void *)((char *)new_data + imgheader_off); + + return 0; + } +diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c +index 19b2f02ff1..20122d1320 100644 +--- a/tools/zynqmpimage.c ++++ b/tools/zynqmpimage.c +@@ -250,15 +250,15 @@ void zynqmpimage_print_header(const void *ptr) + } + + if (zynqhdr->image_header_table_offset) { +- struct image_header_table *iht = (void *)ptr + +- zynqhdr->image_header_table_offset; ++ struct image_header_table *iht = (void *)((char *)ptr + ++ zynqhdr->image_header_table_offset); + struct partition_header *ph; + uint32_t ph_offset; + uint32_t next; + int i; + + ph_offset = le32_to_cpu(iht->partition_header_offset) * 4; +- ph = (void *)ptr + ph_offset; ++ ph = (void *)((char *)ptr + ph_offset); + for (i = 0; i < le32_to_cpu(iht->nr_parts); i++) { + next = le32_to_cpu(ph->next_partition_offset) * 4; + +@@ -266,7 +266,7 @@ void zynqmpimage_print_header(const void *ptr) + if (i) + print_partition(ptr, ph); + +- ph = (void *)ptr + next; ++ ph = (void *)((char *)ptr + next); + } + } + +-- +2.31.1 + diff --git a/pkg/u-boot/patch/0002-Use-__typeof__-instead-of-typeof.patch b/pkg/u-boot/patch/0002-Use-__typeof__-instead-of-typeof.patch deleted file mode 100644 index db0ba15c..00000000 --- a/pkg/u-boot/patch/0002-Use-__typeof__-instead-of-typeof.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 62f25c7293254bcb465c6c85bda61bff4630b8c8 Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Sat, 1 May 2021 00:57:30 -0700 -Subject: [PATCH] Use __typeof__ instead of typeof - -The compiler may not define typeof in strict C mode to prevent -namespace polution. ---- - tools/imagetool.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/imagetool.h b/tools/imagetool.h -index 2801ea9e9f..bbdf82877b 100644 ---- a/tools/imagetool.h -+++ b/tools/imagetool.h -@@ -26,7 +26,7 @@ - #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) - - #define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) --#define ALIGN(x, a) __ALIGN_MASK((x), (typeof(x))(a) - 1) -+#define ALIGN(x, a) __ALIGN_MASK((x), (__typeof__(x))(a) - 1) - - #define IH_ARCH_DEFAULT IH_ARCH_INVALID - --- -2.31.1 - diff --git a/pkg/u-boot/patch/0003-Avoid-empty-initializer-lists.patch b/pkg/u-boot/patch/0003-Avoid-empty-initializer-lists.patch deleted file mode 100644 index 0fdc2445..00000000 --- a/pkg/u-boot/patch/0003-Avoid-empty-initializer-lists.patch +++ /dev/null @@ -1,49 +0,0 @@ -From e5643a0cc9d661643541d6c965ac0ea59a77db75 Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Sat, 1 May 2021 01:01:49 -0700 -Subject: [PATCH] Avoid empty initializer lists - -These are not allowed in ISO C. ---- - common/image.c | 2 +- - tools/kwbimage.c | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/common/image.c b/common/image.c -index 51854aae5d..1610c9c5c0 100644 ---- a/common/image.c -+++ b/common/image.c -@@ -216,7 +216,7 @@ static const struct comp_magic_map image_comp[] = { - { IH_COMP_GZIP, "gzip", {0x1f, 0x8b},}, - { IH_COMP_LZMA, "lzma", {0x5d, 0x00},}, - { IH_COMP_LZO, "lzo", {0x89, 0x4c},}, -- { IH_COMP_NONE, "none", {}, }, -+ { IH_COMP_NONE, "none", {0}, }, - }; - - static const struct table_info table_info[IH_COUNT] = { -diff --git a/tools/kwbimage.c b/tools/kwbimage.c -index 02fd0c949f..11b174a026 100644 ---- a/tools/kwbimage.c -+++ b/tools/kwbimage.c -@@ -70,7 +70,7 @@ struct boot_mode boot_modes[] = { - { 0x9C, "pex" }, - { 0x69, "uart" }, - { 0xAE, "sdio" }, -- {}, -+ { 0 }, - }; - - struct nand_ecc_mode { -@@ -83,7 +83,7 @@ struct nand_ecc_mode nand_ecc_modes[] = { - { 0x01, "hamming" }, - { 0x02, "rs" }, - { 0x03, "disabled" }, -- {}, -+ { 0 }, - }; - - /* Used to identify an undefined execution or destination address */ --- -2.31.1 - diff --git a/pkg/u-boot/patch/0003-Remove-use-of-statement-expressions.patch b/pkg/u-boot/patch/0003-Remove-use-of-statement-expressions.patch new file mode 100644 index 00000000..4a4f097f --- /dev/null +++ b/pkg/u-boot/patch/0003-Remove-use-of-statement-expressions.patch @@ -0,0 +1,48 @@ +From 40df4efea0f6c964d1b35fa63737d53411e806e6 Mon Sep 17 00:00:00 2001 +From: Michael Forney +Date: Sat, 1 May 2021 01:38:52 -0700 +Subject: [PATCH] Remove use of statement-expressions + +This is a GNU C extension. +--- + tools/zynqmpbif.c | 14 +++++--------- + 1 file changed, 5 insertions(+), 9 deletions(-) + +diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c +index fbba768ed8..4d529ed785 100644 +--- a/tools/zynqmpbif.c ++++ b/tools/zynqmpbif.c +@@ -810,13 +810,6 @@ static const struct bif_file_type *get_file_type(struct bif_entry *entry) + return NULL; + } + +-#define NEXT_CHAR(str, chr) ({ \ +- char *_n = strchr(str, chr); \ +- if (!_n) \ +- goto err; \ +- _n; \ +-}) +- + static char *skip_whitespace(char *str) + { + while (*str == ' ' || *str == '\t') +@@ -848,11 +841,14 @@ int zynqmpbif_copy_image(int outfd, struct image_tool_params *mparams) + bifp = bif; + + /* A bif description starts with a { section */ +- bifp = NEXT_CHAR(bifp, '{') + 1; ++ if (!(bifp = strchr(bifp, '{'))) ++ goto err; ++ ++bifp; + + /* Read every line */ + while (1) { +- bifpn = NEXT_CHAR(bifp, '\n'); ++ if (!(bifp = strchr(bifp, '\n'))) ++ goto err; + + if (bifpn[-1] == '\r') + bifpn[-1] = '\0'; +-- +2.31.1 + diff --git a/pkg/u-boot/patch/0004-Avoid-pointer-arithmetic-on-void.patch b/pkg/u-boot/patch/0004-Avoid-pointer-arithmetic-on-void.patch deleted file mode 100644 index 65b8f60f..00000000 --- a/pkg/u-boot/patch/0004-Avoid-pointer-arithmetic-on-void.patch +++ /dev/null @@ -1,269 +0,0 @@ -From 2bb631b109219f0e9bea49294b9408269ce9b5ee Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Sat, 1 May 2021 01:37:10 -0700 -Subject: [PATCH] Avoid pointer arithmetic on `void *` - -void is an incomplete type, so cannot be used in pointer arithmetic. ---- - tools/aisimage.c | 2 +- - tools/default_image.c | 4 ++-- - tools/mtk_image.c | 6 +++--- - tools/omapimage.c | 10 +++++----- - tools/rkcommon.c | 10 +++++----- - tools/rkspi.c | 6 +++--- - tools/socfpgaimage.c | 2 +- - tools/stm32image.c | 2 +- - tools/zynqmpbif.c | 8 ++++---- - tools/zynqmpimage.c | 8 ++++---- - 10 files changed, 29 insertions(+), 29 deletions(-) - -diff --git a/tools/aisimage.c b/tools/aisimage.c -index b8b3ee3207..58eb596844 100644 ---- a/tools/aisimage.c -+++ b/tools/aisimage.c -@@ -148,7 +148,7 @@ static void aisimage_print_header(const void *hdr) - fprintf(stdout, "AIS cmd : %s\n", - get_table_entry_name(aisimage_cmds, NULL, id)); - ptr += cmd_table[id].nargs + IS_FNC_EXEC(id) + 1; -- if (((void *)ptr - hdr) > ais_img_size) { -+ if ((char *)ptr - (char *)hdr > ais_img_size) { - fprintf(stderr, - "AIS Image not terminated by JMPCLOSE\n"); - return; -diff --git a/tools/default_image.c b/tools/default_image.c -index e164c0c27d..d2e3688908 100644 ---- a/tools/default_image.c -+++ b/tools/default_image.c -@@ -98,8 +98,8 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd, - image_header_t * hdr = (image_header_t *)ptr; - - checksum = crc32(0, -- (const unsigned char *)(ptr + -- sizeof(image_header_t)), -+ (const unsigned char *)ptr + -+ sizeof(image_header_t), - sbuf->st_size - sizeof(image_header_t)); - - time = imagetool_get_source_date(params->cmdname, sbuf->st_mtime); -diff --git a/tools/mtk_image.c b/tools/mtk_image.c -index bde1e5da4b..3038402413 100644 ---- a/tools/mtk_image.c -+++ b/tools/mtk_image.c -@@ -688,7 +688,7 @@ static void mtk_image_set_gen_header(void *ptr, off_t filesize, - hdr->brlyt.total_size_2 = hdr->brlyt.total_size; - - /* GFH header */ -- gfh = (struct gfh_header *)(ptr + sizeof(struct gen_device_header)); -+ gfh = (struct gfh_header *)((char *)ptr + sizeof(struct gen_device_header)); - put_ghf_header(gfh, filesize, sizeof(struct gen_device_header), - loadaddr, GFH_FLASH_TYPE_GEN); - -@@ -714,7 +714,7 @@ static void mtk_image_set_nand_header(void *ptr, off_t filesize, - payload_pages = (filesize + le16_to_cpu(hdr_nand->pagesize) - 1) / - le16_to_cpu(hdr_nand->pagesize); - brlyt = (struct brom_layout_header *) -- (ptr + le16_to_cpu(hdr_nand->pagesize)); -+ ((char *)ptr + le16_to_cpu(hdr_nand->pagesize)); - put_brom_layout_header(brlyt, hdr_media); - brlyt->header_size = cpu_to_le32(2); - brlyt->total_size = cpu_to_le32(payload_pages); -@@ -723,7 +723,7 @@ static void mtk_image_set_nand_header(void *ptr, off_t filesize, - brlyt->unused = cpu_to_le32(1); - - /* GFH header */ -- gfh = (struct gfh_header *)(ptr + 2 * le16_to_cpu(hdr_nand->pagesize)); -+ gfh = (struct gfh_header *)((char *)ptr + 2 * le16_to_cpu(hdr_nand->pagesize)); - put_ghf_header(gfh, filesize, 2 * le16_to_cpu(hdr_nand->pagesize), - loadaddr, GFH_FLASH_TYPE_NAND); - -diff --git a/tools/omapimage.c b/tools/omapimage.c -index c59cdcc79b..90c279fb05 100644 ---- a/tools/omapimage.c -+++ b/tools/omapimage.c -@@ -89,7 +89,7 @@ static void omapimage_print_header(const void *ptr) - { - const struct ch_toc *toc = (struct ch_toc *)ptr; - const struct gp_header *gph = -- (struct gp_header *)(ptr+OMAP_CH_HDR_SIZE); -+ (struct gp_header *)((char *)ptr+OMAP_CH_HDR_SIZE); - uint32_t offset, size; - - while (toc->section_offset != 0xffffffff -@@ -111,7 +111,7 @@ static void omapimage_print_header(const void *ptr) - toc->section_offset, - toc->section_size); - -- omapimage_print_section((struct ch_settings *)(ptr+offset)); -+ omapimage_print_section((struct ch_settings *)((char *)ptr+offset)); - toc++; - } - -@@ -120,7 +120,7 @@ static void omapimage_print_header(const void *ptr) - - static int toc_offset(void *hdr, void *member) - { -- return member - hdr; -+ return (char *)member - (char *)hdr; - } - - static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd, -@@ -128,8 +128,8 @@ static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd, - { - struct ch_toc *toc = (struct ch_toc *)ptr; - struct ch_settings *chs = (struct ch_settings *) -- (ptr + 2 * sizeof(*toc)); -- struct gp_header *gph = (struct gp_header *)(ptr + OMAP_CH_HDR_SIZE); -+ ((char *)ptr + 2 * sizeof(*toc)); -+ struct gp_header *gph = (struct gp_header *)((char *)ptr + OMAP_CH_HDR_SIZE); - - toc->section_offset = toc_offset(ptr, chs); - toc->section_size = sizeof(struct ch_settings); -diff --git a/tools/rkcommon.c b/tools/rkcommon.c -index d55cd2c2d5..8853b2560c 100644 ---- a/tools/rkcommon.c -+++ b/tools/rkcommon.c -@@ -249,7 +249,7 @@ static void rkcommon_set_header0(void *buf, struct image_tool_params *params) - void rkcommon_set_header(void *buf, struct stat *sbuf, int ifd, - struct image_tool_params *params) - { -- struct header1_info *hdr = buf + RK_SPL_HDR_START; -+ struct header1_info *hdr = (void *)((char *)buf + RK_SPL_HDR_START); - - rkcommon_set_header0(buf, params); - -@@ -262,7 +262,7 @@ void rkcommon_set_header(void *buf, struct stat *sbuf, int ifd, - - if (spl_params.boot_file) { - if (rkcommon_need_rc4_spl(params)) -- rkcommon_rc4_encode_spl(buf + RK_SPL_HDR_START, -+ rkcommon_rc4_encode_spl((char *)buf + RK_SPL_HDR_START, - spl_params.init_size, - spl_params.boot_size); - } -@@ -302,8 +302,8 @@ static int rkcommon_parse_header(const void *buf, struct header0_info *header0, - return -ENOSYS; - - hdr1_offset = le16_to_cpu(header0->init_offset) * RK_BLK_SIZE; -- hdr1_sdmmc = (struct header1_info *)(buf + hdr1_offset); -- hdr1_spi = (struct header1_info *)(buf + -+ hdr1_sdmmc = (struct header1_info *)((char *)buf + hdr1_offset); -+ hdr1_spi = (struct header1_info *)((char *)buf + - rkcommon_offset_to_spi(hdr1_offset)); - - for (i = 0; i < ARRAY_SIZE(spl_infos); i++) { -@@ -392,7 +392,7 @@ void rkcommon_rc4_encode_spl(void *buf, unsigned int offset, unsigned int size) - while (remaining > 0) { - int step = (remaining > RK_BLK_SIZE) ? RK_BLK_SIZE : remaining; - -- rc4_encode(buf + offset, step, rc4_key); -+ rc4_encode((char *)buf + offset, step, rc4_key); - offset += RK_BLK_SIZE; - remaining -= step; - } -diff --git a/tools/rkspi.c b/tools/rkspi.c -index f2530f7bde..7bd13f3749 100644 ---- a/tools/rkspi.c -+++ b/tools/rkspi.c -@@ -37,10 +37,10 @@ static void rkspi_set_header(void *buf, struct stat *sbuf, int ifd, - - for (sector = size / RKSPI_SECT_LEN - 1; sector >= 0; sector--) { - debug("sector %u\n", sector); -- memmove(buf + sector * RKSPI_SECT_LEN * 2, -- buf + sector * RKSPI_SECT_LEN, -+ memmove((char *)buf + sector * RKSPI_SECT_LEN * 2, -+ (char *)buf + sector * RKSPI_SECT_LEN, - RKSPI_SECT_LEN); -- memset(buf + sector * RKSPI_SECT_LEN * 2 + RKSPI_SECT_LEN, -+ memset((char *)buf + sector * RKSPI_SECT_LEN * 2 + RKSPI_SECT_LEN, - '\0', RKSPI_SECT_LEN); - } - } -diff --git a/tools/socfpgaimage.c b/tools/socfpgaimage.c -index eba812fec9..a206323d6c 100644 ---- a/tools/socfpgaimage.c -+++ b/tools/socfpgaimage.c -@@ -315,7 +315,7 @@ static void socfpgaimage_print_header_v1(struct socfpga_header_v1 *header) - - static void socfpgaimage_print_header(const void *ptr) - { -- const void *header = ptr + HEADER_OFFSET; -+ const void *header = (char *)ptr + HEADER_OFFSET; - struct socfpga_header_v0 *header_v0; - - if (sfp_verify_buffer(ptr) == 0) { -diff --git a/tools/stm32image.c b/tools/stm32image.c -index 18357c0518..9252362654 100644 ---- a/tools/stm32image.c -+++ b/tools/stm32image.c -@@ -58,7 +58,7 @@ static uint32_t stm32image_checksum(void *start, uint32_t len) - if (len < hdr_len) - return 0; - -- p = start + hdr_len; -+ p = (uint8_t *)((char *)start + hdr_len); - len -= hdr_len; - - while (len > 0) { -diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c -index 82ce0ac1a5..04325afa20 100644 ---- a/tools/zynqmpbif.c -+++ b/tools/zynqmpbif.c -@@ -262,7 +262,7 @@ static int bif_add_blob(const void *data, size_t len, size_t *offset) - - new_size = ROUND(bif_output.data_len + len, 64); - new_data = realloc(bif_output.data, new_size); -- memcpy(new_data + bif_output.data_len, data, len); -+ memcpy((char *)new_data + bif_output.data_len, data, len); - if (offset) - *offset = bif_output.data_len; - bif_output.data = new_data; -@@ -270,11 +270,11 @@ static int bif_add_blob(const void *data, size_t len, size_t *offset) - - /* Readjust internal pointers */ - if (bif_output.header) -- bif_output.header = new_data + header_off; -+ bif_output.header = (void *)((char *)new_data + header_off); - if (bif_output.last_part) -- bif_output.last_part = new_data + last_part_off; -+ bif_output.last_part = (void *)((char *)new_data + last_part_off); - if (bif_output.imgheader) -- bif_output.imgheader = new_data + imgheader_off; -+ bif_output.imgheader = (void *)((char *)new_data + imgheader_off); - - return 0; - } -diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c -index 19b2f02ff1..20122d1320 100644 ---- a/tools/zynqmpimage.c -+++ b/tools/zynqmpimage.c -@@ -250,15 +250,15 @@ void zynqmpimage_print_header(const void *ptr) - } - - if (zynqhdr->image_header_table_offset) { -- struct image_header_table *iht = (void *)ptr + -- zynqhdr->image_header_table_offset; -+ struct image_header_table *iht = (void *)((char *)ptr + -+ zynqhdr->image_header_table_offset); - struct partition_header *ph; - uint32_t ph_offset; - uint32_t next; - int i; - - ph_offset = le32_to_cpu(iht->partition_header_offset) * 4; -- ph = (void *)ptr + ph_offset; -+ ph = (void *)((char *)ptr + ph_offset); - for (i = 0; i < le32_to_cpu(iht->nr_parts); i++) { - next = le32_to_cpu(ph->next_partition_offset) * 4; - -@@ -266,7 +266,7 @@ void zynqmpimage_print_header(const void *ptr) - if (i) - print_partition(ptr, ph); - -- ph = (void *)ptr + next; -+ ph = (void *)((char *)ptr + next); - } - } - --- -2.31.1 - diff --git a/pkg/u-boot/patch/0004-Use-__bswap32-instead-of-__builtin_bswap32.patch b/pkg/u-boot/patch/0004-Use-__bswap32-instead-of-__builtin_bswap32.patch new file mode 100644 index 00000000..1c693b68 --- /dev/null +++ b/pkg/u-boot/patch/0004-Use-__bswap32-instead-of-__builtin_bswap32.patch @@ -0,0 +1,25 @@ +From 65a767fb096d5cc125c2981dfbc298458091567f Mon Sep 17 00:00:00 2001 +From: Michael Forney +Date: Sat, 1 May 2021 01:39:26 -0700 +Subject: [PATCH] Use __bswap32 instead of __builtin_bswap32 + +--- + tools/zynqmpbif.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c +index 4d529ed785..233464cb47 100644 +--- a/tools/zynqmpbif.c ++++ b/tools/zynqmpbif.c +@@ -517,7 +517,7 @@ static int bif_add_bit(struct bif_entry *bf) + debug("Bitstream Length: 0x%x\n", bitlen); + for (i = 0; i < bitlen; i += sizeof(uint32_t)) { + uint32_t *bitbin32 = (uint32_t *)&bitbin[i]; +- *bitbin32 = __builtin_bswap32(*bitbin32); ++ *bitbin32 = __bswap32(*bitbin32); + } + + if (!bf->dest_dev) +-- +2.31.1 + diff --git a/pkg/u-boot/patch/0005-Remove-use-of-statement-expressions.patch b/pkg/u-boot/patch/0005-Remove-use-of-statement-expressions.patch deleted file mode 100644 index 4a4f097f..00000000 --- a/pkg/u-boot/patch/0005-Remove-use-of-statement-expressions.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 40df4efea0f6c964d1b35fa63737d53411e806e6 Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Sat, 1 May 2021 01:38:52 -0700 -Subject: [PATCH] Remove use of statement-expressions - -This is a GNU C extension. ---- - tools/zynqmpbif.c | 14 +++++--------- - 1 file changed, 5 insertions(+), 9 deletions(-) - -diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c -index fbba768ed8..4d529ed785 100644 ---- a/tools/zynqmpbif.c -+++ b/tools/zynqmpbif.c -@@ -810,13 +810,6 @@ static const struct bif_file_type *get_file_type(struct bif_entry *entry) - return NULL; - } - --#define NEXT_CHAR(str, chr) ({ \ -- char *_n = strchr(str, chr); \ -- if (!_n) \ -- goto err; \ -- _n; \ --}) -- - static char *skip_whitespace(char *str) - { - while (*str == ' ' || *str == '\t') -@@ -848,11 +841,14 @@ int zynqmpbif_copy_image(int outfd, struct image_tool_params *mparams) - bifp = bif; - - /* A bif description starts with a { section */ -- bifp = NEXT_CHAR(bifp, '{') + 1; -+ if (!(bifp = strchr(bifp, '{'))) -+ goto err; -+ ++bifp; - - /* Read every line */ - while (1) { -- bifpn = NEXT_CHAR(bifp, '\n'); -+ if (!(bifp = strchr(bifp, '\n'))) -+ goto err; - - if (bifpn[-1] == '\r') - bifpn[-1] = '\0'; --- -2.31.1 - diff --git a/pkg/u-boot/patch/0006-Use-__bswap32-instead-of-__builtin_bswap32.patch b/pkg/u-boot/patch/0006-Use-__bswap32-instead-of-__builtin_bswap32.patch deleted file mode 100644 index 1c693b68..00000000 --- a/pkg/u-boot/patch/0006-Use-__bswap32-instead-of-__builtin_bswap32.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 65a767fb096d5cc125c2981dfbc298458091567f Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Sat, 1 May 2021 01:39:26 -0700 -Subject: [PATCH] Use __bswap32 instead of __builtin_bswap32 - ---- - tools/zynqmpbif.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c -index 4d529ed785..233464cb47 100644 ---- a/tools/zynqmpbif.c -+++ b/tools/zynqmpbif.c -@@ -517,7 +517,7 @@ static int bif_add_bit(struct bif_entry *bf) - debug("Bitstream Length: 0x%x\n", bitlen); - for (i = 0; i < bitlen; i += sizeof(uint32_t)) { - uint32_t *bitbin32 = (uint32_t *)&bitbin[i]; -- *bitbin32 = __builtin_bswap32(*bitbin32); -+ *bitbin32 = __bswap32(*bitbin32); - } - - if (!bf->dest_dev) --- -2.31.1 - diff --git a/pkg/u-boot/ver b/pkg/u-boot/ver index 0c331267..80d54778 100644 --- a/pkg/u-boot/ver +++ b/pkg/u-boot/ver @@ -1 +1 @@ -2021.04 r1 +2021.04 r2 -- cgit v1.2.3