Building newlib and gcc for ARM Thumb2

Rob Emanuele poorarm@shoreis.com
Wed Feb 4 01:39:00 GMT 2009


In addition if I am specifying a thumb2 platform, thumb2 is defined:

[rje@rje-pc xxxxx]$  arm-eabi-gcc -mthumb -mcpu=cortex-m3 -dM -E - < /dev/null
....
#define __thumb2__ 1
....

I'm just not sure how to get a multilib with thumb2 installed and used by gcc.

Thanks,

Rob

On Tue, Feb 3, 2009 at 4:18 PM, Rob Emanuele <poorarm@shoreis.com> wrote:
> Jeff,
>
> In my case:
>
> [rje@rje-pc xxxxx]$ arm-eabi-gcc --print-multi-lib
> .;
> thumb;@mthumb
>
> This proves I am missing that multilib.  How would I go about creating it?
>
> Thank you,
>
> Rob
>
>
> On Tue, Feb 3, 2009 at 1:41 PM, Jeff Johnston <jjohnstn@redhat.com> wrote:
>> Regarding building newlib, you should know about multilibs.  Multilibs are
>> versions of the library
>> built with specific options.  The compiler determines what multilibs should
>> exist and how to build them.
>> The compiler has an option: --print-multi-lib which specifies the various
>> permutations
>> of options to build the library with and what subdirectories to put them
>> under.  Newlib issues this
>> option to determine how many multilibs to build and how to do it.
>>
>> For example, the mn10300-elf-gcc compiler I have on my system gives:
>>
>> [jjohnstn@vermillion]$ ./mn10300-elf-gcc --print-multi-lib
>> .;
>> am33;@mam33
>> am33-2;@mam33-2
>> am34;@mam34
>>
>> Note that this indicates there are 3 additional multilibs in addition to the
>> default library (.;).  The
>> am33 version of the library uses a subdirectory named "am33" and is compiled
>> with the -mam33 option, the am33-2 is built with -mam33-2, etc...  Sometimes
>> you have permutations and can end up with nested subdirectories (e.g. a
>> bigendian and soft-float library could be stored under a subdirectory
>> be/sf).
>>
>> When you compile/link an application via gcc and specify a particular
>> multilib option, the compiler will try and
>> find the library under the specified subdirectory or subdirectories of the
>> location where newlib has been specified to be.  This does not occur if you
>> do the link yourself via ld (you have to figure out where the library has
>> been stored).
>>
>> So, check to see if the compiler you are ultimately using in the newlib
>> build has a thumb2 multilib and the option(s) used (via --print-multi-lib).
>>  Then, verify that the compiler is setting the __thumb2__ flag when this
>> particular option is chosen which is what ultimately determines if the
>> thumb2-specific code in setjmp.S is being activated properly.
>>
>> -- Jeff J.
>>
>> Rob Emanuele wrote:
>>>
>>> Alexandre,
>>>
>>> Yes, it builds but I don't see any code generated for thumb2.  I see
>>> ARM and thumb but not thumb2.
>>>
>>> --Rob
>>>
>>>
>>> On Tue, Feb 3, 2009 at 9:14 AM, Alexandre Pereira Nunes
>>> <alexandre.nunes@gmail.com> wrote:
>>>
>>>>
>>>> On Sun, Feb 1, 2009 at 4:52 PM, Rob Emanuele <poorarm@shoreis.com> wrote:
>>>>
>>>>>
>>>>> Greetings,
>>>>>
>>>>> I'm trying to build newlib and gcc for a Cortex-M3 processor.  What
>>>>> are the best ways for doing this?  I'm running into a problem with the
>>>>> "setjmp" call as it is not being compiled correctly for Thumb2.  It is
>>>>> only being compiled for Thumb.  Are there a set of instructions on the
>>>>> proper build procedure to get all the libs built for arm, thumb, and
>>>>> thumb2?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Rob Emanuele
>>>>>
>>>>>
>>>>
>>>> Are you trying 1.17.0 ? It should build fine.
>>>>
>>>>
>>
>>
>



More information about the Newlib mailing list