OS Specific Toolchain: Difference between revisions

Prefer binutils-2.25 instructions, update /include and /lib change instructions
[unchecked revision][unchecked revision]
(Prefer binutils-2.25 instructions, update /include and /lib change instructions)
Line 39:
<source lang="bash">
i[3-7]86-*-myos*)
targ_defvec=bfd_elf32_i386_veci386_elf32_vec
targ_selvecs=
targ64_selvecs=bfd_elf64_x86_64_vecx86_64_elf64_vec
;;
#ifdef BFD64
x86_64-*-myos*)
targ_defvec=bfd_elf64_x86_64_vecx86_64_elf64_vec
targ_selvecs=bfd_elf32_i386_veci386_elf32_vec
want64=true
;;
Line 52:
</source>
 
<b>'''Note:</b> To''' compileIf withusing binutils-2.2524 or older, change <i>bfd_elf32_i386_veci386_elf32_vec</i> to <i>i386_elf32_vecbfd_elf32_i386_vec</i> and <i>bfd_elf64_x86_64_vecx86_64_elf64_vec</i> to <i>x86_64_elf64_vecbfd_elf64_x86_64_vec</i>.
 
Be sure to follow the instructions in the comment block above the list and add your entry beneath the comment "<tt>#START OF targmatch.h</tt>". If you like, you could support different object formats (look at other entries in the list, and the contents of 'bfd' for hints) and also provide more than one to the <tt>targ_selvecs</tt> line. For instance, you can support coff object files if you add <tt>i386coff_vec</tt> to the <tt>targ_selvecs</tt> list. For some reason, all the <tt>x86_64</tt> entries in the file file are wrapped in <tt>#ifdef BFD64</tt>, it's probably prudent to do it yourself as well.
Line 273:
=== Changing the Default Include Directory ===
 
If you wish to change the default include directory from <tt>/usr/include</tt>, you can override the <tt>native_system_header_dir</tt> variable in <tt>gcc/config.gcc</tt> in the case for your OS.
If you belong to the group that has decided that the /usr directory is big and evil, you may wish to change the default include directory path. If you wish to do so, you can simply add this to your gcc/gcc/config/myos.h:
 
<source lang="c">
/* Standard include directory. */
#undef STANDARD_INCLUDE_DIR
#define STANDARD_INCLUDE_DIR "/include"
</source>
 
<b>Note:</b> When using GCC 4.9.2 and newer (may also apply for lower versions), the above approach will not work. Instead, configure GCC with <tt>--with-native-system-header-dir=/include</tt>.
 
=== Changing the Default Library Directory ===
 
YouIf canyou wish to change the default library pathdirectory from <tt>/usr/lib</tt>, you can change it to <tt>/lib</tt> by adding the following block of code to the case just below the declaration of <tt>NATIVE_LIB_DIRS</tt> in <tt>binutils/ld/configure.tgt</tt> (around line 785).
 
<source lang="c">
*-*-myos*)
NATIVE_LIB_DIRS='/lib /local/lib'
;;
</source>
 
=== Start Files Directory ===
 
You can modify which directory GCC looks for the crt0.o, crti.o and crtn.o in. The path to that directory is stored in <tt>STANDARD_STARTFILE_PREFIX</tt>. For instance, if you wishchange the library directory to have<tt>/lib</tt> differentin locationsbinutils dependingand onwant thegcc to processormatch, you can add the following to gcc/<tt>gcc/config/i386/myos64myos.h</tt>:
 
<source lang="C">
#undef STANDARD_STARTFILE_PREFIX
#define STANDARD_STARTFILE_PREFIX "/x86_64-myos/lib/"
</source>
 
Note that the trailing slash is important as the raw crt*.o names are appended without first adding a slash.
 
== Selecting a C Library ==
Anonymous user