Browse Source

examples/natmod/re: Fix build on RV32.

This fixes compilation of the `re` natmod example when built with
Picolibc in the CI environment.  Ubuntu 22.04's combination of its
bare metal RISC-V toolchain and its version of Picolibc makes the
`alloca` symbol more elusive than it should be.

This commit makes the `re` natmod try harder to get an `alloca`
implementation.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
pull/15603/head
Alessandro Gatti 1 month ago
parent
commit
10bba32e5f
  1. 13
      examples/natmod/re/re.c

13
examples/natmod/re/re.c

@ -4,7 +4,20 @@
#define MICROPY_PY_RE_MATCH_SPAN_START_END (1)
#define MICROPY_PY_RE_SUB (0) // requires vstr interface
#if defined __has_builtin
#if __has_builtin(__builtin_alloca)
#define alloca __builtin_alloca
#endif
#endif
#if !defined(alloca)
#if defined(_PICOLIBC__) && !defined(HAVE_BUILTIN_ALLOCA)
#define alloca(n) m_malloc(n)
#else
#include <alloca.h>
#endif
#endif
#include "py/dynruntime.h"
#define STACK_LIMIT (2048)

Loading…
Cancel
Save