Skip to content

Commit ff36fc7

Browse files
vanwinkeljangalak
authored andcommitted
linker: cxx: Include .gcc_except_table sections
Include .gcc_except_table (sub-)sections in linker files to support C++ with exceptions enabled. If these sections are not mapped warnings will be generated for orphaned sections at link time. Signed-off-by: Jan Van Winkel <[email protected]>
1 parent 70fb574 commit ff36fc7

File tree

10 files changed

+53
-1
lines changed

10 files changed

+53
-1
lines changed

include/arch/arc/v2/linker.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ SECTIONS {
132132

133133
} GROUP_LINK_IN(ROMABLE_REGION)
134134

135+
#include <linker/cplusplus-rom.ld>
136+
135137
_image_rodata_end = .;
136138
MPU_ALIGN(_image_rodata_end - _image_rom_start);
137139
_image_rom_end = .;
@@ -227,6 +229,7 @@ SECTIONS {
227229

228230
#include <linker/common-ram.ld>
229231
#include <linker/kobject.ld>
232+
#include <linker/cplusplus-ram.ld>
230233

231234
__data_ram_end = .;
232235

include/arch/arm/cortex_m/scripts/linker.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ SECTIONS
273273
. = ALIGN(4);
274274
} GROUP_LINK_IN(ROMABLE_REGION)
275275

276+
#include <linker/cplusplus-rom.ld>
277+
276278
_image_rodata_end = .;
277279
MPU_ALIGN(_image_rodata_end -_image_rom_start);
278280
_image_rom_end = .;
@@ -411,6 +413,7 @@ SECTIONS
411413
#include <linker/kobject.ld>
412414

413415
#include <linker/priv_stacks-noinit.ld>
416+
#include <linker/cplusplus-ram.ld>
414417

415418
__data_ram_end = .;
416419

include/arch/arm/cortex_r/scripts/linker.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ SECTIONS
272272
. = ALIGN(4);
273273
} GROUP_LINK_IN(ROMABLE_REGION)
274274

275+
#include <linker/cplusplus-rom.ld>
276+
275277
_image_rodata_end = .;
276278
MPU_ALIGN(_image_rodata_end -_image_rom_start);
277279
_image_rom_end = .;
@@ -412,6 +414,8 @@ SECTIONS
412414

413415
#include <linker/priv_stacks-noinit.ld>
414416

417+
#include <linker/cplusplus-ram.ld>
418+
415419
__data_ram_end = .;
416420

417421

include/arch/nios2/linker.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ SECTIONS
163163
. = ALIGN(4);
164164
} GROUP_LINK_IN(ROMABLE_REGION)
165165

166+
#include <linker/cplusplus-rom.ld>
167+
166168
_image_rom_end = .;
167169
__data_rom_start = ALIGN(4); /* XIP imaged DATA ROM start addr */
168170

@@ -280,6 +282,8 @@ SECTIONS
280282

281283
} GROUP_LINK_IN(RAMABLE_REGION)
282284

285+
#include <linker/cplusplus-ram.ld>
286+
283287
/* Define linker symbols */
284288
_image_ram_end = .;
285289
_end = .; /* end of image */

include/arch/riscv/common/linker.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ SECTIONS
120120

121121
} GROUP_LINK_IN(ROMABLE_REGION)
122122

123+
#include <linker/cplusplus-rom.ld>
124+
123125
_image_rom_end = .;
124126
__data_rom_start = .;
125127

@@ -196,6 +198,8 @@ SECTIONS
196198

197199
} GROUP_LINK_IN(RAMABLE_REGION)
198200

201+
#include <linker/cplusplus-ram.ld>
202+
199203
_image_ram_end = .;
200204
_end = .; /* end of image */
201205

include/arch/x86/ia32/linker.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ SECTIONS
160160
#include <linker/kobject-rom.ld>
161161
} GROUP_LINK_IN(ROMABLE_REGION)
162162

163+
#include <linker/cplusplus-rom.ld>
164+
163165
MMU_PAGE_ALIGN
164166
/* ROM ends here, position counter will now be in RAM areas */
165167
_image_rom_end = .;
@@ -348,6 +350,7 @@ SECTIONS
348350
#include <linker/common-ram.ld>
349351

350352
#include <linker/kobject.ld>
353+
#include <linker/cplusplus-ram.ld>
351354

352355
MMU_PAGE_ALIGN
353356
__data_ram_end = .;

include/arch/x86/intel64/linker.ld

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ SECTIONS
5454
#include <custom-rodata.ld>
5555
#endif /* CONFIG_CUSTOM_RODATA_LD */
5656

57+
} GROUP_LINK_IN(ROMABLE_REGION)
58+
59+
#include <linker/cplusplus-rom.ld>
60+
5761
_image_rodata_end = .;
5862
_image_rodata_size = _image_rodata_end - _image_rodata_start;
59-
} GROUP_LINK_IN(ROMABLE_REGION)
6063

6164
SECTION_PROLOGUE(_DATA_SECTION_NAME,,ALIGN(16))
6265
{
@@ -70,6 +73,7 @@ SECTIONS
7073

7174
#include <snippets-ram-sections.ld>
7275
#include <linker/common-ram.ld>
76+
#include <linker/cplusplus-ram.ld>
7377

7478
SECTION_PROLOGUE(_BSS_SECTION_NAME, (NOLOAD), ALIGN(16))
7579
{

include/linker/cplusplus-ram.ld

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2019 Jan Van Winkel <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#if defined (CONFIG_CPLUSPLUS)
8+
SECTION_PROLOGUE(.gcc_except_table,,ONLY_IF_RW)
9+
{
10+
*(.gcc_except_table .gcc_except_table.*)
11+
} GROUP_LINK_IN(RAMABLE_REGION)
12+
#endif

include/linker/cplusplus-rom.ld

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2019 Jan Van Winkel <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#if defined (CONFIG_CPLUSPLUS)
8+
SECTION_PROLOGUE(.gcc_except_table,,ONLY_IF_RO)
9+
{
10+
*(.gcc_except_table .gcc_except_table.*)
11+
} GROUP_LINK_IN(ROMABLE_REGION)
12+
#endif

soc/riscv/openisa_rv32m1/linker.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ SECTIONS
163163

164164
} GROUP_LINK_IN(ROMABLE_REGION)
165165

166+
#include <linker/cplusplus-rom.ld>
167+
166168
_image_rodata_end = .;
167169
_image_rom_end = .;
168170

@@ -202,6 +204,7 @@ SECTIONS
202204
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
203205

204206
#include <linker/common-ram.ld>
207+
#include <linker/cplusplus-ram.ld>
205208

206209
__data_ram_end = .;
207210
__data_rom_start = LOADADDR(_DATA_SECTION_NAME);

0 commit comments

Comments
 (0)