delocate: replace "-as src1,src2,..." with "src1 src2 ...".

Not requiring the list of assembly sources to be comma-separated is
helpful to environments where the list would more naturally be
treated as a list.

Change-Id: I43b18cdbeed1dc7ad217ff61557ac55860f40733
Reviewed-on: https://boringssl-review.googlesource.com/15585
Reviewed-by: Matt Braithwaite <mab@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
Matthew Braithwaite 2017-04-26 15:04:48 -07:00 committed by CQ bot account: commit-bot@chromium.org
parent afd88c27f2
commit fb383f0c3d
2 changed files with 11 additions and 17 deletions

View File

@ -111,26 +111,22 @@ if(FIPS)
bcm.c
)
SET_TARGET_PROPERTIES(bcm_c_generated_asm PROPERTIES COMPILE_OPTIONS "-S")
SET_TARGET_PROPERTIES(bcm_c_generated_asm PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(bcm_c_generated_asm PROPERTIES COMPILE_OPTIONS "-S")
set_target_properties(bcm_c_generated_asm PROPERTIES POSITION_INDEPENDENT_CODE ON)
function(JOIN VALUES GLUE OUTPUT)
string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
function(prepend_path values prefix output)
set(result)
foreach(value ${values})
list(APPEND result "${prefix}/${value}")
endforeach(value)
set(${output} ${result} PARENT_SCOPE)
endfunction()
set(DELOCATE_AS_FLAG)
set(DELOCATE_AS_ARG)
if(NOT "${BCM_ASM_SOURCES}" STREQUAL "")
set(DELOCATE_AS_FLAG "-as")
JOIN("${BCM_ASM_SOURCES}" ",${CMAKE_CURRENT_BINARY_DIR}/" BCM_ASM_SOURCES_COMMA_SEP)
SET(DELOCATE_AS_ARG "${CMAKE_CURRENT_BINARY_DIR}/${BCM_ASM_SOURCES_COMMA_SEP}")
endif()
prepend_path("${BCM_ASM_SOURCES}" "${CMAKE_CURRENT_BINARY_DIR}" DELOCATE_ASM_ARGS)
add_custom_command(
OUTPUT bcm-delocated.S
COMMAND ${GO_EXECUTABLE} run crypto/fipsmodule/delocate.go crypto/fipsmodule/ar.go crypto/fipsmodule/const.go -a $<TARGET_FILE:bcm_c_generated_asm> ${DELOCATE_AS_FLAG} ${DELOCATE_AS_ARG} -o ${CMAKE_CURRENT_BINARY_DIR}/bcm-delocated.S
COMMAND ${GO_EXECUTABLE} run crypto/fipsmodule/delocate.go crypto/fipsmodule/ar.go crypto/fipsmodule/const.go -a $<TARGET_FILE:bcm_c_generated_asm> -o ${CMAKE_CURRENT_BINARY_DIR}/bcm-delocated.S ${DELOCATE_ASM_ARGS}
DEPENDS bcm_c_generated_asm ${BCM_ASM_SOURCES} delocate.go ar.go const.go
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

View File

@ -36,7 +36,6 @@ func main() {
arInput := flag.String("a", "", "Path to a .a file containing assembly sources")
outFile := flag.String("o", "", "Path to output assembly")
asmFiles := flag.String("as", "", "Comma separated list of assembly inputs")
flag.Parse()
@ -48,8 +47,7 @@ func main() {
}
}
asPaths := strings.Split(*asmFiles, ",")
for i, path := range asPaths {
for i, path := range flag.Args() {
if len(path) == 0 {
continue
}