-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libphoenix: compile with FPIC by default
JIRA: RTOS-664
- Loading branch information
Showing
5 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Phoenix-RTOS | ||
* | ||
* libphoenix | ||
* | ||
* tls access function | ||
* | ||
* Copyright 2023 Phoenix Systems | ||
* Author: Hubert Badocha | ||
* | ||
* This file is part of Phoenix-RTOS. | ||
* | ||
* %LICENSE% | ||
*/ | ||
|
||
|
||
/* NOTE: | ||
* When libphoenix is compiled as a PIC, even when linked into a static NOPIC binary, | ||
* compiler generates accesses to TLS as calls to this function. | ||
* This functions is simple version just for static binaries purposes, | ||
* in dynamic binaries dynamic linker handles TLS accesses. */ | ||
|
||
|
||
/* typedef struct { | ||
* unsigned long ti_moduleid; | ||
* unsigned long ti_tlsoffset; | ||
* } TLS_index; | ||
* | ||
* void *__tls_get_addr(TLS_index *ti) */ | ||
.globl __tls_get_addr; | ||
.type __tls_get_addr, %function; | ||
__tls_get_addr: | ||
/* Access ti_tlsoffset. */ | ||
ldr r0, [r0, #4] | ||
/* Get thread pointer. */ | ||
mrc p15, #0, r1, cr13, cr0, #3 | ||
/* GCC expects that TLS block has 8 byte TCB pointer at the begging. */ | ||
add r1, r1, #8 | ||
add r0, r0, r1 | ||
bx lr | ||
.size __tls_get_addr, .-__tls_get_addr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Phoenix-RTOS | ||
* | ||
* libphoenix | ||
* | ||
* tls access function | ||
* | ||
* Copyright 2023 Phoenix Systems | ||
* Author: Hubert Badocha | ||
* | ||
* This file is part of Phoenix-RTOS. | ||
* | ||
* %LICENSE% | ||
*/ | ||
|
||
/* NOTE: | ||
* When libphoenix is compiled as a PIC, even when linked into a static NOPIC binary, | ||
* compiler generates accesses to TLS as calls to this function. | ||
* This functions is simple version just for static binaries purposes, | ||
* in dynamic binaries dynamic linker handles TLS accesses. */ | ||
|
||
|
||
/* typedef struct { | ||
* unsigned long ti_moduleid; | ||
* unsigned long ti_tlsoffset; | ||
* } TLS_index; | ||
* | ||
* void *__tls_get_addr(TLS_index *ti) */ | ||
.globl __tls_get_addr; | ||
.type __tls_get_addr, %function; | ||
__tls_get_addr: | ||
/* Access ti_tlsoffset. */ | ||
ld a0, 8(a0) | ||
/* GCC expects that Dynamic Thread Vector pointer points at TLS block start + 0x800 */ | ||
li t0, 0x800 | ||
add a0, a0, t0 | ||
add a0, a0, tp | ||
ret | ||
.size __tls_get_addr, .-__tls_get_addr |