On 22/07/2021 14:15, Richard Biener wrote:
On Wed, Jul 21, 2021 at 2:45 PM Sebastian Huber
<sebastian.hu...@embedded-brains.de>  wrote:
Hello,

while testing this patch

https://www.google.com/search?client=firefox-b-e&q=gcc+enable_runtime_checking

I noticed that __gcov_info_to_gcda() uses abort(). This is due to (from
tsystem.h):

#ifdef ENABLE_RUNTIME_CHECKING
#define gcc_assert(EXPR) ((void)(!(EXPR) ? abort (), 0 : 0))
#else
/* Include EXPR, so that unused variable warnings do not occur.  */
#define gcc_assert(EXPR) ((void)(0 && (EXPR)))
#endif

In tsystem.h there is this if inhibit_libc is defined:

#ifndef abort
extern void abort (void) __attribute__ ((__noreturn__));
#endif

Who is supposed to define abort here optionally? Can this be defined for
example by a target configuration header like gcc/config/rtems.h?
I suppose for inhibit_libc we could use __builtin_trap () (but that might
expand to abort() on some targets)

In case of RTEMS, the application and the operating system is statically linked into one executable. The more features an application uses the bigger will be the executable. The abort() function pulls in a lot of stuff since it uses signals and may attempt to close all open streams. It would be nice if the gcc_assert() could be customized by the target configuration. For RTEMS we could use the Newlib defined __assert_func() from <assert.h>:

# define assert(__e) ((__e) ? (void)0 : __assert_func (__FILE__, __LINE__, \
                                                       __ASSERT_FUNC, #__e))


void __assert_func (const char *, int, const char *, const char *)
            _ATTRIBUTE ((__noreturn__));


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

Reply via email to