Clang Driver Config

From Dmz-portal

Jump to: navigation, search

The config branch in the gitosis@dmz-portal.mips.com:clang.git repository has a prototype implementation of the Clang Driver configuration file support.

Here is a short usage guide:

  1. Create folder config somewhere on your disk.
  2. Create file config/mipsel-cs with content listed below
  3. Export the following environment variable: export CLANG_CFG_PATH=<absolute path to the config folder>
  4. Run the following command: clang --target=mipsel-cs test.cc -v -lstdc++
# MIPS 32 little-endian toolchain configuration
target: mipsel-linux-gnu

# Path to the Code Sourcery toolchain directory.
subst:
  Root: /home/simon/work/mips-2012.09

sysroot: ${Root}/mips-linux-gnu/libc/el

include dirs:
  isystem:
    - ${Root}/lib/gcc/mips-linux-gnu/4.7.2/include
    - ${Root}/lib/gcc/mips-linux-gnu/4.7.2/include-fixed/el

  isystem cxx:
    - ${Root}/mips-linux-gnu/include/c++/4.7.2
    - ${Root}/mips-linux-gnu/include/c++/4.7.2/mips-linux-gnu/el
    - ${Root}/mips-linux-gnu/include/c++/4.7.2/backward

  externc:
    - ${Root}/mips-linux-gnu/include
    - ${Root}/mips-linux-gnu/libc/usr/include

files dirs:
  - ${Root}/mips-linux-gnu/libc/el/usr/lib
  - ${Root}/lib/gcc/mips-linux-gnu/4.7.2/el

#files:
#  crti.o:     /mips-linux-gnu/libc/usr/lib/crti.o
#  crtn.o:     /mips-linux-gnu/libc/usr/lib/crtn.o
#  crtbegin.o: /lib/gcc/mips-linux-gnu/4.6.3/crtbegin.o
#  crtend.o:   /lib/gcc/mips-linux-gnu/4.6.3/crtend.o

programs dirs:
  - ${Root}/bin/mips-linux-gnu-

#programs:
#  as:         ${Root}/bin/mips-linux-gnu-as
#  ld:         ${Root}/bin/mips-linux-gnu-ld

lib search dirs:
  - ${Root}/lib/gcc/mips-linux-gnu/4.7.2/el
  - ${Root}/mips-linux-gnu/lib/el
  - ${Root}/lib/gcc/mips-linux-gnu/4.7.2
  - ${Root}/lib/gcc
  - ${Root}/mips-linux-gnu/lib
  - ${Root}/mips-linux-gnu/libc/el/lib
  - ${Root}/mips-linux-gnu/libc/el/usr/lib
 

One more example shows how to work with ToT GCC build. The configuration file below allows to work with MIPS32 littele-endian soft-float targets.

# MIPS 32 little-endian soft-float toolchain configuration
target: mipsel-linux-gnu

subst:
  Root: /home/simon/work/fsf.workarea/install-mips-mti-linux-gnu
  SysRoot: /home/simon/work/fsf.workarea/sysroot-mips-mti-linux-gnu

sysroot: ${SysRoot}/el/sof

include dirs:
  isystem:
    - ${Root}/lib/gcc/mips-mti-linux-gnu/4.9.0/include
    - ${Root}/lib/gcc/mips-mti-linux-gnu/4.9.0/include-fixed

  isystem cxx:
    - ${Root}/mips-mti-linux-gnu/include/c++/4.9.0
    - ${Root}/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/el/sof
    - ${Root}/mips-mti-linux-gnu/include/c++/4.9.0/backward

  externc:
    - ${Root}/mips-mti-linux-gnu/include
    - ${SysRoot}/usr/include

files dirs:
  - ${SysRoot}/el/sof/usr/lib
  - ${Root}/lib/gcc/mips-mti-linux-gnu/4.9.0/el/sof

programs dirs:
  - ${Root}/bin/mips-mti-linux-gnu-

lib search dirs:
  - ${Root}/lib/gcc/mips-mti-linux-gnu/4.9.0/el/sof
  - ${Root}/mips-mti-linux-gnu/lib/el/sof
  - ${Root}/lib/gcc/mips-mti-linux-gnu/4.9.0
  - ${Root}/mips-mti-linux-gnu/lib
  - ${SysRoot}/el/sof/usr/lib
 
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox