[coreboot-gerrit] Change in coreboot[master]: arch/riscv: Adjust compiler flags for scan-build

Jonathan Neuschäfer (Code Review) gerrit at coreboot.org
Sat Sep 22 18:43:49 CEST 2018


Jonathan Neuschäfer has uploaded this change for review. ( https://review.coreboot.org/28713


Change subject: arch/riscv: Adjust compiler flags for scan-build
......................................................................

arch/riscv: Adjust compiler flags for scan-build

Clang doesn't understand -march=riscv64imac and -mcmodel=medany, so
don't use them when running the clang static analyzer. On the other
hand, __riscv and __riscv_xlen need to be defined in order to select
some macros in src/arch/riscv/include/arch/encoding.h. -mabi is moved
-march for consistency.

With this commit, scan-build produces a useful result on RISC-V.

Change-Id: Ia2eb8c3c2f7eb5ddd47db24b8e5fcd6eaf6c5589
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
---
M src/arch/riscv/Makefile.inc
1 file changed, 6 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/28713/1

diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc
index 50c1ae6..1728bfb 100644
--- a/src/arch/riscv/Makefile.inc
+++ b/src/arch/riscv/Makefile.inc
@@ -25,7 +25,12 @@
 check-ramstage-overlap-regions += stack
 endif
 
-riscv_flags = -I$(src)/arch/riscv/ -mcmodel=$(CONFIG_RISCV_CODEMODEL) -march=$(CONFIG_RISCV_ARCH) -mabi=$(CONFIG_RISCV_ABI)
+riscv_flags = -I$(src)/arch/riscv/
+ifeq ($(CCC_ANALYZER_OUTPUT_FORMAT),)
+riscv_flags += -march=$(CONFIG_RISCV_ARCH) -mabi=$(CONFIG_RISCV_ABI) -mcmodel=$(CONFIG_RISCV_CODEMODEL)
+else
+riscv_flags += -D__riscv -D__riscv_xlen=64
+endif
 
 riscv_asm_flags = -march=$(CONFIG_RISCV_ARCH) -mabi=$(CONFIG_RISCV_ABI)
 

-- 
To view, visit https://review.coreboot.org/28713
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2eb8c3c2f7eb5ddd47db24b8e5fcd6eaf6c5589
Gerrit-Change-Number: 28713
Gerrit-PatchSet: 1
Gerrit-Owner: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180922/fd8c18b4/attachment.html>


More information about the coreboot-gerrit mailing list