|
@@ -398,8 +398,8 @@ begin
|
|
|
|
|
|
with Info do
|
|
with Info do
|
|
begin
|
|
begin
|
|
- ExeCmd[1]:='ld '+platform_select+platformopt+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP $LTO -L. -o $EXE';
|
|
|
|
- DllCmd[1]:='ld '+platform_select+platformopt+' $OPT $INIT $FINI $SONAME $MAP $LTO -shared $GCSECTIONS -L. -o $EXE';
|
|
|
|
|
|
+ ExeCmd[1]:='ld '+platform_select+platformopt+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP $LTO $RPATH -L. -o $EXE';
|
|
|
|
+ DllCmd[1]:='ld '+platform_select+platformopt+' $OPT $INIT $FINI $SONAME $MAP $LTO $RPATH -shared $GCSECTIONS -L. -o $EXE';
|
|
{ when we want to cross-link we need to override default library paths;
|
|
{ when we want to cross-link we need to override default library paths;
|
|
when targeting binutils 2.19 or later, we use the "INSERT" command to
|
|
when targeting binutils 2.19 or later, we use the "INSERT" command to
|
|
augment the default linkerscript, which also requires -T (normally that
|
|
augment the default linkerscript, which also requires -T (normally that
|
|
@@ -740,7 +740,9 @@ var
|
|
binstr,
|
|
binstr,
|
|
cmdstr,
|
|
cmdstr,
|
|
mapstr,
|
|
mapstr,
|
|
- ltostr : TCmdStr;
|
|
|
|
|
|
+ ltostr,
|
|
|
|
+ rpathstr,
|
|
|
|
+ sanitizerLibraryDir: TCmdStr;
|
|
success : boolean;
|
|
success : boolean;
|
|
DynLinkStr : ansistring;
|
|
DynLinkStr : ansistring;
|
|
GCSectionsStr,
|
|
GCSectionsStr,
|
|
@@ -757,6 +759,7 @@ begin
|
|
DynLinkStr:='';
|
|
DynLinkStr:='';
|
|
mapstr:='';
|
|
mapstr:='';
|
|
ltostr:='';
|
|
ltostr:='';
|
|
|
|
+ rpathstr:='';
|
|
if (cs_link_staticflag in current_settings.globalswitches) then
|
|
if (cs_link_staticflag in current_settings.globalswitches) then
|
|
StaticStr:='-static';
|
|
StaticStr:='-static';
|
|
if (cs_link_strip in current_settings.globalswitches) and
|
|
if (cs_link_strip in current_settings.globalswitches) and
|
|
@@ -786,6 +789,11 @@ begin
|
|
ltostr:='-plugin '+maybequoted(utilsdirectory+'/../lib/LLVMgold.so ');
|
|
ltostr:='-plugin '+maybequoted(utilsdirectory+'/../lib/LLVMgold.so ');
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ if AddSanitizerLibrariesAndGetSearchDir('linux',sanitizerLibraryDir) then
|
|
|
|
+ begin
|
|
|
|
+ rpathstr:='-rpath '+maybequoted(sanitizerLibraryDir);
|
|
|
|
+ end;
|
|
|
|
+
|
|
{ Write used files and libraries }
|
|
{ Write used files and libraries }
|
|
WriteResponseFile(false);
|
|
WriteResponseFile(false);
|
|
|
|
|
|
@@ -800,6 +808,7 @@ begin
|
|
Replace(cmdstr,'$DYNLINK',DynLinkStr);
|
|
Replace(cmdstr,'$DYNLINK',DynLinkStr);
|
|
Replace(cmdstr,'$MAP',mapstr);
|
|
Replace(cmdstr,'$MAP',mapstr);
|
|
Replace(cmdstr,'$LTO',ltostr);
|
|
Replace(cmdstr,'$LTO',ltostr);
|
|
|
|
+ Replace(cmdstr,'$RPATH',rpathstr);
|
|
|
|
|
|
{ create dynamic symbol table? }
|
|
{ create dynamic symbol table? }
|
|
if HasExports then
|
|
if HasExports then
|
|
@@ -853,7 +862,9 @@ var
|
|
binstr,
|
|
binstr,
|
|
cmdstr,
|
|
cmdstr,
|
|
mapstr,
|
|
mapstr,
|
|
- ltostr : TCmdStr;
|
|
|
|
|
|
+ ltostr,
|
|
|
|
+ rpathstr,
|
|
|
|
+ sanitizerLibraryDir: TCmdStr;
|
|
success : boolean;
|
|
success : boolean;
|
|
begin
|
|
begin
|
|
MakeSharedLibrary:=false;
|
|
MakeSharedLibrary:=false;
|
|
@@ -887,7 +898,12 @@ begin
|
|
ltostr:='-plugin '+maybequoted(utilsdirectory+'/../lib/LLVMgold.so ');
|
|
ltostr:='-plugin '+maybequoted(utilsdirectory+'/../lib/LLVMgold.so ');
|
|
end;
|
|
end;
|
|
|
|
|
|
-{ Call linker }
|
|
|
|
|
|
+ if AddSanitizerLibrariesAndGetSearchDir('linux',sanitizerLibraryDir) then
|
|
|
|
+ begin
|
|
|
|
+ rpathstr:='-rpath '+maybequoted(sanitizerLibraryDir)
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ { Call linker }
|
|
SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
|
|
SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
|
|
Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename));
|
|
Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename));
|
|
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
|
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
|
@@ -897,6 +913,7 @@ begin
|
|
Replace(cmdstr,'$SONAME',SoNameStr);
|
|
Replace(cmdstr,'$SONAME',SoNameStr);
|
|
Replace(cmdstr,'$MAP',mapstr);
|
|
Replace(cmdstr,'$MAP',mapstr);
|
|
Replace(cmdstr,'$LTO',ltostr);
|
|
Replace(cmdstr,'$LTO',ltostr);
|
|
|
|
+ Replace(cmdstr,'$RPATH',rpathstr);
|
|
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
|
|
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
|
|
success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
|
|
success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
|
|
|
|
|