Skip to content

Commit

Permalink
MAX: Declare libc function stubs as weak
Browse files Browse the repository at this point in the history
Declares _getpid() and _kill() function stubs as weak to avoid
conflicting with similar function stubs defined in zephyr libc-hooks.
This fixes linker errors when building zephyr with newlib on max32
boards.

Signed-off-by: Maureen Helm <[email protected]>
  • Loading branch information
MaureenHelm authored and ozersa committed Jun 3, 2024
1 parent e836ab4 commit 3765bb8
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places
There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore
we implement stub functions that return an error code to resolve linker warnings.
*/
int _getpid(void)
__weak int _getpid(void)
{
return E_NOT_SUPPORTED;
}

int _kill(void)
__weak int _kill(void)
{
return E_NOT_SUPPORTED;
}
Expand Down

0 comments on commit 3765bb8

Please sign in to comment.