summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-03-12 21:59:18 +0000
committerflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-03-12 21:59:18 +0000
commit0392eb5ebfa4ffbee63437a929f18b597d1acb60 (patch)
tree416bdb8dcfb97931f54978fea7654b277d0825f8
parente4012965427d70001bee905e09fe3b5ced50d599 (diff)
downloadfpc-0392eb5ebfa4ffbee63437a929f18b597d1acb60.tar.gz
* RiscV: if shared libraries are involved, we have to link always against the crt*S.o variants
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@48946 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--compiler/systems/t_linux.pas16
1 files changed, 14 insertions, 2 deletions
diff --git a/compiler/systems/t_linux.pas b/compiler/systems/t_linux.pas
index aab48cbcae..7145003bce 100644
--- a/compiler/systems/t_linux.pas
+++ b/compiler/systems/t_linux.pas
@@ -538,7 +538,13 @@ begin
Message1(exec_w_init_file_not_found,'crti.o');
{ then the crtbegin* }
- if cs_create_pic in current_settings.moduleswitches then
+ if (cs_create_pic in current_settings.moduleswitches)
+{$ifdef RISCV}
+ { on RISC-V we need to use always the *S.o variants
+ if shared libraries are involved }
+ or (not SharedLibFiles.Empty)
+{$endif RISCV}
+ then
begin
if librarysearchpath.FindFile('crtbeginS.o',false,s) then
AddFileName(s)
@@ -649,7 +655,13 @@ begin
{ objects which must be at the end }
if linklibc and (libctype<>uclibc) then
begin
- if cs_create_pic in current_settings.moduleswitches then
+ if (cs_create_pic in current_settings.moduleswitches)
+{$ifdef RISCV}
+ { on RISC-V we need to use always the *S.o variants
+ if shared libraries are involved }
+ or linksToSharedLibFiles
+{$endif RISCV}
+ then
begin
found1:=librarysearchpath.FindFile('crtendS.o',false,s1);
if not(found1) then