This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compiling newlib for the [sparc-leon3-elf] target


Greetings,

Thank you for your response. I changed the configuration for the
bootstrapping GCC compiler to allow for --enable-multilib and went ahead
and added a few seemingly missing bits to the file t-leon3:

--- gcc-6.3.0-pristine/gcc/config/sparc/t-leon3	2016-01-04
09:30:50.000000000 -0500
+++ gcc-6.3.0-modified/gcc/config/sparc/t-leon3	2017-01-09
14:05:57.406772684 -0500
@@ -17,6 +17,8 @@
 # <http://www.gnu.org/licenses/>.

 # Multilibs for LEON3
-MULTILIB_OPTIONS = msoft-float
-MULTILIB_DIRNAMES = soft
+MULTILIB_OPTIONS = msoft-float mcpu=v8 mfix-ut699
+MULTILIB_DIRNAMES = soft v8 ut699
 MULTILIB_MATCHES = msoft-float=mno-fpu
+MULTILIB_EXCEPTIONS += msoft-float/mtune=ut699
+MULTILIB_EXCLUSIONS += msoft-float/mtune=ut699

The build for newlib/libgloss and the associated leon3 libraries are
more to what I expected, however, I still get multiply defined symbols
inside libleonbare.a and possibly friends [attached]. The test program
ensues:

#include <stdio.h>
int main(void) {
	return printf("%s\n", "hello");
}
// sparc-leon3-elf-gcc -o test.elf test.c -Wl,--verbose

I am not sure if I missed a step here, or broke something inside gcc
with the changes I made. Again, thank you.

Cheers,
Orlando.

On 01/09/2017 12:13 PM, Jeff Johnston wrote:
> From your configuration below, you are configuring your gcc as
> disable-multilib.
> 
> The way newlib generates the various subdirectories is to call
> gcc --print-multi-lib and then parse the output into sub-directories
> and what options are to be used when building in said sub-directories.
> 
> If you run your cross-compiler with --print-multi-lib you can see
> what newlib will use.  If there are no multilibs, then newlib won't
> do what you want.
> 
> -- Jeff J.
> 
> ----- Original Message -----
>> Greetings,
>>
>> I have been trying to build the newlib/libgloss stack and associated
>> libraries for the sparc-leon3-elf package. Currently, I am using a
>> slightly patched binutils and gcc to perform this process. The patches
>> can be found in [1]. The patches are supposed to add the missing linker
>> script in binutils and change the default linker command gcc issues for
>> the sparc-elf target.
>>
>> The situation I am having when building newlib is specifically with the
>> libraries associated for the leon3. An old build by Gaisler generates a
>> few separate directories:
>>
>> lib/
>> lib/soft/
>> lib/soft/v8
>> lib/ut699
>> lib/v8
>> lib/v8/ut699
>>
>> each with separate versions of the C runtime, AMBA plug and play
>> routines, the baremetal leon3 libraries. However, when I build it, none
>> of these directories get created, and the resulting leon3 libraries
>> begin exposing duplicate symbols [as if what should be in independent
>> directories are merged into the same file]. When linking programs, ld is
>> right to complain about the situation and generates no binaries.
>>
>> I am configuring newlib/libgloss with:
>>
>> export _target=sparc-leon3-elf
>> export CFLAGS_FOR_TARGET="-Os -g -ffunction-sections -fdata-sections"
>> export CFLAGS=${CFLAGS_FOR_TARGET}
>>
>> ../configure \
>>   --prefix=/usr \
>>   --target=${_target} \
>>   --with-cpu=leon3 \
>>   --enable-multilib \
>>   --with-sysroot=/usr/${_target}
>>
>> Binutils [2.27 with linked patches] was configured with:
>> ../configure --prefix=/usr \
>>   --target=${_target} \
>>   --with-program-prefix=${_target}- \
>>   --with-sysroot=/usr/${_target} \
>>   --enable-shared \
>>   --disable-nls \
>>   --with-gnu-as \
>>   --with-gnu-ld \
>>   --enable-plugins \
>>   --disable-gold \
>>   --enable-multilib \
>>   --with-cpu=leon3 \
>>   --with-float=soft \
>>   --disable-werror
>> make configure-host
>> make
>>
>> GCC [6.3.0 with linked patches] was bootstrapped as:
>> ../configure \
>>   --target=${_target} \
>>   --with-sysroot=/usr/${_target} \
>>   --prefix=/usr \
>>   --enable-languages=c \
>>   --disable-shared \
>>   --disable-nls \
>>   --disable-threads \
>>   --disable-libgomp \
>>   --disable-mudflap \
>>   --disable-libssp \
>>   --disable-multilib \
>>   --with-float=soft \
>>   --with-newlib \
>>   --without-headers \
>>   --with-float=soft \
>>   --with-cpu=leon
>>
>> make all-gcc
>>
>> Any ideas what I could be missing here? Thank you.
>>
>> Cheers,
>> Orlando.
>>
>> [1]
>> https://beta.groups.yahoo.com/neo/groups/LEON_SPARC/conversations/messages/24660
>>
>>

Attachment: test.log
Description: PGP signature

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]