|
@@ -154,7 +154,7 @@ begin
|
|
{ Mac OS X doesn't have a /lib }
|
|
{ Mac OS X doesn't have a /lib }
|
|
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib',true)
|
|
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib',true)
|
|
else if target_info.system in systems_openbsd then
|
|
else if target_info.system in systems_openbsd then
|
|
- LibrarySearchPath.AddPath(sysrootpath,'/usr/lib;${X11BASE}/lib;${LOCALBASE}/lib',true)
|
|
|
|
|
|
+ LibrarySearchPath.AddPath(sysrootpath,'/usr/lib;$OPENBSD_X11BASE/lib;$OPENBSD_LOCALBASE/lib',true)
|
|
else
|
|
else
|
|
LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib',true);
|
|
LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib',true);
|
|
end;
|
|
end;
|
|
@@ -173,8 +173,8 @@ begin
|
|
begin
|
|
begin
|
|
if not(target_info.system in systems_darwin) then
|
|
if not(target_info.system in systems_darwin) then
|
|
begin
|
|
begin
|
|
- ExeCmd[1]:='ld $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE $CATRES $FILELIST';
|
|
|
|
- DllCmd[1]:='ld $TARGET $EMUL $OPT -shared -L. -o $EXE $CATRES $FILELIST'
|
|
|
|
|
|
+ ExeCmd[1]:='ld $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE $CATRES $FILELIST';
|
|
|
|
+ DllCmd[1]:='ld $TARGET $EMUL $OPT $MAP -shared -L. -o $EXE $CATRES $FILELIST'
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
@@ -193,22 +193,22 @@ begin
|
|
programs with problems that require Valgrind will have more
|
|
programs with problems that require Valgrind will have more
|
|
than 60KB of data (first 4KB of address space is always invalid)
|
|
than 60KB of data (first 4KB of address space is always invalid)
|
|
}
|
|
}
|
|
- ExeCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -multiply_defined suppress -L. -o $EXE $CATRES $FILELIST';
|
|
|
|
|
|
+ ExeCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -multiply_defined suppress -L. -o $EXE $CATRES $FILELIST';
|
|
if not(cs_gdb_valgrind in current_settings.globalswitches) then
|
|
if not(cs_gdb_valgrind in current_settings.globalswitches) then
|
|
ExeCmd[1]:=ExeCmd[1]+' -pagezero_size 0x10000';
|
|
ExeCmd[1]:=ExeCmd[1]+' -pagezero_size 0x10000';
|
|
{$else ndef cpu64bitaddr}
|
|
{$else ndef cpu64bitaddr}
|
|
- ExeCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -multiply_defined suppress -L. -o $EXE $CATRES $FILELIST';
|
|
|
|
|
|
+ ExeCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -multiply_defined suppress -L. -o $EXE $CATRES $FILELIST';
|
|
{$endif ndef cpu64bitaddr}
|
|
{$endif ndef cpu64bitaddr}
|
|
if (apptype<>app_bundle) then
|
|
if (apptype<>app_bundle) then
|
|
- DllCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $GCSECTIONS -dynamic -dylib -multiply_defined suppress -L. -o $EXE $CATRES $FILELIST'
|
|
|
|
|
|
+ DllCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $GCSECTIONS $MAP -dynamic -dylib -multiply_defined suppress -L. -o $EXE $CATRES $FILELIST'
|
|
else
|
|
else
|
|
- DllCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $GCSECTIONS -dynamic -bundle -multiply_defined suppress -L. -o $EXE $CATRES $FILELIST'
|
|
|
|
|
|
+ DllCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $GCSECTIONS $MAP -dynamic -bundle -multiply_defined suppress -L. -o $EXE $CATRES $FILELIST'
|
|
end
|
|
end
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- ExeCmd[1]:='ld $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE $RES';
|
|
|
|
- DllCmd[1]:='ld $TARGET $EMUL $OPT $INIT $FINI $SONAME -shared -L. -o $EXE $RES';
|
|
|
|
|
|
+ ExeCmd[1]:='ld $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE $RES';
|
|
|
|
+ DllCmd[1]:='ld $TARGET $EMUL $OPT $INIT $FINI $SONAME $MAP -shared -L. -o $EXE $RES';
|
|
end;
|
|
end;
|
|
if not(target_info.system in systems_darwin) then
|
|
if not(target_info.system in systems_darwin) then
|
|
DllCmd[2]:='strip --strip-unneeded $EXE'
|
|
DllCmd[2]:='strip --strip-unneeded $EXE'
|
|
@@ -616,7 +616,10 @@ begin
|
|
begin
|
|
begin
|
|
if librarysearchpath.FindFile('crti.o',false,s) then
|
|
if librarysearchpath.FindFile('crti.o',false,s) then
|
|
LinkRes.AddFileName(s);
|
|
LinkRes.AddFileName(s);
|
|
- if cs_create_pic in current_settings.moduleswitches then
|
|
|
|
|
|
+ if ((cs_create_pic in current_settings.moduleswitches) and
|
|
|
|
+ not (target_info.system in systems_openbsd)) or
|
|
|
|
+ (current_module.islibrary and
|
|
|
|
+ (target_info.system in systems_openbsd)) then
|
|
begin
|
|
begin
|
|
if librarysearchpath.FindFile('crtbeginS.o',false,s) then
|
|
if librarysearchpath.FindFile('crtbeginS.o',false,s) then
|
|
LinkRes.AddFileName(s);
|
|
LinkRes.AddFileName(s);
|
|
@@ -740,7 +743,10 @@ begin
|
|
if linklibc and
|
|
if linklibc and
|
|
not IsDarwin Then
|
|
not IsDarwin Then
|
|
begin
|
|
begin
|
|
- if cs_create_pic in current_settings.moduleswitches then
|
|
|
|
|
|
+ if ((cs_create_pic in current_settings.moduleswitches) and
|
|
|
|
+ not (target_info.system in systems_openbsd)) or
|
|
|
|
+ (current_module.islibrary and
|
|
|
|
+ (target_info.system in systems_openbsd)) then
|
|
Fl1:=librarysearchpath.FindFile('crtendS.o',false,s1)
|
|
Fl1:=librarysearchpath.FindFile('crtendS.o',false,s1)
|
|
else
|
|
else
|
|
Fl1:=librarysearchpath.FindFile('crtend.o',false,s1);
|
|
Fl1:=librarysearchpath.FindFile('crtend.o',false,s1);
|
|
@@ -767,6 +773,7 @@ function TLinkerBSD.MakeExecutable:boolean;
|
|
var
|
|
var
|
|
binstr,
|
|
binstr,
|
|
cmdstr,
|
|
cmdstr,
|
|
|
|
+ mapstr,
|
|
targetstr,
|
|
targetstr,
|
|
emulstr,
|
|
emulstr,
|
|
extdbgbinstr,
|
|
extdbgbinstr,
|
|
@@ -788,6 +795,9 @@ begin
|
|
DynLinkStr:='';
|
|
DynLinkStr:='';
|
|
GCSectionsStr:='';
|
|
GCSectionsStr:='';
|
|
linkscript:=nil;
|
|
linkscript:=nil;
|
|
|
|
+ mapstr:='';
|
|
|
|
+ if (cs_link_map in current_settings.globalswitches) then
|
|
|
|
+ mapstr:='-Map '+maybequoted(ChangeFileExt(current_module.exefilename,'.map'));
|
|
{ i386_freebsd needs -b elf32-i386-freebsd and -m elf_i386_fbsd
|
|
{ i386_freebsd needs -b elf32-i386-freebsd and -m elf_i386_fbsd
|
|
to avoid creation of a i386:x86_64 arch binary }
|
|
to avoid creation of a i386:x86_64 arch binary }
|
|
|
|
|
|
@@ -857,6 +867,7 @@ begin
|
|
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
|
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
|
Replace(cmdstr,'$TARGET',targetstr);
|
|
Replace(cmdstr,'$TARGET',targetstr);
|
|
Replace(cmdstr,'$EMUL',EmulStr);
|
|
Replace(cmdstr,'$EMUL',EmulStr);
|
|
|
|
+ Replace(cmdstr,'$MAP',mapstr);
|
|
Replace(cmdstr,'$CATRES',CatFileContent(outputexedir+Info.ResName));
|
|
Replace(cmdstr,'$CATRES',CatFileContent(outputexedir+Info.ResName));
|
|
Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
|
|
Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
|
|
if (LdSupportsNoResponseFile) and (source_info.system in systems_all_windows) then
|
|
if (LdSupportsNoResponseFile) and (source_info.system in systems_all_windows) then
|
|
@@ -934,6 +945,7 @@ var
|
|
linkscript: TAsmScript;
|
|
linkscript: TAsmScript;
|
|
binstr,
|
|
binstr,
|
|
cmdstr,
|
|
cmdstr,
|
|
|
|
+ mapstr,
|
|
targetstr,
|
|
targetstr,
|
|
emulstr,
|
|
emulstr,
|
|
extdbgbinstr,
|
|
extdbgbinstr,
|
|
@@ -944,6 +956,7 @@ var
|
|
begin
|
|
begin
|
|
MakeSharedLibrary:=false;
|
|
MakeSharedLibrary:=false;
|
|
GCSectionsStr:='';
|
|
GCSectionsStr:='';
|
|
|
|
+ mapstr:='';
|
|
linkscript:=nil;
|
|
linkscript:=nil;
|
|
if not(cs_link_nolink in current_settings.globalswitches) then
|
|
if not(cs_link_nolink in current_settings.globalswitches) then
|
|
Message1(exec_i_linking,current_module.sharedlibfilename);
|
|
Message1(exec_i_linking,current_module.sharedlibfilename);
|
|
@@ -959,6 +972,9 @@ begin
|
|
else
|
|
else
|
|
GCSectionsStr:='-dead_strip -no_dead_strip_inits_and_terms';
|
|
GCSectionsStr:='-dead_strip -no_dead_strip_inits_and_terms';
|
|
|
|
|
|
|
|
+ if (cs_link_map in current_settings.globalswitches) then
|
|
|
|
+ mapstr:='-Map '+maybequoted(ChangeFileExt(current_module.sharedlibfilename,'.map'));
|
|
|
|
+
|
|
{ i386_freebsd needs -b elf32-i386-freebsd and -m elf_i386_fbsd
|
|
{ i386_freebsd needs -b elf32-i386-freebsd and -m elf_i386_fbsd
|
|
to avoid creation of a i386:x86_64 arch binary }
|
|
to avoid creation of a i386:x86_64 arch binary }
|
|
|
|
|
|
@@ -997,6 +1013,7 @@ begin
|
|
Replace(cmdstr,'$FINI',FiniStr);
|
|
Replace(cmdstr,'$FINI',FiniStr);
|
|
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
|
|
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
|
|
Replace(cmdstr,'$SONAME',SoNameStr);
|
|
Replace(cmdstr,'$SONAME',SoNameStr);
|
|
|
|
+ Replace(cmdstr,'$MAP',mapstr);
|
|
if (target_info.system in systems_darwin) then
|
|
if (target_info.system in systems_darwin) then
|
|
Replace(cmdstr,'$PRTOBJ',GetDarwinPrtobjName(true));
|
|
Replace(cmdstr,'$PRTOBJ',GetDarwinPrtobjName(true));
|
|
BinStr:=FindUtil(utilsprefix+BinStr);
|
|
BinStr:=FindUtil(utilsprefix+BinStr);
|