mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 18:25:58 +02:00
* dllprt0 stub for linux shared libs
* pass -init and -fini for linux shared libs * libprefix splitted into staticlibprefix and sharedlibprefix
This commit is contained in:
parent
34a674c6a1
commit
5fed44fe5d
@ -626,11 +626,11 @@ uses
|
|||||||
{ lib and exe could be loaded with a file specified with -o }
|
{ lib and exe could be loaded with a file specified with -o }
|
||||||
if AllowOutput and (OutputFile<>'') and (compile_level=1) then
|
if AllowOutput and (OutputFile<>'') and (compile_level=1) then
|
||||||
n:=OutputFile;
|
n:=OutputFile;
|
||||||
staticlibfilename:=stringdup(p+target_info.libprefix+n+target_info.staticlibext);
|
staticlibfilename:=stringdup(p+target_info.staticlibprefix+n+target_info.staticlibext);
|
||||||
if target_info.target=target_i386_WIN32 then
|
if target_info.target=target_i386_WIN32 then
|
||||||
sharedlibfilename:=stringdup(p+n+target_info.sharedlibext)
|
sharedlibfilename:=stringdup(p+n+target_info.sharedlibext)
|
||||||
else
|
else
|
||||||
sharedlibfilename:=stringdup(p+target_info.libprefix+n+target_info.sharedlibext);
|
sharedlibfilename:=stringdup(p+target_info.sharedlibprefix+n+target_info.sharedlibext);
|
||||||
{ output dir of exe can be specified separatly }
|
{ output dir of exe can be specified separatly }
|
||||||
if AllowOutput and (OutputExeDir<>'') then
|
if AllowOutput and (OutputExeDir<>'') then
|
||||||
p:=OutputExeDir
|
p:=OutputExeDir
|
||||||
@ -683,7 +683,12 @@ uses
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.9 2001-04-18 22:01:53 peter
|
Revision 1.10 2001-06-03 15:15:31 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.9 2001/04/18 22:01:53 peter
|
||||||
* registration of targets and assemblers
|
* registration of targets and assemblers
|
||||||
|
|
||||||
Revision 1.8 2001/04/13 01:22:07 peter
|
Revision 1.8 2001/04/13 01:22:07 peter
|
||||||
|
@ -132,7 +132,6 @@ interface
|
|||||||
destructor destroy;override;
|
destructor destroy;override;
|
||||||
procedure reset;virtual;
|
procedure reset;virtual;
|
||||||
procedure numberunits;
|
procedure numberunits;
|
||||||
procedure setfilename(const fn:string;allowoutput:boolean);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
tused_unit = class(tlinkedlistitem)
|
tused_unit = class(tlinkedlistitem)
|
||||||
@ -553,56 +552,6 @@ uses
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tmodule.setfilename(const fn:string;allowoutput:boolean);
|
|
||||||
var
|
|
||||||
p : dirstr;
|
|
||||||
n : NameStr;
|
|
||||||
e : ExtStr;
|
|
||||||
begin
|
|
||||||
stringdispose(objfilename);
|
|
||||||
stringdispose(asmfilename);
|
|
||||||
stringdispose(ppufilename);
|
|
||||||
stringdispose(staticlibfilename);
|
|
||||||
stringdispose(sharedlibfilename);
|
|
||||||
stringdispose(exefilename);
|
|
||||||
stringdispose(outputpath);
|
|
||||||
stringdispose(path);
|
|
||||||
{ Create names }
|
|
||||||
fsplit(fn,p,n,e);
|
|
||||||
n:=FixFileName(n);
|
|
||||||
{ set path }
|
|
||||||
path:=stringdup(FixPath(p,false));
|
|
||||||
{ obj,asm,ppu names }
|
|
||||||
p:=path^;
|
|
||||||
if AllowOutput then
|
|
||||||
begin
|
|
||||||
if (OutputUnitDir<>'') then
|
|
||||||
p:=OutputUnitDir
|
|
||||||
else
|
|
||||||
if (OutputExeDir<>'') then
|
|
||||||
p:=OutputExeDir;
|
|
||||||
end;
|
|
||||||
outputpath:=stringdup(p);
|
|
||||||
objfilename:=stringdup(p+n+target_info.objext);
|
|
||||||
asmfilename:=stringdup(p+n+target_info.asmext);
|
|
||||||
ppufilename:=stringdup(p+n+target_info.unitext);
|
|
||||||
{ lib and exe could be loaded with a file specified with -o }
|
|
||||||
if AllowOutput and (OutputFile<>'') and (compile_level=1) then
|
|
||||||
n:=OutputFile;
|
|
||||||
staticlibfilename:=stringdup(p+target_info.libprefix+n+target_info.staticlibext);
|
|
||||||
if target_info.target=target_i386_WIN32 then
|
|
||||||
sharedlibfilename:=stringdup(p+n+target_info.sharedlibext)
|
|
||||||
else
|
|
||||||
sharedlibfilename:=stringdup(p+target_info.libprefix+n+target_info.sharedlibext);
|
|
||||||
{ output dir of exe can be specified separatly }
|
|
||||||
if AllowOutput and (OutputExeDir<>'') then
|
|
||||||
p:=OutputExeDir
|
|
||||||
else
|
|
||||||
p:=path^;
|
|
||||||
exefilename:=stringdup(p+n+target_info.exeext);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure tmodule.numberunits;
|
procedure tmodule.numberunits;
|
||||||
var
|
var
|
||||||
counter : longint;
|
counter : longint;
|
||||||
@ -636,7 +585,12 @@ uses
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.15 2001-05-09 14:11:10 jonas
|
Revision 1.16 2001-06-03 15:15:31 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.15 2001/05/09 14:11:10 jonas
|
||||||
* range check error fixes from Peter
|
* range check error fixes from Peter
|
||||||
|
|
||||||
Revision 1.14 2001/05/06 14:49:16 peter
|
Revision 1.14 2001/05/06 14:49:16 peter
|
||||||
|
@ -323,8 +323,8 @@ begin
|
|||||||
if s='' then
|
if s='' then
|
||||||
exit;
|
exit;
|
||||||
{ remove prefix 'lib' }
|
{ remove prefix 'lib' }
|
||||||
if Copy(s,1,length(target_info.libprefix))=target_info.libprefix then
|
if Copy(s,1,length(target_info.sharedlibprefix))=target_info.sharedlibprefix then
|
||||||
Delete(s,1,length(target_info.libprefix));
|
Delete(s,1,length(target_info.sharedlibprefix));
|
||||||
{ remove extension if any }
|
{ remove extension if any }
|
||||||
if Copy(s,length(s)-length(target_info.sharedlibext)+1,length(target_info.sharedlibext))=target_info.sharedlibext then
|
if Copy(s,length(s)-length(target_info.sharedlibext)+1,length(target_info.sharedlibext))=target_info.sharedlibext then
|
||||||
Delete(s,length(s)-length(target_info.sharedlibext)+1,length(target_info.sharedlibext)+1);
|
Delete(s,length(s)-length(target_info.sharedlibext)+1,length(target_info.sharedlibext)+1);
|
||||||
@ -482,7 +482,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.16 2001-04-18 22:01:54 peter
|
Revision 1.17 2001-06-03 15:15:31 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.16 2001/04/18 22:01:54 peter
|
||||||
* registration of targets and assemblers
|
* registration of targets and assemblers
|
||||||
|
|
||||||
Revision 1.15 2001/04/13 01:22:08 peter
|
Revision 1.15 2001/04/13 01:22:08 peter
|
||||||
|
@ -1189,14 +1189,26 @@ implementation
|
|||||||
{The program intialization needs an alias, so it can be called
|
{The program intialization needs an alias, so it can be called
|
||||||
from the bootstrap code.}
|
from the bootstrap code.}
|
||||||
codegen_newprocedure;
|
codegen_newprocedure;
|
||||||
gen_main_procsym('main',potype_proginit,st);
|
if islibrary then
|
||||||
aktprocsym.definition.aliasnames.insert('program_init');
|
begin
|
||||||
aktprocsym.definition.aliasnames.insert('PASCALMAIN');
|
gen_main_procsym(current_module.modulename^+'_main',potype_proginit,st);
|
||||||
aktprocsym.definition.aliasnames.insert(target_info.cprefix+'main');
|
aktprocsym.definition.aliasnames.insert(target_info.cprefix+current_module.modulename^+'_main');
|
||||||
|
aktprocsym.definition.aliasnames.insert('PASCALMAIN');
|
||||||
|
{ this code is called from C so we need to save some
|
||||||
|
registers }
|
||||||
|
include(aktprocsym.definition.procoptions,po_savestdregs);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
gen_main_procsym('main',potype_proginit,st);
|
||||||
|
aktprocsym.definition.aliasnames.insert('program_init');
|
||||||
|
aktprocsym.definition.aliasnames.insert('PASCALMAIN');
|
||||||
|
aktprocsym.definition.aliasnames.insert(target_info.cprefix+'main');
|
||||||
{$ifdef m68k}
|
{$ifdef m68k}
|
||||||
if target_info.target=target_m68k_PalmOS then
|
if target_info.target=target_m68k_PalmOS then
|
||||||
aktprocsym.definition.aliasnames.insert('PilotMain');
|
aktprocsym.definition.aliasnames.insert('PilotMain');
|
||||||
{$endif m68k}
|
{$endif m68k}
|
||||||
|
end;
|
||||||
compile_proc_body(true,false);
|
compile_proc_body(true,false);
|
||||||
|
|
||||||
{ avoid self recursive destructor call !! PM }
|
{ avoid self recursive destructor call !! PM }
|
||||||
@ -1316,7 +1328,12 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.33 2001-05-19 23:05:19 peter
|
Revision 1.34 2001-06-03 15:15:31 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.33 2001/05/19 23:05:19 peter
|
||||||
* support uses <unit> in <file> construction
|
* support uses <unit> in <file> construction
|
||||||
|
|
||||||
Revision 1.32 2001/05/18 22:26:36 peter
|
Revision 1.32 2001/05/18 22:26:36 peter
|
||||||
|
@ -154,7 +154,8 @@ interface
|
|||||||
objext,
|
objext,
|
||||||
resext,
|
resext,
|
||||||
resobjext : string[4];
|
resobjext : string[4];
|
||||||
libprefix : string[4];
|
staticlibprefix : string[4];
|
||||||
|
sharedlibprefix : string[4];
|
||||||
Cprefix : string[2];
|
Cprefix : string[2];
|
||||||
newline : string[2];
|
newline : string[2];
|
||||||
assem : tasm;
|
assem : tasm;
|
||||||
@ -573,7 +574,12 @@ finalization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.17 2001-06-02 19:21:45 peter
|
Revision 1.18 2001-06-03 15:15:31 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.17 2001/06/02 19:21:45 peter
|
||||||
* extradefines field added to target_info, so that targets don't
|
* extradefines field added to target_info, so that targets don't
|
||||||
need to put code in options.pas for it
|
need to put code in options.pas for it
|
||||||
|
|
||||||
|
@ -64,7 +64,8 @@ implementation
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : '';
|
staticlibprefix : '';
|
||||||
|
sharedlibprefix : '';
|
||||||
Cprefix : '_';
|
Cprefix : '_';
|
||||||
newline : #10;
|
newline : #10;
|
||||||
assem : as_m68k_as;
|
assem : as_m68k_as;
|
||||||
@ -92,7 +93,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.2 2001-06-02 19:22:44 peter
|
Revision 1.3 2001-06-03 15:15:31 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.2 2001/06/02 19:22:44 peter
|
||||||
* extradefines field added
|
* extradefines field added
|
||||||
|
|
||||||
Revision 1.1 2001/04/18 22:02:04 peter
|
Revision 1.1 2001/04/18 22:02:04 peter
|
||||||
|
@ -64,7 +64,8 @@ implementation
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : '';
|
staticlibprefix : '';
|
||||||
|
sharedlibprefix : '';
|
||||||
Cprefix : '_';
|
Cprefix : '_';
|
||||||
newline : #10;
|
newline : #10;
|
||||||
assem : as_m68k_as;
|
assem : as_m68k_as;
|
||||||
@ -92,7 +93,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.2 2001-06-02 19:22:44 peter
|
Revision 1.3 2001-06-03 15:15:31 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.2 2001/06/02 19:22:44 peter
|
||||||
* extradefines field added
|
* extradefines field added
|
||||||
|
|
||||||
Revision 1.1 2001/04/18 22:02:04 peter
|
Revision 1.1 2001/04/18 22:02:04 peter
|
||||||
|
@ -462,7 +462,8 @@ end;
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : 'libp';
|
staticlibprefix : 'libp';
|
||||||
|
sharedlibprefix : 'lib';
|
||||||
Cprefix : '';
|
Cprefix : '';
|
||||||
newline : #10;
|
newline : #10;
|
||||||
assem : as_i386_as;
|
assem : as_i386_as;
|
||||||
@ -495,7 +496,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.1 2001-06-02 19:29:37 peter
|
Revision 1.2 2001-06-03 15:15:31 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.1 2001/06/02 19:29:37 peter
|
||||||
* beos target
|
* beos target
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -473,7 +473,8 @@ end;
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : 'libp';
|
staticlibprefix : 'libp';
|
||||||
|
sharedlibprefix : 'lib';
|
||||||
Cprefix : '';
|
Cprefix : '';
|
||||||
newline : #10;
|
newline : #10;
|
||||||
assem : as_i386_elf32;
|
assem : as_i386_elf32;
|
||||||
@ -504,7 +505,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 2001-06-02 19:22:44 peter
|
Revision 1.6 2001-06-03 15:15:31 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.5 2001/06/02 19:22:44 peter
|
||||||
* extradefines field added
|
* extradefines field added
|
||||||
|
|
||||||
Revision 1.4 2001/04/21 15:34:01 peter
|
Revision 1.4 2001/04/21 15:34:01 peter
|
||||||
|
@ -215,7 +215,8 @@ end;
|
|||||||
objext : '.o1';
|
objext : '.o1';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.o1r';
|
resobjext : '.o1r';
|
||||||
libprefix : '';
|
staticlibprefix : '';
|
||||||
|
sharedlibprefix : '';
|
||||||
Cprefix : '_';
|
Cprefix : '_';
|
||||||
newline : #13#10;
|
newline : #13#10;
|
||||||
assem : as_i386_as;
|
assem : as_i386_as;
|
||||||
@ -244,7 +245,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.4 2001-06-02 19:22:44 peter
|
Revision 1.5 2001-06-03 15:15:31 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.4 2001/06/02 19:22:44 peter
|
||||||
* extradefines field added
|
* extradefines field added
|
||||||
|
|
||||||
Revision 1.3 2001/04/18 22:02:04 peter
|
Revision 1.3 2001/04/18 22:02:04 peter
|
||||||
|
@ -443,7 +443,8 @@ end;
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : '';
|
staticlibprefix : '';
|
||||||
|
sharedlibprefix : '';
|
||||||
Cprefix : '_';
|
Cprefix : '_';
|
||||||
newline : #13#10;
|
newline : #13#10;
|
||||||
assem : as_i386_coff;
|
assem : as_i386_coff;
|
||||||
@ -472,7 +473,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.4 2001-06-02 19:22:44 peter
|
Revision 1.5 2001-06-03 15:15:31 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.4 2001/06/02 19:22:44 peter
|
||||||
* extradefines field added
|
* extradefines field added
|
||||||
|
|
||||||
Revision 1.3 2001/04/18 22:02:04 peter
|
Revision 1.3 2001/04/18 22:02:04 peter
|
||||||
|
@ -164,13 +164,18 @@ begin
|
|||||||
begin
|
begin
|
||||||
if not hp2.is_var then
|
if not hp2.is_var then
|
||||||
begin
|
begin
|
||||||
|
{ the manglednames can already be the same when the procedure
|
||||||
|
is declared with cdecl }
|
||||||
|
if hp2.sym.mangledname<>hp2.name^ then
|
||||||
|
begin
|
||||||
{$ifdef i386}
|
{$ifdef i386}
|
||||||
{ place jump in codesegment }
|
{ place jump in codesegment }
|
||||||
codesegment.concat(Tai_align.Create_op(4,$90));
|
codesegment.concat(Tai_align.Create_op(4,$90));
|
||||||
codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
|
codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
|
||||||
codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,newasmsymbol(hp2.sym.mangledname)));
|
codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,newasmsymbol(hp2.sym.mangledname)));
|
||||||
codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
|
codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
|
||||||
{$endif i386}
|
{$endif i386}
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Message1(parser_e_no_export_of_variables_for_target,'linux');
|
Message1(parser_e_no_export_of_variables_for_target,'linux');
|
||||||
@ -200,7 +205,7 @@ begin
|
|||||||
with Info do
|
with Info do
|
||||||
begin
|
begin
|
||||||
ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE $RES';
|
ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE $RES';
|
||||||
DllCmd[1]:='ld $OPT -shared -L. -o $EXE $RES';
|
DllCmd[1]:='ld $OPT $INIT $FINI $SONAME -shared -L. -o $EXE $RES';
|
||||||
DllCmd[2]:='strip --strip-unneeded $EXE';
|
DllCmd[2]:='strip --strip-unneeded $EXE';
|
||||||
{ first try glibc2 }
|
{ first try glibc2 }
|
||||||
DynamicLinker:='/lib/ld-linux.so.2';
|
DynamicLinker:='/lib/ld-linux.so.2';
|
||||||
@ -215,11 +220,7 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
DynamicLinker:='/lib/ld-linux.so.1';
|
DynamicLinker:='/lib/ld-linux.so.1';
|
||||||
{$ifdef BSD}
|
|
||||||
DynamicLinker:='';
|
|
||||||
{$endif}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -239,13 +240,22 @@ begin
|
|||||||
{ set special options for some targets }
|
{ set special options for some targets }
|
||||||
linkdynamic:=not(SharedLibFiles.empty);
|
linkdynamic:=not(SharedLibFiles.empty);
|
||||||
linklibc:=(SharedLibFiles.Find('c')<>nil);
|
linklibc:=(SharedLibFiles.Find('c')<>nil);
|
||||||
prtobj:='prt0';
|
if isdll then
|
||||||
cprtobj:='cprt0';
|
|
||||||
gprtobj:='gprt0';
|
|
||||||
if glibc21 then
|
|
||||||
begin
|
begin
|
||||||
cprtobj:='cprt21';
|
prtobj:='dllprt0';
|
||||||
gprtobj:='gprt21';
|
cprtobj:='dllprt0';
|
||||||
|
gprtobj:='dllprt0';
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
prtobj:='prt0';
|
||||||
|
cprtobj:='cprt0';
|
||||||
|
gprtobj:='gprt0';
|
||||||
|
if glibc21 then
|
||||||
|
begin
|
||||||
|
cprtobj:='cprt21';
|
||||||
|
gprtobj:='gprt21';
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
if cs_profile in aktmoduleswitches then
|
if cs_profile in aktmoduleswitches then
|
||||||
begin
|
begin
|
||||||
@ -410,6 +420,9 @@ end;
|
|||||||
|
|
||||||
Function TLinkerLinux.MakeSharedLibrary:boolean;
|
Function TLinkerLinux.MakeSharedLibrary:boolean;
|
||||||
var
|
var
|
||||||
|
InitStr,
|
||||||
|
FiniStr,
|
||||||
|
SoNameStr : string[80];
|
||||||
binstr,
|
binstr,
|
||||||
cmdstr : string;
|
cmdstr : string;
|
||||||
success : boolean;
|
success : boolean;
|
||||||
@ -421,11 +434,19 @@ begin
|
|||||||
{ Write used files and libraries }
|
{ Write used files and libraries }
|
||||||
WriteResponseFile(true);
|
WriteResponseFile(true);
|
||||||
|
|
||||||
|
{ Create some replacements }
|
||||||
|
InitStr:='-init FPC_LIB_START';
|
||||||
|
FiniStr:='-fini FPC_LIB_EXIT';
|
||||||
|
SoNameStr:='-soname '+SplitFileName(current_module.sharedlibfilename^);
|
||||||
|
|
||||||
{ Call linker }
|
{ Call linker }
|
||||||
SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
|
SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
|
||||||
Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
|
Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
|
||||||
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
||||||
Replace(cmdstr,'$RES',outputexedir+Info.ResName);
|
Replace(cmdstr,'$RES',outputexedir+Info.ResName);
|
||||||
|
Replace(cmdstr,'$INIT',InitStr);
|
||||||
|
Replace(cmdstr,'$FINI',FiniStr);
|
||||||
|
Replace(cmdstr,'$SONAME',SoNameStr);
|
||||||
success:=DoExec(FindUtil(binstr),cmdstr,true,false);
|
success:=DoExec(FindUtil(binstr),cmdstr,true,false);
|
||||||
|
|
||||||
{ Strip the library ? }
|
{ Strip the library ? }
|
||||||
@ -473,7 +494,8 @@ end;
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : 'libp';
|
staticlibprefix : 'libp';
|
||||||
|
sharedlibprefix : 'lib';
|
||||||
Cprefix : '';
|
Cprefix : '';
|
||||||
newline : #10;
|
newline : #10;
|
||||||
assem : as_i386_elf32;
|
assem : as_i386_elf32;
|
||||||
@ -521,7 +543,8 @@ end;
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : 'libp';
|
staticlibprefix : 'libp';
|
||||||
|
sharedlibprefix : 'lib';
|
||||||
Cprefix : '';
|
Cprefix : '';
|
||||||
newline : #10;
|
newline : #10;
|
||||||
assem : as_m68k_as;
|
assem : as_m68k_as;
|
||||||
@ -569,7 +592,8 @@ end;
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : 'libp';
|
staticlibprefix : 'libp';
|
||||||
|
sharedlibprefix : 'lib';
|
||||||
Cprefix : '';
|
Cprefix : '';
|
||||||
newline : #10;
|
newline : #10;
|
||||||
assem : as_powerpc_as;
|
assem : as_powerpc_as;
|
||||||
@ -615,7 +639,8 @@ end;
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : 'libp';
|
staticlibprefix : 'libp';
|
||||||
|
sharedlibprefix : 'lib';
|
||||||
Cprefix : '';
|
Cprefix : '';
|
||||||
newline : #10;
|
newline : #10;
|
||||||
assem : as_alpha_as;
|
assem : as_alpha_as;
|
||||||
@ -667,7 +692,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.6 2001-06-02 19:22:44 peter
|
Revision 1.7 2001-06-03 15:15:31 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.6 2001/06/02 19:22:44 peter
|
||||||
* extradefines field added
|
* extradefines field added
|
||||||
|
|
||||||
Revision 1.5 2001/04/21 15:34:01 peter
|
Revision 1.5 2001/04/21 15:34:01 peter
|
||||||
|
@ -65,7 +65,8 @@ implementation
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : '';
|
staticlibprefix : '';
|
||||||
|
sharedlibprefix : '';
|
||||||
Cprefix : '_';
|
Cprefix : '_';
|
||||||
newline : #13;
|
newline : #13;
|
||||||
assem : as_m68k_mpw;
|
assem : as_m68k_mpw;
|
||||||
@ -114,7 +115,8 @@ implementation
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : '';
|
staticlibprefix : '';
|
||||||
|
sharedlibprefix : '';
|
||||||
Cprefix : '';
|
Cprefix : '';
|
||||||
newline : #13;
|
newline : #13;
|
||||||
assem : as_powerpc_mpw;
|
assem : as_powerpc_mpw;
|
||||||
@ -148,7 +150,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.2 2001-06-02 19:22:44 peter
|
Revision 1.3 2001-06-03 15:15:32 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.2 2001/06/02 19:22:44 peter
|
||||||
* extradefines field added
|
* extradefines field added
|
||||||
|
|
||||||
Revision 1.1 2001/04/18 22:02:04 peter
|
Revision 1.1 2001/04/18 22:02:04 peter
|
||||||
|
@ -479,7 +479,8 @@ end;
|
|||||||
objext : '.on';
|
objext : '.on';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : '';
|
staticlibprefix : '';
|
||||||
|
sharedlibprefix : '';
|
||||||
Cprefix : '';
|
Cprefix : '';
|
||||||
newline : #13#10;
|
newline : #13#10;
|
||||||
assem : as_i386_elf32;
|
assem : as_i386_elf32;
|
||||||
@ -510,7 +511,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 2001-06-02 19:22:44 peter
|
Revision 1.6 2001-06-03 15:15:32 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.5 2001/06/02 19:22:44 peter
|
||||||
* extradefines field added
|
* extradefines field added
|
||||||
|
|
||||||
Revision 1.4 2001/05/30 21:35:49 peter
|
Revision 1.4 2001/05/30 21:35:49 peter
|
||||||
|
@ -537,7 +537,8 @@ end;
|
|||||||
objext : '.oo2';
|
objext : '.oo2';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.oor';
|
resobjext : '.oor';
|
||||||
libprefix : '';
|
staticlibprefix : '';
|
||||||
|
sharedlibprefix : '';
|
||||||
Cprefix : '_';
|
Cprefix : '_';
|
||||||
newline : #13#10;
|
newline : #13#10;
|
||||||
assem : as_i386_as_aout;
|
assem : as_i386_as_aout;
|
||||||
@ -568,7 +569,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 2001-06-02 19:22:44 peter
|
Revision 1.6 2001-06-03 15:15:32 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.5 2001/06/02 19:22:44 peter
|
||||||
* extradefines field added
|
* extradefines field added
|
||||||
|
|
||||||
Revision 1.4 2001/04/18 22:02:04 peter
|
Revision 1.4 2001/04/18 22:02:04 peter
|
||||||
|
@ -65,7 +65,8 @@ implementation
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : 'libp';
|
staticlibprefix : 'libp';
|
||||||
|
sharedlibprefix : 'lib';
|
||||||
Cprefix : '_';
|
Cprefix : '_';
|
||||||
newline : #10;
|
newline : #10;
|
||||||
assem : as_m68k_as;
|
assem : as_m68k_as;
|
||||||
@ -95,7 +96,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.2 2001-06-02 19:22:44 peter
|
Revision 1.3 2001-06-03 15:15:32 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.2 2001/06/02 19:22:44 peter
|
||||||
* extradefines field added
|
* extradefines field added
|
||||||
|
|
||||||
Revision 1.1 2001/04/18 22:02:04 peter
|
Revision 1.1 2001/04/18 22:02:04 peter
|
||||||
|
@ -502,7 +502,8 @@ end;
|
|||||||
objext : '.o';
|
objext : '.o';
|
||||||
resext : '.res';
|
resext : '.res';
|
||||||
resobjext : '.or';
|
resobjext : '.or';
|
||||||
libprefix : 'lib';
|
staticlibprefix : 'libp';
|
||||||
|
sharedlibprefix : 'lib';
|
||||||
Cprefix : '';
|
Cprefix : '';
|
||||||
newline : #10;
|
newline : #10;
|
||||||
assem : as_i386_as;
|
assem : as_i386_as;
|
||||||
@ -533,7 +534,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 2001-06-02 19:22:44 peter
|
Revision 1.6 2001-06-03 15:15:32 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.5 2001/06/02 19:22:44 peter
|
||||||
* extradefines field added
|
* extradefines field added
|
||||||
|
|
||||||
Revision 1.4 2001/04/21 15:34:01 peter
|
Revision 1.4 2001/04/21 15:34:01 peter
|
||||||
|
@ -1417,7 +1417,8 @@ function tDLLScannerWin32.scan(const binname:string):longbool;
|
|||||||
objext : '.ow';
|
objext : '.ow';
|
||||||
resext : '.rc';
|
resext : '.rc';
|
||||||
resobjext : '.owr';
|
resobjext : '.owr';
|
||||||
libprefix : 'libp';
|
staticlibprefix : 'libp';
|
||||||
|
sharedlibprefix : '';
|
||||||
Cprefix : '_';
|
Cprefix : '_';
|
||||||
newline : #13#10;
|
newline : #13#10;
|
||||||
assem : as_i386_pecoff;
|
assem : as_i386_pecoff;
|
||||||
@ -1451,7 +1452,12 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.8 2001-06-02 19:22:44 peter
|
Revision 1.9 2001-06-03 15:15:32 peter
|
||||||
|
* dllprt0 stub for linux shared libs
|
||||||
|
* pass -init and -fini for linux shared libs
|
||||||
|
* libprefix splitted into staticlibprefix and sharedlibprefix
|
||||||
|
|
||||||
|
Revision 1.8 2001/06/02 19:22:44 peter
|
||||||
* extradefines field added
|
* extradefines field added
|
||||||
|
|
||||||
Revision 1.7 2001/04/21 13:33:16 peter
|
Revision 1.7 2001/04/21 13:33:16 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user