Skip to content

Commit 965a397

Browse files
committed
Fixed build errors with cross-clang compiler
1 parent 7305ebc commit 965a397

File tree

5 files changed

+19
-9
lines changed

5 files changed

+19
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ CFLAGS+=$(WOLFPSA_CFLAGS)
180180

181181
# Setup default optimizations (for GCC)
182182
ifeq ($(USE_GCC_HEADLESS),1)
183-
CFLAGS+=-Wall -Wextra -Wno-main -ffreestanding -nostartfiles
183+
CFLAGS+=-Wall -Wextra -Wno-main -ffreestanding
184184
CFLAGS+=-ffunction-sections -fdata-sections -fomit-frame-pointer
185185
# Allow unused parameters and functions
186186
CFLAGS+=-Wno-unused-parameter -Wno-unused-function

arch.mk

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ endif
133133
ifeq ($(ARCH),ARM)
134134
CROSS_COMPILE?=arm-none-eabi-
135135
CFLAGS+=-DARCH_ARM
136-
CFLAGS+=-mthumb -mlittle-endian -mthumb-interwork
137-
LDFLAGS+=-mthumb -mlittle-endian -mthumb-interwork
136+
CFLAGS+=-mthumb -mlittle-endian
137+
LDFLAGS+=-mthumb -mlittle-endian
138+
ifeq ($(USE_GCC),1)
139+
CFLAGS+=-mthumb-interwork
140+
LDFLAGS+=-mthumb-interwork
141+
endif
138142

139143
## Target specific configuration
140144
ifeq ($(TARGET),samr21)

include/wolfboot/wolfboot.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ extern "C" {
4646
#ifndef RAMFUNCTION
4747
# if defined(__WOLFBOOT) && defined(RAM_CODE)
4848
# if defined(ARCH_ARM)
49-
# define RAMFUNCTION __attribute__((used,section(".ramcode"),long_call))
49+
# if defined(__clang__)
50+
# define RAMFUNCTION __attribute__((used,section(".ramcode")))
51+
# else
52+
# define RAMFUNCTION __attribute__((used,section(".ramcode"),long_call))
53+
# endif
5054
# else
5155
# define RAMFUNCTION __attribute__((used,section(".ramcode")))
5256
# endif

options.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,9 +1016,11 @@ CFLAGS+=$(CFLAGS_EXTRA)
10161016
OBJS+=$(OBJS_EXTRA)
10171017

10181018
ifeq ($(USE_GCC_HEADLESS),1)
1019-
ifneq ($(ARCH),RENESAS_RX)
1020-
ifneq ($(ARCH),AURIX_TC3)
1021-
CFLAGS+="-Wstack-usage=$(STACK_USAGE)"
1019+
ifeq ($(USE_GCC),1)
1020+
ifneq ($(ARCH),RENESAS_RX)
1021+
ifneq ($(ARCH),AURIX_TC3)
1022+
CFLAGS+="-Wstack-usage=$(STACK_USAGE)"
1023+
endif
10221024
endif
10231025
endif
10241026
endif

src/update_flash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ static int wolfBoot_delta_update(struct wolfBoot_image *boot,
712712

713713

714714
#ifdef WOLFBOOT_ARMORED
715-
# ifdef __GNUC__
715+
# if defined(__GNUC__) && !defined(__clang__)
716716
# pragma GCC push_options
717717
# pragma GCC optimize("O0")
718718
# elif defined(__IAR_SYSTEMS_ICC__)
@@ -1421,7 +1421,7 @@ void RAMFUNCTION wolfBoot_start(void)
14211421
}
14221422

14231423
#ifdef WOLFBOOT_ARMORED
1424-
# ifdef __GNUC__
1424+
# if defined(__GNUC__) && !defined(__clang__)
14251425
# pragma GCC pop_options
14261426
# elif defined(__IAR_SYSTEMS_ICC__)
14271427
# pragma optimize=default

0 commit comments

Comments
 (0)