forked from espressif/esp-idf
cmake: For gcc8 use linker to find paths to libc, libm, libstdc++, etc
Removes the need to know/guess the paths to these libraries. Once we are gcc 8 only, we can remove -nostdlib and no additional arguments are needed for system libraries. The catch is: any time IDF overrides a symbol in the toolchain sysroot, we need an undefined linker marker to make sure this symbol is seen by linker.
This commit is contained in:
committed by
Renz Christian Bagaporo
parent
2c12080049
commit
22514c1dd9
@@ -544,6 +544,34 @@ int esp_vfs_rename(struct _reent *r, const char *src, const char *dst)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Create aliases for newlib syscalls
|
||||
|
||||
These functions are also available in ROM as stubs which use the syscall table, but linking them
|
||||
directly here saves an additional function call when a software function is linked to one, and
|
||||
makes linking with -stdlib easier.
|
||||
*/
|
||||
int _open_r(struct _reent *r, const char * path, int flags, int mode)
|
||||
__attribute__((alias("esp_vfs_open")));
|
||||
ssize_t _write_r(struct _reent *r, int fd, const void * data, size_t size)
|
||||
__attribute__((alias("esp_vfs_write")));
|
||||
off_t _lseek_r(struct _reent *r, int fd, off_t size, int mode)
|
||||
__attribute__((alias("esp_vfs_lseek")));
|
||||
ssize_t _read_r(struct _reent *r, int fd, void * dst, size_t size)
|
||||
__attribute__((alias("esp_vfs_read")));
|
||||
int _close_r(struct _reent *r, int fd)
|
||||
__attribute__((alias("esp_vfs_close")));
|
||||
int _fstat_r(struct _reent *r, int fd, struct stat * st)
|
||||
__attribute__((alias("esp_vfs_fstat")));
|
||||
int _stat_r(struct _reent *r, const char * path, struct stat * st)
|
||||
__attribute__((alias("esp_vfs_stat")));
|
||||
int _link_r(struct _reent *r, const char* n1, const char* n2)
|
||||
__attribute__((alias("esp_vfs_link")));
|
||||
int _unlink_r(struct _reent *r, const char *path)
|
||||
__attribute__((alias("esp_vfs_unlink")));
|
||||
int _rename_r(struct _reent *r, const char *src, const char *dst)
|
||||
__attribute__((alias("esp_vfs_rename")));
|
||||
|
||||
|
||||
DIR* opendir(const char* name)
|
||||
{
|
||||
const vfs_entry_t* vfs = get_vfs_for_path(name);
|
||||
@@ -1193,3 +1221,8 @@ int esp_vfs_poll(struct pollfd *fds, nfds_t nfds, int timeout)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void vfs_include_syscalls_impl()
|
||||
{
|
||||
// Linker hook function, exists to make the linker examine this fine
|
||||
}
|
||||
|
Reference in New Issue
Block a user