Skip to content

Commit 9fcaf30

Browse files
committed
[zep noup] platform: Add picolibc init and heap symbols to linker scripts
Picolibc uses different names for the list of constructors and heap limits. Add values for __bothinit_array_start, __bothinit_array_end, __heap_start and __heap_end to every linker script. If not using picolibc, these will not have any effect. Signed-off-by: Keith Packard <[email protected]>
1 parent 3922c78 commit 9fcaf30

File tree

31 files changed

+130
-0
lines changed

31 files changed

+130
-0
lines changed

platform/ext/common/gcc/tfm_common_bl2.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ SECTIONS
6060
. = ALIGN(4);
6161
/* preinit data */
6262
PROVIDE_HIDDEN (__preinit_array_start = .);
63+
PROVIDE(__bothinit_array_start = __preinit_array_start);
6364
KEEP(*(.preinit_array))
6465
PROVIDE_HIDDEN (__preinit_array_end = .);
6566

@@ -69,6 +70,7 @@ SECTIONS
6970
KEEP(*(SORT(.init_array.*)))
7071
KEEP(*(.init_array))
7172
PROVIDE_HIDDEN (__init_array_end = .);
73+
PROVIDE(__bothinit_array_end = __init_array_end);
7274

7375
. = ALIGN(4);
7476
/* finit data */
@@ -212,8 +214,10 @@ SECTIONS
212214
__end__ = .;
213215
PROVIDE(end = .);
214216
__HeapBase = .;
217+
PROVIDE(__heap_start = __HeapBase);
215218
. += __heap_size__;
216219
__HeapLimit = .;
220+
PROVIDE(__heap_end = __HeapLimit);
217221
__heap_limit = .; /* Add for _sbrk */
218222
} > RAM
219223
Image$$ARM_LIB_HEAP$$ZI$$Limit = ADDR(.heap) + SIZEOF(.heap);

platform/ext/common/gcc/tfm_common_ns.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ SECTIONS
4747
. = ALIGN(4);
4848
/* preinit data */
4949
PROVIDE_HIDDEN (__preinit_array_start = .);
50+
PROVIDE(__bothinit_array_start = __preinit_array_start);
5051
KEEP(*(.preinit_array))
5152
PROVIDE_HIDDEN (__preinit_array_end = .);
5253

@@ -56,6 +57,7 @@ SECTIONS
5657
KEEP(*(SORT(.init_array.*)))
5758
KEEP(*(.init_array))
5859
PROVIDE_HIDDEN (__init_array_end = .);
60+
PROVIDE(__bothinit_array_end = __init_array_end);
5961

6062
. = ALIGN(4);
6163
/* finit data */
@@ -158,8 +160,10 @@ SECTIONS
158160
__end__ = .;
159161
PROVIDE(end = .);
160162
__HeapBase = .;
163+
PROVIDE(__heap_start = __HeapBase);
161164
. += __heap_size__;
162165
__HeapLimit = .;
166+
PROVIDE(__heap_end = __HeapLimit);
163167
__heap_limit = .; /* Add for _sbrk */
164168
} > RAM
165169

platform/ext/common/gcc/tfm_common_s.ld.template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ SECTIONS
228228
. = ALIGN(4);
229229
/* preinit data */
230230
PROVIDE_HIDDEN (__preinit_array_start = .);
231+
PROVIDE(__bothinit_array_start = __preinit_array_start);
231232
KEEP(*(.preinit_array))
232233
PROVIDE_HIDDEN (__preinit_array_end = .);
233234

@@ -237,6 +238,7 @@ SECTIONS
237238
KEEP(*(SORT(.init_array.*)))
238239
KEEP(*(.init_array))
239240
PROVIDE_HIDDEN (__init_array_end = .);
241+
PROVIDE(__bothinit_array_end = __init_array_end);
240242

241243
. = ALIGN(4);
242244
/* finit data */
@@ -412,8 +414,10 @@ SECTIONS
412414
__end__ = .;
413415
PROVIDE(end = .);
414416
__HeapBase = .;
417+
PROVIDE(__heap_start = __HeapBase);
415418
. += __heap_size__;
416419
__HeapLimit = .;
420+
PROVIDE(__heap_end = __HeapLimit);
417421
__heap_limit = .; /* Add for _sbrk */
418422
} > RAM
419423
#endif

platform/ext/common/gcc/tfm_isolation_s.ld.template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ SECTIONS
218218
. = ALIGN(4);
219219
/* preinit data */
220220
PROVIDE_HIDDEN (__preinit_array_start = .);
221+
PROVIDE(__bothinit_array_start = __preinit_array_start);
221222
KEEP(*(.preinit_array))
222223
PROVIDE_HIDDEN (__preinit_array_end = .);
223224

@@ -227,6 +228,7 @@ SECTIONS
227228
KEEP(*(SORT(.init_array.*)))
228229
KEEP(*(.init_array))
229230
PROVIDE_HIDDEN (__init_array_end = .);
231+
PROVIDE(__bothinit_array_end = __init_array_end);
230232

231233
. = ALIGN(4);
232234
/* finit data */
@@ -516,8 +518,10 @@ SECTIONS
516518
__end__ = .;
517519
PROVIDE(end = .);
518520
__HeapBase = .;
521+
PROVIDE(__heap_start = __HeapBase);
519522
. += __heap_size__;
520523
__HeapLimit = .;
524+
PROVIDE(__heap_end = __HeapLimit);
521525
__heap_limit = .; /* Add for _sbrk */
522526
} > RAM
523527
#endif

platform/ext/common/llvm/tfm_common_ns.ldc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ SECTIONS
4242
. = ALIGN(4);
4343
/* preinit data */
4444
PROVIDE_HIDDEN (__preinit_array_start = .);
45+
PROVIDE(__bothinit_array_start = __preinit_array_start);
4546
KEEP(*(.preinit_array))
4647
PROVIDE_HIDDEN (__preinit_array_end = .);
4748

@@ -51,6 +52,7 @@ SECTIONS
5152
KEEP(*(SORT(.init_array.*)))
5253
KEEP(*(.init_array))
5354
PROVIDE_HIDDEN (__init_array_end = .);
55+
PROVIDE(__bothinit_array_end = __init_array_end);
5456

5557
. = ALIGN(4);
5658
/* finit data */

platform/ext/common/llvm/tfm_isolation_s.ld.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ SECTIONS
192192
{
193193
/* preinit data */
194194
PROVIDE_HIDDEN (__preinit_array_start = .);
195+
PROVIDE(__bothinit_array_start = __preinit_array_start);
195196
KEEP(*(.preinit_array))
196197
PROVIDE_HIDDEN (__preinit_array_end = .);
197198

@@ -201,6 +202,7 @@ SECTIONS
201202
KEEP(*(SORT(.init_array.*)))
202203
KEEP(*(.init_array))
203204
PROVIDE_HIDDEN (__init_array_end = .);
205+
PROVIDE(__bothinit_array_end = __init_array_end);
204206

205207
. = ALIGN(4);
206208
/* finit data */

platform/ext/target/adi/max32657/device/gcc/max32657_sla.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ SECTIONS
5050
. = ALIGN(4);
5151
/* preinit data */
5252
PROVIDE_HIDDEN (__preinit_array_start = .);
53+
PROVIDE(__bothinit_array_start = __preinit_array_start);
5354
KEEP(*(.preinit_array))
5455
PROVIDE_HIDDEN (__preinit_array_end = .);
5556

@@ -59,6 +60,7 @@ SECTIONS
5960
KEEP(*(SORT(.init_array.*)))
6061
KEEP(*(.init_array))
6162
PROVIDE_HIDDEN (__init_array_end = .);
63+
PROVIDE(__bothinit_array_end = __init_array_end);
6264

6365
. = ALIGN(4);
6466
/* finit data */
@@ -196,8 +198,10 @@ SECTIONS
196198
__end__ = .;
197199
PROVIDE(end = .);
198200
__HeapBase = .;
201+
PROVIDE(__heap_start = __HeapBase);
199202
. += __heap_size__;
200203
__HeapLimit = .;
204+
PROVIDE(__heap_end = __HeapLimit);
201205
__heap_limit = .; /* Add for _sbrk */
202206
} > RAM
203207
Image$$ARM_LIB_HEAP$$ZI$$Limit = ADDR(.heap) + SIZEOF(.heap);

platform/ext/target/arm/corstone1000/Device/Source/gcc/corstone1000_bl1_1.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ SECTIONS
4747
. = ALIGN(4);
4848
/* preinit data */
4949
PROVIDE_HIDDEN (__preinit_array_start = .);
50+
PROVIDE(__bothinit_array_start = __preinit_array_start);
5051
KEEP(*(.preinit_array))
5152
PROVIDE_HIDDEN (__preinit_array_end = .);
5253

@@ -56,6 +57,7 @@ SECTIONS
5657
KEEP(*(SORT(.init_array.*)))
5758
KEEP(*(.init_array))
5859
PROVIDE_HIDDEN (__init_array_end = .);
60+
PROVIDE(__bothinit_array_end = __init_array_end);
5961

6062
. = ALIGN(4);
6163
/* finit data */
@@ -172,8 +174,10 @@ SECTIONS
172174
__end__ = .;
173175
PROVIDE(end = .);
174176
__HeapBase = .;
177+
PROVIDE(__heap_start = __HeapBase);
175178
. += __heap_size__;
176179
__HeapLimit = .;
180+
PROVIDE(__heap_end = __HeapLimit);
177181
__heap_limit = .; /* Add for _sbrk */
178182
} > RAM
179183
Image$$ARM_LIB_HEAP$$ZI$$Limit = ADDR(.heap) + SIZEOF(.heap);

platform/ext/target/arm/corstone1000/Device/Source/gcc/corstone1000_bl1_2.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ SECTIONS
4747
. = ALIGN(4);
4848
/* preinit data */
4949
PROVIDE_HIDDEN (__preinit_array_start = .);
50+
PROVIDE(__bothinit_array_start = __preinit_array_start);
5051
KEEP(*(.preinit_array))
5152
PROVIDE_HIDDEN (__preinit_array_end = .);
5253

@@ -56,6 +57,7 @@ SECTIONS
5657
KEEP(*(SORT(.init_array.*)))
5758
KEEP(*(.init_array))
5859
PROVIDE_HIDDEN (__init_array_end = .);
60+
PROVIDE(__bothinit_array_end = __init_array_end);
5961

6062
. = ALIGN(4);
6163
/* finit data */
@@ -176,8 +178,10 @@ SECTIONS
176178
__end__ = .;
177179
PROVIDE(end = .);
178180
__HeapBase = .;
181+
PROVIDE(__heap_start = __HeapBase);
179182
. += __heap_size__;
180183
__HeapLimit = .;
184+
PROVIDE(__heap_end = __HeapLimit);
181185
__heap_limit = .; /* Add for _sbrk */
182186
} > RAM
183187
Image$$ARM_LIB_HEAP$$ZI$$Limit = ADDR(.heap) + SIZEOF(.heap);

platform/ext/target/arm/mps4/common/device/source/gcc/mps4_corstone3xx_bl1_1.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ SECTIONS
5050
. = ALIGN(4);
5151
/* preinit data */
5252
PROVIDE_HIDDEN (__preinit_array_start = .);
53+
PROVIDE(__bothinit_array_start = __preinit_array_start);
5354
KEEP(*(.preinit_array))
5455
PROVIDE_HIDDEN (__preinit_array_end = .);
5556

@@ -59,6 +60,7 @@ SECTIONS
5960
KEEP(*(SORT(.init_array.*)))
6061
KEEP(*(.init_array))
6162
PROVIDE_HIDDEN (__init_array_end = .);
63+
PROVIDE(__bothinit_array_end = __init_array_end);
6264

6365
. = ALIGN(4);
6466
/* finit data */
@@ -191,8 +193,10 @@ SECTIONS
191193
__end__ = .;
192194
PROVIDE(end = .);
193195
__HeapBase = .;
196+
PROVIDE(__heap_start = __HeapBase);
194197
. += __heap_size__;
195198
__HeapLimit = .;
199+
PROVIDE(__heap_end = __HeapLimit);
196200
__heap_limit = .; /* Add for _sbrk */
197201
} > RAM
198202
Image$$ARM_LIB_HEAP$$ZI$$Limit = ADDR(.heap) + SIZEOF(.heap);

0 commit comments

Comments
 (0)