Skip to content

Commit 5ab714e

Browse files
kjbraceyArto Kinnunen
authored andcommitted
ARM linker: add --any_contingency option
When packing data into multiple regions using the `.ANY` directive, the linker can accidentally overfill an area. This doesn't normally happen because it defaults to `--any_placement=worst_fit`, which puts data in the region with most space. When we prioritise regions with `.ANY1`/`.ANY2`, it may totally fill an area, then fail to leave enough space for linker-generated veneers. We've just seen this error with the new K64F linker map. Adding `--any-contingency` makes it lower priority when a region is 98% full, avoiding this error. The option should not have any effect on targets with scatter files without prioritised `.ANY` directives.
1 parent 810cb8d commit 5ab714e

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

tools/profiles/debug.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"asm": [],
2727
"c": ["-D__ASSERT_MSG", "-std=gnu11"],
2828
"cxx": ["-fno-rtti", "-std=gnu++14"],
29-
"ld": ["--verbose", "--remove", "--show_full_path", "--legacyalign", "--keep=os_cb_sections"]
29+
"ld": ["--verbose", "--remove", "--show_full_path", "--legacyalign",
30+
"--any_contingency", "--keep=os_cb_sections"]
3031
},
3132
"ARM": {
3233
"common": ["-c", "--gnu", "-Otime", "--split_sections",
@@ -36,7 +37,7 @@
3637
"asm": [],
3738
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
3839
"cxx": ["--cpp11", "--no_rtti", "--no_vla"],
39-
"ld": ["--show_full_path", "--keep=os_cb_sections"]
40+
"ld": ["--show_full_path", "--any_contingency", "--keep=os_cb_sections"]
4041
},
4142
"uARM": {
4243
"common": ["-c", "--gnu", "-Otime", "--split_sections",

tools/profiles/develop.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"asm": [],
2525
"c": ["-D__ASSERT_MSG", "-std=gnu11"],
2626
"cxx": ["-fno-rtti", "-std=gnu++14"],
27-
"ld": ["--show_full_path", "--legacyalign", "--keep=os_cb_sections"]
27+
"ld": ["--show_full_path", "--legacyalign", "--any_contingency",
28+
"--keep=os_cb_sections"]
2829
},
2930
"ARM": {
3031
"common": ["-c", "--gnu", "-Otime", "--split_sections",
@@ -33,7 +34,7 @@
3334
"asm": [],
3435
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
3536
"cxx": ["--cpp11", "--no_rtti", "--no_vla"],
36-
"ld": ["--show_full_path", "--keep=os_cb_sections"]
37+
"ld": ["--show_full_path", "--any_contingency", "--keep=os_cb_sections"]
3738
},
3839
"uARM": {
3940
"common": ["-c", "--gnu", "-Otime", "--split_sections",

tools/profiles/release.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"asm": [],
2525
"c": ["-D__ASSERT_MSG", "-std=gnu11"],
2626
"cxx": ["-fno-rtti", "-std=gnu++14"],
27-
"ld": ["--show_full_path", "--legacyalign", "--keep=os_cb_sections"]
27+
"ld": ["--show_full_path", "--legacyalign", "--any_contingency",
28+
"--keep=os_cb_sections"]
2829
},
2930
"ARM": {
3031
"common": ["-c", "--gnu", "-Ospace", "--split_sections",
@@ -33,7 +34,7 @@
3334
"asm": [],
3435
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
3536
"cxx": ["--cpp11", "--no_rtti", "--no_vla"],
36-
"ld": ["--show_full_path", "--keep=os_cb_sections"]
37+
"ld": ["--show_full_path", "--any_contingency", "--keep=os_cb_sections"]
3738
},
3839
"uARM": {
3940
"common": ["-c", "--gnu", "-Ospace", "--split_sections",

0 commit comments

Comments
 (0)