Talk:OS Specific Toolchain: Difference between revisions

Content deleted Content added
No edit summary
Line 63:
 
:I found the answer. You have to enable the gold linker for your target. It is easily done in the main configure.ac file. Look for <tt>Handle --enable-gold, --enable-ld</tt> and find the line <tt># Check for ELF target.</tt> Now add your target in the <tt>case "${target}"</tt>. I added <tt>*-*-myos*</tt> after <tt>*-*-irix6*</tt>, because there was some space left. Then run <tt>autoconf</tt> in the same directory as the configure.ac file. It will generate a new configure script. Now you're able to configure (in a build directory) and make. --[[User:Walling|Walling]] 13:24, 8 April 2011 (UTC)
 
== Newlib sys/myos Makefile.am problem ==
 
It appears that in newer versions of Newlib (I'm trying to use 2.1.0), if you create the Makefile.am for your system as suggested below:
 
if MAY_SUPPLY_SYSCALLS
extra_objs = syscalls.o
else
extra_objs =
endif
 
than, the extra_objs assignment is added after the rest of the assignments in the actual Makefile. So, for example, in the Makefile (after configuration) it would look something like this:
 
lib_a_SOURCES =
lib_a_LIBADD = $(extra_objs)
EXTRA_lib_a_SOURCES = syscalls.c crt0.S
lib_a_DEPENDENCIES = $(extra_objs)
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
... # A lot of other stuff, approximately 300 lines
extra_objs = syscalls.o
# extra_objs =
 
This makes lib_a_LIBADD empty, and therefore never compiles your syscalls. The solution is to remove the conditional and make it simply:
 
extra_objs = syscalls.o
 
It was a rather annoying bug to track down. I'm not sure of the ramifications of ignoring the MAY_SUPPLY_SYSCALLS macro, but I am currently ignoring it and newlib is compiling happily. I assume this is happening because the configure script/automake makes two passes. First evaluating assignments and adding them all to the script, then second evaluating all conditionals and adding remaining assignments to the script. So on pass one, all the variables are dumped into the Makefile, then the if block is tested and extra_objs is placed inside the Makefile after all the other assignments (which in this case is a problem).
Return to "OS Specific Toolchain" page.