x86: Revise CFLAGS and LDFLAGS for LLVM Clang compatibility

This patch slightly revises CFLAGS and LDFLAGS to specify the
optimization and debugging options and linker script in a way that is
compatible with using Clang as the C compiler and to invoke the linker
(i.e. CC = clang and LD = clang).
This commit is contained in:
Michael LeMay 2015-07-29 07:28:13 -07:00 committed by Jesus Sanchez-Palencia
parent 128d9f3566
commit 0dcd5e9b5a
3 changed files with 15 additions and 6 deletions

View file

@ -16,5 +16,9 @@ ifeq ($(BUILD_RELEASE),1)
CFLAGS += -Os -fno-strict-aliasing CFLAGS += -Os -fno-strict-aliasing
LDFLAGS += -Wl,--strip-all LDFLAGS += -Wl,--strip-all
else else
CFLAGS += -Og -ggdb3 ifeq ($(findstring clang,$(CC)),clang)
CFLAGS += -O0 -g
else
CFLAGS += -Og -ggdb3
endif
endif endif

View file

@ -5,5 +5,5 @@ CONTIKI_CPU_DIRS += drivers/legacy_pc drivers/quarkX1000 init/legacy_pc
CONTIKI_SOURCEFILES += bootstrap_quarkX1000.S rtc.c pit.c pic.c irq.c nmi.c pci.c uart-16x50.c uart.c CONTIKI_SOURCEFILES += bootstrap_quarkX1000.S rtc.c pit.c pic.c irq.c nmi.c pci.c uart-16x50.c uart.c
CFLAGS += -m32 -march=i586 -mtune=i586 CFLAGS += -m32 -march=i586 -mtune=i586
LDFLAGS += -m32 -T $(CONTIKI)/cpu/x86/quarkX1000.ld LDFLAGS += -m32 -Xlinker -T -Xlinker $(CONTIKI)/cpu/x86/quarkX1000.ld
ASFLAGS += --32 -march=i586 -mtune=i586 ASFLAGS += --32 -march=i586 -mtune=i586

View file

@ -48,9 +48,14 @@ command:
$ ./platform/galileo/bsp/libc/build_newlib.sh $ ./platform/galileo/bsp/libc/build_newlib.sh
``` ```
Once newlib is built, you are ready to build applications. To build Once newlib is built, you are ready to build applications. By default, the
applications for Galileo platform you should set TARGET variable to 'galileo'. following steps will use gcc as the C compiler and to invoke the linker. To
For instance, building the hello-world application should look like this: use LLVM clang instead, change the values for both the CC and LD variables in
cpu/x86/Makefile.x86_common to 'clang'.
To build applications for the Galileo platform you should set the TARGET
variable to 'galileo'. For instance, building the hello-world application
should look like this:
``` ```
$ cd examples/hello-world/ && make TARGET=galileo $ cd examples/hello-world/ && make TARGET=galileo
``` ```
@ -125,7 +130,7 @@ $ multiboot /hello-world.galileo
$ boot $ boot
``` ```
This should boot the Contiki image, resulted in the following messages being This should boot the Contiki image, resulting in the following messages being
sent to the serial console: sent to the serial console:
``` ```
Starting Contiki Starting Contiki