[coreboot-gerrit] New patch to review for coreboot: c3ddbbd do not submit: attempting to fsp_util.c optimization for clang

Martin Roth (gaumless@gmail.com) gerrit at coreboot.org
Wed Nov 19 04:56:24 CET 2014


Martin Roth (gaumless at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7521

-gerrit

commit c3ddbbd5e883668a8b691b9dab84684b603dae80
Author: Martin Roth <martin.roth at se-eng.com>
Date:   Tue Nov 18 20:55:48 2014 -0700

    do not submit: attempting to fsp_util.c optimization for clang
    
    clang doesn't recognize the __attribute__((optimize("O0"))) attribute
    that we use for find_fsp(), so I tried to replace it with something
    that clang did recognize.  Unfortunately, neither the pragma or the
    attribute seem to be understood by the copy of clang that I have
    installed:
    
    src/drivers/intel/fsp/fsp_util.c:107:15: warning: unknown pragma ignored [-Wunknown-pragmas]
                  ^
    src/drivers/intel/fsp/fsp_util.c:108:30: warning: unknown attribute 'optnone' ignored [-Wattributes]
    volatile u8 * __attribute__((optnone)) find_fsp ()
                                 ^
    src/drivers/intel/fsp/fsp_util.c:185:15: warning: unknown pragma ignored [-Wunknown-pragmas]
    
    clang version 3.4.2 (tags/RELEASE_34/dot2-final)
    Target: x86_64-redhat-linux-gnu
    Thread model: posix
    
    suggestions?
    
    Change-Id: I6075d6bee56b5180cf7ed360c1a8b917edec1b04
    Signed-off-by: Martin Roth <martin.roth at se-eng.com>
---
 src/drivers/intel/fsp/fsp_util.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/drivers/intel/fsp/fsp_util.c b/src/drivers/intel/fsp/fsp_util.c
index e15c82e..756d842 100644
--- a/src/drivers/intel/fsp/fsp_util.c
+++ b/src/drivers/intel/fsp/fsp_util.c
@@ -103,7 +103,12 @@ void __attribute__ ((noreturn)) fsp_early_init (FSP_INFO_HEADER *fsp_ptr)
 }
 #endif	/* __PRE_RAM__ */
 
+#if CONFIG_COMPILER_LLVM_CLANG
+#pragma clang optimize off
+volatile u8 * __attribute__((optnone)) find_fsp ()
+#else
 volatile u8 * __attribute__((optimize("O0"))) find_fsp ()
+#endif
 {
 
 #ifdef __PRE_RAM__
@@ -177,6 +182,10 @@ volatile u8 * __attribute__((optimize("O0"))) find_fsp ()
 	return (fsp_ptr);
 }
 
+#if CONFIG_COMPILER_LLVM_CLANG
+#pragma clang optimize on
+#endif
+
 #ifndef __PRE_RAM__ /* Only parse HOB data in ramstage */
 
 void print_fsp_info(void) {



More information about the coreboot-gerrit mailing list