BSP: Added weak attribute into functions of BSP which are also present in tool chain
This patch fixes issue of multiple definition of function in toolchain and BSP for some special cases. Signed-off-by: Kinjal Pravinbhai Patel <patelki@xilinx.com> Acked-by: Anirudha Sarangi <anirudh@xilinx.com>
This commit is contained in:
parent
ed539f88e4
commit
84e5fc4775
25 changed files with 46 additions and 45 deletions
|
@ -182,5 +182,6 @@
|
|||
* cortexa9/xil_exception.c to fix CR#802862.
|
||||
* 4.2 pkp 06/30/14 MakeFile for cortexa9/armcc has been changed to fixes the
|
||||
* issue of improper linking of translation_table.s
|
||||
*
|
||||
* 4.2 pkp 07/04/14 added weak attribute for the function in BSP which are also present
|
||||
* in tool chain to avoid conflicts into some special cases
|
||||
*****************************************************************************************/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
// Stuv for close() sys-call
|
||||
int $Sub$$_sys_close(int fh)
|
||||
__weak int _sys_close(int fh)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
// Stuv for exit() sys-call
|
||||
void $Sub$$_sys_exit(int rc)
|
||||
__weak void _sys_exit(int rc)
|
||||
{
|
||||
while(1);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
// Stub for iserror() function
|
||||
int $Sub$$_sys_iserror(int status)
|
||||
__weak int _sys_iserror(int status)
|
||||
{
|
||||
if(status<0)
|
||||
return 1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
// Stub for istty sys-call
|
||||
int $Sub$$_sys_istty(unsigned int* f)
|
||||
__weak int _sys_istty(unsigned int* f)
|
||||
{
|
||||
/* cannot read/write files */
|
||||
return 1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
// Stub for open sys-call
|
||||
int $Sub$$_sys_open(const char* name, int openmode)
|
||||
__weak int _sys_open(const char* name, int openmode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
// Stub for read() sys-call
|
||||
int $Sub$$_sys_read(unsigned int fh, unsigned char *buf, unsigned int len, int mode)
|
||||
__weak int _sys_read(unsigned int fh, unsigned char *buf, unsigned int len, int mode)
|
||||
{
|
||||
// Return the number of character NOT read
|
||||
return len;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "xparameters.h"
|
||||
|
||||
int $Sub$$_sys_write(unsigned int fh, const unsigned char *buf, unsigned int len, int mode)
|
||||
__weak int _sys_write(unsigned int fh, const unsigned char *buf, unsigned int len, int mode)
|
||||
{
|
||||
#ifdef STDOUT_BASEADDRESS
|
||||
unsigned int volatile *uart_base = (unsigned int *)STDOUT_BASEADDRESS;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
/* _exit - Simple implementation. Does not return.
|
||||
*/
|
||||
void _exit (int status)
|
||||
__attribute__((weak)) void _exit (int status)
|
||||
{
|
||||
(void)status;
|
||||
while (1);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
int _open(const char *buf, int flags, int mode);
|
||||
__attribute__((weak)) int _open(const char *buf, int flags, int mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -42,7 +42,7 @@ extern "C" {
|
|||
* _open -- open a file descriptor. We don't have a filesystem, so
|
||||
* we return an error.
|
||||
*/
|
||||
int _open(const char *buf, int flags, int mode)
|
||||
__attribute__((weak)) int _open(const char *buf, int flags, int mode)
|
||||
{
|
||||
(void)buf;
|
||||
(void)flags;
|
||||
|
|
|
@ -37,11 +37,11 @@ extern int _heap_end;
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
caddr_t _sbrk ( int incr );
|
||||
__attribute__((weak)) caddr_t _sbrk ( int incr );
|
||||
}
|
||||
#endif
|
||||
|
||||
caddr_t _sbrk ( int incr )
|
||||
__attribute__((weak)) caddr_t _sbrk ( int incr )
|
||||
{
|
||||
static unsigned char *heap = NULL;
|
||||
unsigned char *prev_heap;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
/*
|
||||
* abort -- go out via exit...
|
||||
*/
|
||||
void abort(void)
|
||||
__attribute__((weak)) void abort(void)
|
||||
{
|
||||
_exit(1);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
******************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
int _close(int fd);
|
||||
__attribute__((weak)) int _close(int fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -39,7 +39,7 @@ extern "C" {
|
|||
* close -- We don't need to do anything, but pretend we did.
|
||||
*/
|
||||
|
||||
int _close(int fd)
|
||||
__attribute__((weak)) int _close(int fd)
|
||||
{
|
||||
(void)fd;
|
||||
return (0);
|
||||
|
|
|
@ -39,11 +39,11 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
int * __errno ();
|
||||
__attribute__((weak)) int * __errno ();
|
||||
}
|
||||
#endif
|
||||
|
||||
int *
|
||||
__attribute__((weak)) int *
|
||||
__errno ()
|
||||
{
|
||||
return &_REENT->_errno;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
* fcntl -- Manipulate a file descriptor.
|
||||
* We don't have a filesystem, so we do nothing.
|
||||
*/
|
||||
int fcntl (int fd, int cmd, long arg)
|
||||
__attribute__((weak)) int fcntl (int fd, int cmd, long arg)
|
||||
{
|
||||
(void)fd;
|
||||
(void)cmd;
|
||||
|
|
|
@ -34,13 +34,13 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
int _fstat(int fd, struct stat *buf);
|
||||
__attribute__((weak)) int _fstat(int fd, struct stat *buf);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* fstat -- Since we have no file system, we just return an error.
|
||||
*/
|
||||
int _fstat(int fd, struct stat *buf)
|
||||
__attribute__((weak)) int _fstat(int fd, struct stat *buf)
|
||||
{
|
||||
(void)fd;
|
||||
buf->st_mode = S_IFCHR; /* Always pretend to be a tty */
|
||||
|
|
|
@ -35,16 +35,16 @@
|
|||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
int _getpid();
|
||||
__attribute__((weak)) int _getpid();
|
||||
}
|
||||
#endif
|
||||
|
||||
int getpid()
|
||||
__attribute__((weak)) int getpid()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _getpid()
|
||||
__attribute__((weak)) int _getpid()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
int _isatty(int fd);
|
||||
__attribute__((weak)) int _isatty(int fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -42,13 +42,13 @@ extern "C" {
|
|||
* returns 0 if not. Since we're hooked up to a
|
||||
* serial port, we'll say yes _AND return a 1.
|
||||
*/
|
||||
int isatty(int fd)
|
||||
__attribute__((weak)) int isatty(int fd)
|
||||
{
|
||||
(void)fd;
|
||||
return (1);
|
||||
}
|
||||
|
||||
int _isatty(int fd)
|
||||
__attribute__((weak)) int _isatty(int fd)
|
||||
{
|
||||
(void)fd;
|
||||
return (1);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
int _kill(int pid, int sig);
|
||||
__attribute__((weak)) int _kill(int pid, int sig);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -42,14 +42,14 @@ extern "C" {
|
|||
* kill -- go out via exit...
|
||||
*/
|
||||
|
||||
int kill(int pid, int sig)
|
||||
__attribute__((weak)) int kill(int pid, int sig)
|
||||
{
|
||||
if(pid == 1)
|
||||
_exit(sig);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _kill(int pid, int sig)
|
||||
__attribute__((weak)) int _kill(int pid, int sig)
|
||||
{
|
||||
if(pid == 1)
|
||||
_exit(sig);
|
||||
|
|
|
@ -35,13 +35,13 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
off_t _lseek(int fd, off_t offset, int whence);
|
||||
__attribute__((weak)) off_t _lseek(int fd, off_t offset, int whence);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* lseek -- Since a serial port is non-seekable, we return an error.
|
||||
*/
|
||||
off_t lseek(int fd, off_t offset, int whence)
|
||||
__attribute__((weak)) off_t lseek(int fd, off_t offset, int whence)
|
||||
{
|
||||
(void)fd;
|
||||
(void)offset;
|
||||
|
@ -50,7 +50,7 @@ off_t lseek(int fd, off_t offset, int whence)
|
|||
return ((off_t)-1);
|
||||
}
|
||||
|
||||
off_t _lseek(int fd, off_t offset, int whence)
|
||||
__attribute__((weak)) off_t _lseek(int fd, off_t offset, int whence)
|
||||
{
|
||||
(void)fd;
|
||||
(void)offset;
|
||||
|
|
|
@ -34,14 +34,14 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
int open(const char *buf, int flags, int mode);
|
||||
__attribute__((weak)) int open(const char *buf, int flags, int mode);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* open -- open a file descriptor. We don't have a filesystem, so
|
||||
* we return an error.
|
||||
*/
|
||||
int open(const char *buf, int flags, int mode)
|
||||
__attribute__((weak)) int open(const char *buf, int flags, int mode)
|
||||
{
|
||||
(void)buf;
|
||||
(void)flags;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
int _read (int fd, char* buf, int nbytes);
|
||||
__attribute__((weak)) int _read (int fd, char* buf, int nbytes);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -46,7 +46,7 @@ extern "C" {
|
|||
* read -- read bytes from the serial port. Ignore fd, since
|
||||
* we only have stdin.
|
||||
*/
|
||||
int
|
||||
__attribute__((weak)) int
|
||||
read (int fd, char* buf, int nbytes)
|
||||
{
|
||||
#ifdef STDIN_BASEADDRESS
|
||||
|
@ -71,7 +71,7 @@ read (int fd, char* buf, int nbytes)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
__attribute__((weak)) int
|
||||
_read (int fd, char* buf, int nbytes)
|
||||
{
|
||||
#ifdef STDIN_BASEADDRESS
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <errno.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
char *sbrk (int nbytes);
|
||||
__attribute__((weak)) char *sbrk (int nbytes);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -44,7 +44,7 @@ extern char HeapLimit[];
|
|||
|
||||
static char *heap_ptr;
|
||||
|
||||
char *sbrk (int nbytes)
|
||||
__attribute__((weak)) char *sbrk (int nbytes)
|
||||
{
|
||||
char *base;
|
||||
|
||||
|
|
|
@ -34,14 +34,14 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
int unlink(char *path);
|
||||
__attribute__((weak)) int unlink(char *path);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* unlink -- since we have no file system,
|
||||
* we just return an error.
|
||||
*/
|
||||
int unlink(char *path)
|
||||
__attribute__((weak)) int unlink(char *path)
|
||||
{
|
||||
(void)path;
|
||||
errno = EIO;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
int _write (int fd, char* buf, int nbytes);
|
||||
__attribute__((weak)) int _write (int fd, char* buf, int nbytes);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -47,7 +47,7 @@ extern "C" {
|
|||
* stdout and stderr are the same. Since we have no filesystem,
|
||||
* open will only return an error.
|
||||
*/
|
||||
int
|
||||
__attribute__((weak)) int
|
||||
write (int fd, char* buf, int nbytes)
|
||||
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ write (int fd, char* buf, int nbytes)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
__attribute__((weak)) int
|
||||
_write (int fd, char* buf, int nbytes)
|
||||
{
|
||||
#ifdef STDOUT_BASEADDRESS
|
||||
|
|
Loading…
Add table
Reference in a new issue