esp-idf/components/esp_rom/esp32c3/ld
Ivan Grokhotkov f527010044 esp_rom: remove functions which depend on sizeof(struct stat)
...and all their callers.

With the upcoming switch from sizeof(time_t)==4 to sizeof(time_t)==8,
sizeof(struct stat) is also increasing.

A few newlib functions present in ROM allocate 'struct stat' on the
stack and call _fstat_r on this structure. The implementation of
fstat is provided in ESP-IDF. This implementation will often do
memset(st, 0, sizeof(*st)), where st is 'struct stat*', before setting
some fields of this structure. If IDF is built with sizeof(st)
different from sizeof(st) which ROM was built with, this will lead
to an out-of-bounds write and a stack corruption.

This commit removes problematic ROM functions from the linker script.
Here are the functions which allocate 'struct stat':
* _isatty_r (in ROM)
* __swhatbuf_r, called by __smakebuf_r, called by __swsetup_r and
  __srefill_r (in ROM)
* _fseeko_r (not in ROM)
* glob2 (not in ROM)
* _gettemp (not in ROM)

As a result, these functions are used from libc.a, and use correct
size of 'stat' structure.

Closes https://github.com/espressif/esp-idf/issues/7980
2022-02-11 07:07:12 +00:00
..
esp32c3.rom.api.ld esp_rom/esp_system: Add flag for ROM multiple UART output, esp32c3 console 2020-12-24 14:18:01 +11:00
esp32c3.rom.eco3.ld Support new section addr and wifi lib for ESP32C3-ECO3. 2021-03-30 16:05:13 +08:00
esp32c3.rom.ld bugfix fix some wifi bugs for 4.3 2021-07-31 21:46:14 +08:00
esp32c3.rom.libgcc.ld esp_rom: Add initial ESP32-C3 support 2020-11-30 11:12:56 +11:00
esp32c3.rom.newlib-nano.ld esp_rom: Add initial ESP32-C3 support 2020-11-30 11:12:56 +11:00
esp32c3.rom.newlib-time.ld esp_rom: remove functions which depend on sizeof(struct stat) 2022-02-11 07:07:12 +00:00
esp32c3.rom.newlib.ld esp_rom: remove functions which depend on sizeof(struct stat) 2022-02-11 07:07:12 +00:00
esp32c3.rom.version.ld esp_rom: Add initial ESP32-C3 support 2020-11-30 11:12:56 +11:00