Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect function definition for _raise_r in newlib syscalls.c and syscall_table.c #2245

Closed
lllucius opened this issue Jul 31, 2018 · 1 comment
Labels
Status: In Progress Work is in progress

Comments

@lllucius
Copy link

Environment

  • Development Kit: ESP32-Wrover-Kit
  • Kit version: v1
  • Core: ESP32-Wrover
  • IDF version: 561884b
  • Development Env: Make
  • Operating System: Windows (WSL)
  • Power Supply: USB

Problem Description

The _raise_r function in components/newlib/syscalls.c and components/newlib/syscall_table.c is missing the second parameter (the signal number). This can cause compile errors if you include a header on the command line using "-include".

Expected Behavior

Should build without error.

Actual Behavior

Build fails.

Steps to reproduce

(purely contrived example...project doesn't actually do it this way)

  1. make V=1 CFLAGS="-include ${IDF_PATH}/components/newlib/include/sys/signal.h"

Code to reproduce this issue

From components/newlib/syscalls.c: (missing signal parameter)

void _raise_r(struct _reent *r)
{
    abort();
}

From components/newlib/syscall_table.c: (missing signal parameter)

static struct syscall_stub_table s_stub_table = {
...
    ._raise_r = (void (*)(struct _reent *r)) &_raise_r,
...

Debug Logs

xtensa-esp32-elf-gcc -include /root/esp32/esp-idf/components/newlib/include/sys/signal.h -DESP_PLATFORM -D IDF_VER=\"v3.2-dev-343-g561884b6\" -MMD -MP   -DWITH_POSIX -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"' -DHAVE_CONFIG_H -I /root/esp32/esp-idf/components/newlib/platform_include -I /root/esp32/esp-idf/components/newlib/include -I /root/esp32/esp-idf/components/app_trace/include -I /root/esp32/esp-idf/components/app_update/include -I /root/esp32/esp-idf/components/bootloader_support/include -I /root/esp32/esp-idf/components/bt/include -I /root/esp32/esp-idf/components/coap/port/include -I /root/esp32/esp-idf/components/coap/port/include/coap -I /root/esp32/esp-idf/components/coap/libcoap/include -I /root/esp32/esp-idf/components/coap/libcoap/include/coap -I /root/esp32/esp-idf/components/console -I /root/esp32/esp-idf/components/driver/include -I /root/esp32/esp-idf/components/esp-tls -I /root/esp32/esp-idf/components/esp32/include -I /root/esp32/esp-idf/components/esp_adc_cal/include -I /root/esp32/esp-idf/components/esp_http_client/include -I /root/esp32/esp-idf/components/ethernet/include -I /root/esp32/esp-idf/components/expat/port/include -I /root/esp32/esp-idf/components/expat/include/expat -I /root/esp32/esp-idf/components/fatfs/src -I /root/esp32/esp-idf/components/freertos/include -I /root/esp32/esp-idf/components/heap/include -I /root/esp32/esp-idf/components/http_server/include -I /root/esp32/esp-idf/components/idf_test/include -I /root/esp32/esp-idf/components/jsmn/include -I /root/esp32/esp-idf/components/json/cJSON -I /root/esp32/esp-idf/components/libsodium/libsodium/src/libsodium/include -I /root/esp32/esp-idf/components/libsodium/port_include -I /root/esp32/esp-idf/components/log/include -I /root/esp32/esp-idf/components/lwip/include/lwip -I /root/esp32/esp-idf/components/lwip/include/lwip/port -I /root/esp32/esp-idf/components/lwip/include/lwip/posix -I /root/esp32/esp-idf/components/lwip/apps/ping -I /root/esp32/esp-idf/components/mbedtls/port/include -I /root/esp32/esp-idf/components/mbedtls/mbedtls/include -I /root/esp32/esp-idf/components/mdns/include -I /root/esp32/esp-idf/components/micro-ecc/micro-ecc -I /root/esp32/esp-idf/components/nghttp/port/include -I /root/esp32/esp-idf/components/nghttp/nghttp2/lib/includes -I /root/esp32/esp-idf/components/nvs_flash/include -I /root/esp32/esp-idf/components/openssl/include -I /root/esp32/esp-idf/components/pthread/include -I /root/esp32/esp-idf/components/sdmmc/include -I /root/esp32/esp-idf/components/smartconfig_ack/include -I /root/esp32/esp-idf/components/soc/esp32/include -I /root/esp32/esp-idf/components/soc/include -I /root/esp32/esp-idf/components/spi_flash/include -I /root/esp32/esp-idf/components/spiffs/include -I /root/esp32/esp-idf/components/tcpip_adapter/include -I /root/esp32/esp-idf/components/ulp/include -I /root/esp32/esp-idf/components/vfs/include -I /root/esp32/esp-idf/components/wear_levelling/include -I /root/esp32/esp-idf/components/wpa_supplicant/include -I /root/esp32/esp-idf/components/wpa_supplicant/port/include -I /root/esp32/esp-idf/components/esp32/include -I /root/esp32/esp-idf/components/xtensa-debug-module/include -I /root/test/pt/build/include  -I . -c /root/esp32/esp-idf/components/newlib/syscalls.c -o syscalls.o
/root/esp32/esp-idf/components/newlib/syscalls.c:71:6: error: conflicting types for '_raise_r'
 void _raise_r(struct _reent *r)
      ^
In file included from /root/esp32/esp-idf/components/newlib/include/sys/signal.h:9:0,
                 from <command-line>:0:
/root/esp32/esp-idf/components/newlib/include/signal.h:22:12: note: previous declaration of '_raise_r' was here
 int _EXFUN(_raise_r, (struct _reent *, int));
            ^
/root/esp32/esp-idf/components/newlib/include/_ansi.h:65:30: note: in definition of macro '_EXFUN'
 #define _EXFUN(name, proto)  name proto
                              ^
make[1]: *** [/root/esp32/esp-idf/make/component_wrapper.mk:286: syscalls.o] Error 1
make[1]: Leaving directory '/root/test/pt/build/newlib'
make: *** [/root/esp32/esp-idf/make/project.mk:471: component-newlib-build] Error 2
@lllucius
Copy link
Author

Return value is also incorrect in both source files.

@igrr igrr added the Status: In Progress Work is in progress label Jul 31, 2018
@igrr igrr closed this as completed in 1fdbbec Aug 6, 2018
catalinio pushed a commit to catalinio/pycom-esp-idf that referenced this issue Jun 28, 2019
ROM code still uses incorrect function signature.

Closes espressif/esp-idf#2245.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: In Progress Work is in progress
Projects
None yet
Development

No branches or pull requests

2 participants