[SLOF] FLAG is not passed correctly to the compiler

Murilo Opsfelder Araújo muriloo at linux.vnet.ibm.com
Fri Jun 23 06:05:51 AEST 2017


Hello, everyone.

The FLAG variable defined in board-qemu/config passes "-DRTAS_NVRAM -DBROKEN_SC1 -DDHCPARCH=0x0C " (with the quotes) to gcc, which ends up ignoring some macro definitions (only the first RTAS_NVRAM is defined).

This is a simple example to mimic this behaviour:

$ cat test.c
#include <stdio.h>
int main(void)
{
#ifdef FOO
  printf("FOO defined\n");
#endif
#ifdef BAR
  printf("BAR defined\n");
#endif
  return 0;
}

$ gcc "-DFOO -DBAR" -o test test.c
$ ./test                          
FOO defined

Note that only the first macro FOO was defined.

When quotes are removed, then both FOO and BAR macros are defined (the expected behaviour):

$ gcc -DFOO -DBAR -o test test.c  
$ ./test                        
FOO defined
BAR defined

I'm afraid that the FLAG content passed to compiler is not taking the desired effect.

My suggestion is that we split FLAG in different variables, each one containing just one definition, and replace $(FLAG) with the new variables.

Thoughts?

-- 
Murilo



More information about the SLOF mailing list