ARM-only [Patch] Allow 4 byte enum size (-fno-short-enums) | Remove hard coded short enum flag from the build scripts?

Joel Sherrill joel.sherrill@oarcorp.com
Tue Aug 30 12:45:00 GMT 2016



On August 30, 2016 4:47:18 AM CDT, Corinna Vinschen <vinschen@redhat.com> wrote:
>On Aug 28 16:31, Dennis Pahl wrote:
>> Hi,
>> 
>> in my project I need the enum size to be 4 bytes. Therefore in order
>to get
>> no linker compatibility warnings, I also require newlib to use 4
>bytes for
>> its enums.
>> 
>> 4 byte enums can be achieved by specifying the following compiler
>flag
>> "-fno-short-enums". This flag works fine for the source code of my
>project.
>> Newlib, however, has a problem with this flag due to some hard coded
>> compiler invocations which include the opposite flag "-fshort-enums".
>> 
>> A look in the mailing list archive revealed, that there already has
>been a
>> discussion about this problem
>> (https://sourceware.org/ml/newlib/2013/msg00183.html). The final
>advice from
>> Michael Bruck, who started the discussion, was to remove these hard
>coded
>> flags entirely from the build script files. Is there a reason why
>this did
>> not happen?
>> 
>> With the removed hard coded flags the enum size can be configured by
>> specifying
>> CFLAGS_FOR_TARGET= '-fno-short-enums' or '-fshort-enums'
>> CXXFLAGS_FOR_TARGET='-fno-short-enums' or '-fshort-enums'
>> 
>> By following Michael Bruck's advice I was able to build newlib with
>the
>> wanted enum size.
>
>The patch is ok with me, what do other user's of ARM think?

I assume the default is 32 bit.

Does configuring newlib for small size automatically trigger the small enum size?

Someone who works more intimately with the arm and especially the smaller ones needs to comment

--joel

>
>Corinna

--joel



More information about the Newlib mailing list