Skip to content

Commit 6fbacaa

Browse files
committed
Added explicit discard list for clang compiler
1 parent cb69bb9 commit 6fbacaa

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

arch.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,9 @@ ifeq ($(USE_CLANG),1)
12931293
CFLAGS+=-isystem $(CLANG_NEWLIB_INCLUDE)
12941294
CFLAGS+=-DWOLFSSL_NO_ATOMIC -DWOLFSSL_NO_ATOMICS
12951295
CFLAGS+=-Wno-unknown-attributes -Wno-error=unknown-attributes
1296+
CFLAGS+=-fno-unwind-tables -fno-asynchronous-unwind-tables
12961297
LDFLAGS+=-nostdlib
1298+
LSCRIPT_FLAGS+=-T hal/clang-discard.ld
12971299
endif
12981300

12991301
ifeq ($(USE_GCC),1)

hal/clang-discard.ld

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
SECTIONS
2+
{
3+
/DISCARD/ :
4+
{
5+
*(.ARM.extab* .gnu.linkonce.armextab.*)
6+
*(.eh_frame* .gcc_except_table*)
7+
*(.preinit_array*)
8+
*(.init_array*)
9+
*(.fini_array*)
10+
*(.ctors*)
11+
*(.dtors*)
12+
*(.jcr*)
13+
}
14+
}

hal/stm32l4.ld

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ SECTIONS
1515
. = ALIGN(4);
1616
_end_text = .;
1717
} > FLASH
18+
1819
.edidx :
1920
{
2021
. = ALIGN(4);

test-app/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ ifeq ($(USE_CLANG),1)
109109
# objcopy output then expands the flash-to-RAM gap into a huge sparse image.
110110
# The app image only needs the flash-backed output sections.
111111
OBJCOPY_IMAGE_FLAGS+=-j .text -j .edidx
112+
LDFLAGS+=-T ../hal/clang-discard.ld
112113
endif
113114

114115
ifeq ($(DEBUG_UART),1)

0 commit comments

Comments
 (0)