mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-10 19:26:09 +02:00
parent
442598d9f8
commit
8c8042aaf0
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -6793,6 +6793,7 @@ tests/test/tintfdef.pp svneol=native#text/plain
|
||||
tests/test/tintuint.pp svneol=native#text/plain
|
||||
tests/test/tlibrary1.pp svneol=native#text/plain
|
||||
tests/test/tlibrary2.pp svneol=native#text/plain
|
||||
tests/test/tlibrary3.pp svneol=native#text/plain
|
||||
tests/test/tmacbool.pp svneol=native#text/plain
|
||||
tests/test/tmacfunret.pp svneol=native#text/plain
|
||||
tests/test/tmaclocalprocparam.pp svneol=native#text/plain
|
||||
|
@ -425,10 +425,22 @@ begin
|
||||
{ try to add crti and crtbegin if linking to C }
|
||||
if linklibc then
|
||||
begin
|
||||
if librarysearchpath.FindFile('crtbegin.o',false,s) then
|
||||
AddFileName(s);
|
||||
{ x86_64 requires this to use entry/exit code with pic,
|
||||
see also issue #8210 regarding a discussion
|
||||
no idea about the other non i386 CPUs (FK)
|
||||
}
|
||||
{$ifdef x86_64}
|
||||
if current_module.islibrary then
|
||||
begin
|
||||
if librarysearchpath.FindFile('crtbeginS.o',false,s) then
|
||||
AddFileName(s);
|
||||
end
|
||||
else
|
||||
{$endif x86_64}
|
||||
if librarysearchpath.FindFile('crtbegin.o',false,s) then
|
||||
AddFileName(s);
|
||||
if librarysearchpath.FindFile('crti.o',false,s) then
|
||||
AddFileName(s);
|
||||
AddFileName(s);
|
||||
end;
|
||||
{ main objectfiles }
|
||||
while not ObjectFiles.Empty do
|
||||
@ -490,7 +502,17 @@ begin
|
||||
{ objects which must be at the end }
|
||||
if linklibc and (libctype<>uclibc) then
|
||||
begin
|
||||
found1:=librarysearchpath.FindFile('crtend.o',false,s1);
|
||||
{ x86_64 requires this to use entry/exit code with pic,
|
||||
see also issue #8210 regarding a discussion
|
||||
no idea about the other non i386 CPUs (FK)
|
||||
}
|
||||
{$ifdef x86_64}
|
||||
if current_module.islibrary then
|
||||
found1:=librarysearchpath.FindFile('crtendS.o',false,s1)
|
||||
else
|
||||
{$else x86_64}
|
||||
found1:=librarysearchpath.FindFile('crtend.o',false,s1);
|
||||
{$endif x86_64}
|
||||
found2:=librarysearchpath.FindFile('crtn.o',false,s2);
|
||||
if found1 or found2 then
|
||||
begin
|
||||
|
54
tests/test/tlibrary3.pp
Normal file
54
tests/test/tlibrary3.pp
Normal file
@ -0,0 +1,54 @@
|
||||
{ %NORUN }
|
||||
{ %SKIPTARGET=macos }
|
||||
|
||||
{$ifdef CPUX86_64}
|
||||
{$ifndef WINDOWS}
|
||||
{$PIC+}
|
||||
{$endif WINDOWS}
|
||||
{$endif CPUX86_64}
|
||||
|
||||
{ The .so of the library needs to be in the current dir when
|
||||
testing the loading at runtime }
|
||||
|
||||
{$ifdef mswindows}
|
||||
{$define supported}
|
||||
{$define supportidx}
|
||||
{$endif win32}
|
||||
{$ifdef Unix}
|
||||
{$define supported}
|
||||
{$endif Unix}
|
||||
{$ifndef fpc}
|
||||
{$define supported}
|
||||
{$endif}
|
||||
|
||||
{$ifdef supported}
|
||||
|
||||
library bug;
|
||||
|
||||
uses
|
||||
initc;
|
||||
|
||||
const
|
||||
publicname='TestName';
|
||||
publicindex = 1234;
|
||||
|
||||
procedure Test;export;
|
||||
|
||||
begin
|
||||
// writeln('Hoi');
|
||||
end;
|
||||
|
||||
exports
|
||||
Test name publicname;
|
||||
{$ifdef supportidx}
|
||||
exports
|
||||
Test index publicindex;
|
||||
{$endif}
|
||||
|
||||
begin
|
||||
end.
|
||||
{$else supported}
|
||||
begin
|
||||
Writeln('No library for that target');
|
||||
end.
|
||||
{$endif supported}
|
Loading…
Reference in New Issue
Block a user