Skip to content

Commit e572e8f

Browse files
RobinKastbergdkalowsk
authored andcommitted
iar: linker_script: fix bug with alphabetical order
Having alphabetical order on an init block causes a linker error. So it is one of the things replaced when translating a block to its corresponding init block. The recent changes in ff8b24b caused iterable sections having ONLY alphabetical order as an attribute, triggering a bug in this regexp. Signed-off-by: Robin Kastberg <[email protected]>
1 parent 1fb59d4 commit e572e8f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmake/linker/iar/config_file_script.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,12 @@ function(section_to_string)
832832
string(REGEX REPLACE "(block[ \t\r\n]+)([^ \t\r\n]+)" "\\1\\2_init" INIT_TEMP "${TEMP}")
833833
string(REGEX REPLACE "(rw)([ \t\r\n]+)(section[ \t\r\n]+)([^ \t\r\n,]+)" "\\1\\2\\3\\4_init" INIT_TEMP "${INIT_TEMP}")
834834
string(REGEX REPLACE "(rw)([ \t\r\n]+)(section[ \t\r\n]+)" "ro\\2\\3" INIT_TEMP "${INIT_TEMP}")
835-
string(REGEX REPLACE "alphabetical order, " "" INIT_TEMP "${INIT_TEMP}")
835+
836+
# No alphabetical orders on initializers
837+
# Only alphabetical attribute.
838+
string(REGEX REPLACE "with alphabetical order {" " {" INIT_TEMP "${INIT_TEMP}")
839+
# Respect other attributes.
840+
string(REGEX REPLACE "(, alphabetical order|alphabetical order, )" "" INIT_TEMP "${INIT_TEMP}")
836841
string(REGEX REPLACE "{ readwrite }" "{ }" INIT_TEMP "${INIT_TEMP}")
837842
set(TEMP "${TEMP}\n${INIT_TEMP}\n")
838843

0 commit comments

Comments
 (0)