OS Specific Toolchain: Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content deleted Content added
Prefer binutils-2.25 instructions, update /include and /lib change instructions |
|||
Line 39: | Line 39: | ||
<source lang="bash"> |
<source lang="bash"> |
||
i[3-7]86-*-myos*) |
i[3-7]86-*-myos*) |
||
targ_defvec= |
targ_defvec=i386_elf32_vec |
||
targ_selvecs= |
targ_selvecs= |
||
targ64_selvecs= |
targ64_selvecs=x86_64_elf64_vec |
||
;; |
;; |
||
#ifdef BFD64 |
#ifdef BFD64 |
||
x86_64-*-myos*) |
x86_64-*-myos*) |
||
targ_defvec= |
targ_defvec=x86_64_elf64_vec |
||
targ_selvecs= |
targ_selvecs=i386_elf32_vec |
||
want64=true |
want64=true |
||
;; |
;; |
||
Line 52: | Line 52: | ||
</source> |
</source> |
||
'''Note:''' If using binutils-2.24 or older, change <i>i386_elf32_vec</i> to <i>bfd_elf32_i386_vec</i> and <i>x86_64_elf64_vec</i> to <i>bfd_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. |
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: | Line 273: | ||
=== Changing the Default Include Directory === |
=== 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 === |
=== Changing the Default Library Directory === |
||
If you wish to change the default library directory 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"> |
<source lang="c"> |
||
*-*-myos*) |
*-*-myos*) |
||
NATIVE_LIB_DIRS='/lib' |
NATIVE_LIB_DIRS='/lib /local/lib' |
||
;; |
;; |
||
</source> |
</source> |
||
=== Start Files Directory === |
=== 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 |
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 change the library directory to <tt>/lib</tt> in binutils and want gcc to match, you can add the following to <tt>gcc/config/myos.h</tt>: |
||
<source lang="C"> |
<source lang="C"> |
||
#undef STANDARD_STARTFILE_PREFIX |
#undef STANDARD_STARTFILE_PREFIX |
||
#define STANDARD_STARTFILE_PREFIX " |
#define STANDARD_STARTFILE_PREFIX "/lib/" |
||
</source> |
</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 == |
== Selecting a C Library == |