[PATCH] libcsupport: Workaround for GCC 5.1 and later

Gedare Bloom gedare at gwu.edu
Mon Jul 13 15:53:20 UTC 2015


I'm fine with the build system hack to deal with this issue. Is there
a PR in gcc on this, and do we have a ticket to track it too?

Gedare

On Mon, Jul 13, 2015 at 10:37 AM, Joel Sherrill
<joel.sherrill at oarcorp.com> wrote:
> This is possible to do inside the file itself using function
> attributes or pragmas. I am not sure which method is best but
> wanted to pass along so we could decide as a group.
>
>> optimize
>> The optimize attribute is used to specify that a function is to be
>> compiled with different optimization options than specified on the command
>> line. Arguments can either be numbers or strings. Numbers are assumed to be
>> an optimization level. Strings that begin with O are assumed to be an
>> optimization option, while other options are assumed to be used with a -f
>> prefix. You can also use the ‘#pragma GCC optimize’ pragma to set the
>> optimization options that affect more than one function. See Function
>> Specific Option Pragmas, for details about the ‘#pragma GCC optimize’
>> pragma.
>> This can be used for instance to have frequently-executed functions
>> compiled with more aggressive optimization options that produce faster and
>> larger code, while other functions can be compiled with less aggressive
>> options.
>
>
>
> --joel
>
> On 7/13/2015 3:20 AM, Sebastian Huber wrote:
>>
>> Disable an optimization which would lead to a recursive calloc() call in
>> calloc().
>> ---
>>   cpukit/libcsupport/Makefile.am | 8 ++++++--
>>   cpukit/wrapup/Makefile.am      | 1 +
>>   2 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/cpukit/libcsupport/Makefile.am
>> b/cpukit/libcsupport/Makefile.am
>> index 7474079..a5da5f1 100644
>> --- a/cpukit/libcsupport/Makefile.am
>> +++ b/cpukit/libcsupport/Makefile.am
>> @@ -1,8 +1,9 @@
>>   include $(top_srcdir)/automake/multilib.am
>>   include $(top_srcdir)/automake/compile.am
>>
>> -noinst_LIBRARIES = libcsupport.a
>> +noinst_LIBRARIES = libcsupport.a libcalloc.a
>>   libcsupport_a_CPPFLAGS = $(AM_CPPFLAGS)
>> +libcalloc_a_CPPFLAGS = $(AM_CPPFLAGS)
>>
>>   include_rtemsdir = $(includedir)/rtems
>>   include_rtems_HEADERS = include/console.h
>> @@ -79,7 +80,7 @@ ID_C_FILES = src/getegid.c src/geteuid.c src/getgid.c
>> src/getgroups.c \
>>       src/seteuid.c src/setgid.c src/setuid.c src/setegid.c src/setpgid.c
>> \
>>       src/setsid.c
>>
>> -MALLOC_C_FILES = src/malloc_initialize.c src/calloc.c src/malloc.c \
>> +MALLOC_C_FILES = src/malloc_initialize.c src/malloc.c \
>>       src/realloc.c src/_calloc_r.c src/_malloc_r.c \
>>       src/free.c src/_free_r.c \
>>       src/_realloc_r.c src/mallocfreespace.c \
>> @@ -138,6 +139,9 @@ libcsupport_a_SOURCES += $(LIBC_GLUE_C_FILES)
>> $(PASSWORD_GROUP_C_FILES) \
>>
>>   libcsupport_a_SOURCES += src/flockfile.c src/funlockfile.c
>> src/ftrylockfile.c
>>
>> +libcalloc_a_SOURCES = src/calloc.c
>> +libcalloc_a_CFLAGS = -fno-builtin
>> +
>>   EXTRA_DIST = src/TODO src/CASES src/README
>>
>>   include $(srcdir)/preinstall.am
>> diff --git a/cpukit/wrapup/Makefile.am b/cpukit/wrapup/Makefile.am
>> index 53861df..5fd6e33 100644
>> --- a/cpukit/wrapup/Makefile.am
>> +++ b/cpukit/wrapup/Makefile.am
>> @@ -21,6 +21,7 @@ endif
>>
>>   TMP_LIBS += ../libcrypt/libcrypt.a
>>   TMP_LIBS += ../libcsupport/libcsupport.a
>> +TMP_LIBS += ../libcsupport/libcalloc.a
>>   TMP_LIBS += ../libblock/libblock.a
>>   if LIBDOSFS
>>   TMP_LIBS += ../libfs/libdosfs.a
>>
>
> --
> Joel Sherrill, Ph.D.             Director of Research & Development
> joel.sherrill at OARcorp.com        On-Line Applications Research
> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
> Support Available                (256) 722-9985
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list