Skip to content

Commit

Permalink
[buildmgr] Fix legacy assembly defines
Browse files Browse the repository at this point in the history
  • Loading branch information
grasci-arm authored May 6, 2022
1 parent c66815b commit 48fb5c6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 43 deletions.
21 changes: 9 additions & 12 deletions tools/buildmgr/cbuildgen/config/AC5.5.6.7.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ endif()
set(ASM_CPU ${ARMASM_CPU})
set(ASM_FLAGS)

foreach(DEFINE ${DEFINES})
string(REPLACE "\"" "\\\"" ENTRY ${DEFINE})
string(REGEX REPLACE "=.*" "" KEY ${ENTRY})
if (KEY STREQUAL ENTRY)
set(VALUE "1")
else()
string(REGEX REPLACE ".*=" "" VALUE ${ENTRY})
endif()
string(APPEND ASM_DEFINES "--pd \"${KEY} SETA ${VALUE}\" ")
endforeach()

function(cbuild_set_defines lang defines)
set(TMP_DEFINES)
foreach(DEFINE ${${defines}})
Expand All @@ -72,14 +61,22 @@ function(cbuild_set_defines lang defines)
string(REGEX REPLACE ".*=" "" VALUE ${ENTRY})
endif()
if(${lang} STREQUAL "ASM")
string(APPEND TMP_DEFINES "--pd \"${KEY} SETA ${VALUE}\" ")
if (VALUE MATCHES "^[0-9]+$")
set(SETX "SETA")
else()
set(SETX "SETS")
endif()
string(APPEND TMP_DEFINES "--pd \"${KEY} ${SETX} ${VALUE}\" ")
else()
string(APPEND TMP_DEFINES "-D${ENTRY} ")
endif()
endforeach()
set(${defines} ${TMP_DEFINES} PARENT_SCOPE)
endfunction()

set(ASM_DEFINES ${DEFINES})
cbuild_set_defines(ASM ASM_DEFINES)

if(BYTE_ORDER STREQUAL "Little-endian")
set(ASM_BYTE_ORDER "--littleend")
elseif(BYTE_ORDER STREQUAL "Big-endian")
Expand Down
38 changes: 20 additions & 18 deletions tools/buildmgr/cbuildgen/config/AC6.6.18.0.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -350,20 +350,6 @@ set(AS_ARM_FLAGS "--target=arm-arm-none-eabi -c")
set(AS_GNU_FLAGS "--target=arm-arm-none-eabi -c")
set(ASM_FLAGS "--target=arm-arm-none-eabi -c")

foreach(DEFINE ${DEFINES})
string(REPLACE "\"" "\\\"" ENTRY ${DEFINE})
string(REGEX REPLACE "=.*" "" KEY ${ENTRY})
if (KEY STREQUAL ENTRY)
set(VALUE "1")
else()
string(REGEX REPLACE ".*=" "" VALUE ${ENTRY})
endif()
string(APPEND AS_LEG_DEFINES "--pd \"${KEY} SETA ${VALUE}\" ")
string(APPEND AS_ARM_DEFINES "-Wa,armasm,--pd,\"${KEY} SETA ${VALUE}\" ")
string(APPEND AS_GNU_DEFINES "-Wa,-defsym,\"${KEY}=${VALUE}\" ")
string(APPEND ASM_DEFINES "-D${ENTRY} ")
endforeach()

function(cbuild_set_defines lang defines)
set(TMP_DEFINES)
foreach(DEFINE ${${defines}})
Expand All @@ -374,10 +360,17 @@ function(cbuild_set_defines lang defines)
else()
string(REGEX REPLACE ".*=" "" VALUE ${ENTRY})
endif()
if(${lang} STREQUAL "AS_LEG")
string(APPEND TMP_DEFINES "--pd \"${KEY} SETA ${VALUE}\" ")
elseif(${lang} STREQUAL "AS_ARM")
string(APPEND TMP_DEFINES "-Wa,armasm,--pd,\"${KEY} SETA ${VALUE}\" ")
if(${lang} STREQUAL "AS_LEG" OR ${lang} STREQUAL "AS_ARM")
if (VALUE MATCHES "^[0-9]+$")
set(SETX "SETA")
else()
set(SETX "SETS")
endif()
if(${lang} STREQUAL "AS_LEG")
string(APPEND TMP_DEFINES "--pd \"${KEY} ${SETX} ${VALUE}\" ")
elseif(${lang} STREQUAL "AS_ARM")
string(APPEND TMP_DEFINES "-Wa,armasm,--pd,\"${KEY} ${SETX} ${VALUE}\" ")
endif()
elseif(${lang} STREQUAL "AS_GNU")
string(APPEND TMP_DEFINES "-Wa,-defsym,\"${KEY}=${VALUE}\" ")
else()
Expand All @@ -387,6 +380,15 @@ function(cbuild_set_defines lang defines)
set(${defines} ${TMP_DEFINES} PARENT_SCOPE)
endfunction()

set(AS_LEG_DEFINES ${DEFINES})
cbuild_set_defines(AS_LEG AS_LEG_DEFINES)
set(AS_ARM_DEFINES ${DEFINES})
cbuild_set_defines(AS_ARM AS_ARM_DEFINES)
set(AS_GNU_DEFINES ${DEFINES})
cbuild_set_defines(AS_GNU AS_GNU_DEFINES)
set(ASM_DEFINES ${DEFINES})
cbuild_set_defines(ASM ASM_DEFINES)

if(BYTE_ORDER STREQUAL "Little-endian")
set(AS_LEG_BYTE_ORDER "--littleend")
set(ASM_BYTE_ORDER "-mlittle-endian")
Expand Down
20 changes: 7 additions & 13 deletions tools/buildmgr/cbuildgen/config/GCC.10.2.1.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,6 @@ set(AS_LEG_FLAGS)
set(AS_GNU_FLAGS "-c")
set(ASM_FLAGS "-c")

foreach(DEFINE ${DEFINES})
string(REPLACE "\"" "\\\"" ENTRY ${DEFINE})
string(REGEX REPLACE "=.*" "" KEY ${ENTRY})
if (KEY STREQUAL ENTRY)
set(VALUE "1")
else()
string(REGEX REPLACE ".*=" "" VALUE ${ENTRY})
endif()
string(APPEND AS_LEG_DEFINES "--defsym ${KEY}=${VALUE} ")
string(APPEND AS_GNU_DEFINES "-Wa,-defsym,\"${KEY}=${VALUE}\" ")
string(APPEND ASM_DEFINES "-D${ENTRY} ")
endforeach()

function(cbuild_set_defines lang defines)
set(TMP_DEFINES)
foreach(DEFINE ${${defines}})
Expand All @@ -137,6 +124,13 @@ function(cbuild_set_defines lang defines)
set(${defines} ${TMP_DEFINES} PARENT_SCOPE)
endfunction()

set(AS_LEG_DEFINES ${DEFINES})
cbuild_set_defines(AS_LEG AS_LEG_DEFINES)
set(AS_GNU_DEFINES ${DEFINES})
cbuild_set_defines(AS_GNU AS_GNU_DEFINES)
set(ASM_DEFINES ${DEFINES})
cbuild_set_defines(ASM ASM_DEFINES)

if(BYTE_ORDER STREQUAL "Little-endian")
set(ASM_BYTE_ORDER "-mlittle-endian")
elseif(BYTE_ORDER STREQUAL "Big-endian")
Expand Down

0 comments on commit 48fb5c6

Please sign in to comment.