Skip to content

Commit 41bdf2d

Browse files
committed
Added explicit discard list for clang compiler
1 parent cbe55ac commit 41bdf2d

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
@@ -1299,7 +1299,9 @@ ifeq ($(USE_CLANG),1)
12991299
CFLAGS+=-isystem $(CLANG_NEWLIB_INCLUDE)
13001300
CFLAGS+=-DWOLFSSL_NO_ATOMIC -DWOLFSSL_NO_ATOMICS
13011301
CFLAGS+=-Wno-unknown-attributes -Wno-error=unknown-attributes
1302+
CFLAGS+=-fno-unwind-tables -fno-asynchronous-unwind-tables
13021303
LDFLAGS+=-nostdlib
1304+
LSCRIPT_FLAGS+=-T hal/clang-discard.ld
13031305
endif
13041306

13051307
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)