Commit Graph

174 Commits

Author SHA1 Message Date
Jonas Maebe
10b15628ab * split i/t_darwin from i/t_bsd, as they don't have that much in common
any more

git-svn-id: trunk@44407 -
2020-03-29 18:27:27 +00:00
Jonas Maebe
3b8979210d * check target system instead of using an ifdef
git-svn-id: trunk@44394 -
2020-03-29 14:52:41 +00:00
florian
fe7d7aa1e7 * patch by Alfred to fix building on DragonFly OS, resolves #36450
git-svn-id: trunk@43696 -
2019-12-17 21:57:09 +00:00
Jonas Maebe
c22d39bcdf * fixed linking on NetBSD/m68k after r36168
* fixed linking on target for NetBSD/m68k, and when cross-compiling for
    Darwin from Windows after r36168
  * enabled the use of the "-filelist" linker option for Darwin in all
    cases (mantis #36273)

git-svn-id: trunk@43485 -
2019-11-15 20:31:41 +00:00
Jonas Maebe
6483b3f5e3 * fixed opt-in sysroot substitution again, renamed the three-argument version
TSearchPathList.AddPath() to AddLibraryPath() to make it clear it's only
    to be used for adding library search paths (and replaced one case where
    it was used for a source file search path with a call to the
    two-argument version)
  * also added some missing '=' prefixes to built-in library search paths,
    and fixed wrong DirectoryExists checks in t_linux in case of using
    a sysroot, cross-compiling or linking on target

git-svn-id: trunk@43312 -
2019-10-26 13:48:30 +00:00
Jonas Maebe
78fb35525f * change convention for searching sysroot library paths to be the same as the
one used by GNU ld: only search for library paths in the sysroot if they
    are built into the compiler or start with "=". Previously, all
    user-provided library paths were also searched in the sysroot
    (mantis #36198)

git-svn-id: trunk@43279 -
2019-10-20 17:26:44 +00:00
florian
b71164deca * fix warnings
git-svn-id: branches/debug_eh@42256 -
2019-06-20 17:13:59 +00:00
Jonas Maebe
faf75095cd * synchronised with trunk till r42189
git-svn-id: branches/debug_eh@42190 -
2019-06-07 18:24:38 +00:00
nickysn
0c471494e8 * use explicitly GNU LD ('ld.bfd') on OpenBSD, instead of the default 'ld'
linker, because in OpenBSD 6.5, it has been replaced with the LLVM linker and
  the LLVM linker produces broken position independent executables with FPC.

git-svn-id: trunk@42127 -
2019-05-26 16:51:51 +00:00
Jonas Maebe
1b6425176b * synchronised with trunk till r42049
git-svn-id: branches/debug_eh@42050 -
2019-05-12 18:44:05 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
Jonas Maebe
fc60ec2ea4 + support for LLVM LTO: compile units with -CLflto -> when compiling a main
program/library also with -Clflto, all units compiled with that option
    will be linked using their bitcode files and LTO
   o compiling with -CLflto will compile all units twice: once for normal
     (static or smart) linking, and once for LTO. So the result can be
     used both with and without LTO.

git-svn-id: branches/debug_eh@41910 -
2019-04-20 18:56:11 +00:00
Jonas Maebe
d150869dea * record symbols that need to remain in their original order, and on Darwin
pass them to the linker so it does not reorder them
   o fixes resource strings on Darwin when using LTO (this used to reorder the
     resource string symbols, so they no longer all appeared between the START
     and END symbols for their compilation module)

git-svn-id: trunk@41907 -
2019-04-20 18:18:10 +00:00
nickysn
85fdd37cac + support creating linker map files (with the -Xm option) on *BSD
git-svn-id: trunk@41759 -
2019-03-21 13:54:15 +00:00
nickysn
261114ff32 + introduce the $OPENBSD_LOCALBASE and $OPENBSD_X11BASE pseudo variables; these
may now be used in fpc.cfg, etc. They evaluate to /usr/local and /usr/X11R6 by
  default, but may optionally be overriden via the LOCALBASE and X11BASE
  environment variables.
* use the new $OPENBSD_LOCALBASE and $OPENBSD_X11BASE variables in the default
  library search path on OpenBSD

git-svn-id: trunk@41755 -
2019-03-20 17:03:11 +00:00
nickysn
34a8032e11 * link to crtbegin.o/crtend.o instead of crtbeginS.o/crtendS.o when creating
normal OpenBSD programs (not shared libraries) that link to the C library,
  even when PIC code generation has been turned on. This is what gcc and clang
  do on this platform.

git-svn-id: trunk@41740 -
2019-03-19 16:36:38 +00:00
nickysn
caf1b11db9 * initialize SysInitUnit in InitSysInitUnitName on BSD
git-svn-id: trunk@41700 -
2019-03-14 17:20:12 +00:00
nickysn
58d9e58742 * initialize prtobj and reorder in InitSysInitUnitName
git-svn-id: trunk@41699 -
2019-03-14 17:02:20 +00:00
nickysn
525eff2927 * initialize linklibc earlier (in InitSysInitUnitName); this is necessary,
because the sysinit unit name depends on whether libc is linked or not.
  Helper function ModulesLinkToLibc copied from t_linux.pas

git-svn-id: trunk@41698 -
2019-03-14 16:47:34 +00:00
nickysn
dc32554556 * prtobj, linklibc and reorder converted from local to member variables of the class
git-svn-id: trunk@41697 -
2019-03-14 16:23:55 +00:00
nickysn
a15ec46751 * don't put the prtobj file in the BSD linker script, in case the current system uses sysinit
git-svn-id: trunk@41696 -
2019-03-14 15:57:09 +00:00
nickysn
ac86980f8a + pass the -dynamic-linker option to the linker even when making a static binary
on OpenBSD, because that seems to be needed in order to produce a static
  position independent executable in the correct format for that platform

git-svn-id: trunk@41668 -
2019-03-10 15:56:09 +00:00
nickysn
3a58a6261a * link with -nopie on OpenBSD only if PIC code generation is disabled
git-svn-id: trunk@41652 -
2019-03-09 16:11:52 +00:00
nickysn
b659720f04 * Do not link to /usr/libexec/ld.so as a shared library on OpenBSD. Based on 3/3
of OpenBSD ports patch patch-fpcsrc_compiler_systems_t_bsd_pas

git-svn-id: trunk@41639 -
2019-03-08 16:04:48 +00:00
nickysn
bd9f6170cd * always add -nopie to linker flags on OpenBSD. Based on 2/3 of OpenBSD ports
patch patch-fpcsrc_compiler_systems_t_bsd_pas

git-svn-id: trunk@41638 -
2019-03-08 16:01:30 +00:00
nickysn
c3c9e07867 * Correct library search path for OpenBSD. Based on 1/3 of OpenBSD ports patch
patch-fpcsrc_compiler_systems_t_bsd_pas

git-svn-id: trunk@41637 -
2019-03-08 15:59:00 +00:00
Károly Balogh
7bd590c9a7 fix the missing semicolos in the previous fix..
git-svn-id: trunk@40218 -
2018-11-04 18:15:24 +00:00
Károly Balogh
12a22b593d initialize result before passing it to FindFile()
git-svn-id: trunk@40217 -
2018-11-04 18:03:00 +00:00
Károly Balogh
626dc172ee arm-netbsd: append -N to the command line. lets figure out later if this is the right solution here
git-svn-id: trunk@38590 -
2018-03-22 00:43:32 +00:00
Károly Balogh
dbb91b5ef0 arm-netbsd: added platform define and dummy rtl files so the build passes for this platform. port not functional yet
git-svn-id: trunk@38412 -
2018-03-05 15:38:46 +00:00
Károly Balogh
e6aed467b5 renamed script unit to cscript to avoid namespace conflict with univint package on Darwin. this makes it possible to build the textmode IDE on Darwin
git-svn-id: trunk@37598 -
2017-11-17 11:27:19 +00:00
maciej-izak
fa75f25fac * Enabling crosscompiling from Windows towards Darwin. Patch from Alfred (mantis 31099). Thanks! :)
git-svn-id: trunk@36168 -
2017-05-10 07:53:43 +00:00
svenbarth
f406867100 Merged revision(s) 31929-31931,32547 from branches/svenbarth/packages:
Switch Mac OS X to indirect entry information.

compiler/systems/t_bsd.pas, TLinkerBSD:
  + implement InitSysInitUnitName
compiler/system.pas:
  * systems_internal_sysinit: add Darwin systems
compiler/hlcgobj.pas, thlcgobj:
  * gen_proc_symbol_end: for Darwin systems don't directly call PascalMain for libraries, but FPC_LIBMAIN instead
rtl/darwin:
  + add sysinit.pas unit which contains the executable and library entry points for Darwin
rtl/darwin/Makefile.fpc:
  * add sysinit unit
rtl/bsd/sysosh.inc:
  + add a Darwin specific TPlatformEntryInformation (could probably be used for all Unix systems...)
rtl/bsd/system.pp:
  * define FPC_HAS_INDIRECT_MAIN_INFORMATION for Darwin systems once we're no longer bootstrapping with 2.6.x
  + add EntryInformation variable (this could maybe moved to system.inc...)
  + add new procedure SysEntry that is called from the entrypoint and which sets up necessary information required by other parts of the RTL
  * the old FPC_SYSTEMMAIN is still in place for bootstrapping
rtl/inc/systemh.inc, TEntryInformation:
  * PascalMain is cdecl on non-Windows systems (ToDo: really?)
rtl/inc/system.inc:
  * initialstklen is provided by the indirect entry information, so no external here
........
Fix bootstrapping.

rtl/darwin/sysinit.pas:
  * enable the code only when no longer bootstrapping with 2.6.x
........
Fix bootstrapping.

rtl/objpas/objpas.pp:
  * define FPC_HAS_INDIRECT_MAIN_INFORMATION for Darwin only while not bootstrapping with 2.6.x
........
rtl/darwin/sysinit.pas:
  * reference PASCALMAIN correctly (I wonder how this even worked previously :/ )

git-svn-id: trunk@33949 -
2016-06-11 20:29:51 +00:00
pierre
014d2f805d Use /libexec/ld-elf.so.2 as dynamic linker for DragonFly OS
git-svn-id: trunk@31210 -
2015-07-14 21:59:23 +00:00
Jonas Maebe
acd88cac92 * fixed selection of startup code files for all iOS and simulator targets
o in particular fixes linking for the iPhoneSimulator 8.3 and later on
     i386

git-svn-id: trunk@31045 -
2015-06-13 22:47:53 +00:00
Jonas Maebe
79a06b1514 + iphonesim/x86_64 target (64 bit iOS simulator)
git-svn-id: trunk@29970 -
2015-02-23 22:56:09 +00:00
Jonas Maebe
60dd2d1dd5 + register Darwin/AArch64 target
* pass "-arch arm64" to the linker for Darwin/AArch64

git-svn-id: trunk@29897 -
2015-02-23 22:51:44 +00:00
marco
2578514853 * first dragonfly patch (existing most). Mantis #27091
git-svn-id: trunk@29213 -
2014-12-07 20:27:02 +00:00
pierre
016666c70f Use pic code by default for x86_64-openbsd
git-svn-id: trunk@29138 -
2014-11-23 22:04:30 +00:00
marco
ff2186ce00 * OpenBSD gets no pie. (add -nopie)
git-svn-id: trunk@28736 -
2014-10-04 11:12:14 +00:00
florian
4d5119bf1c * fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +00:00
paul
d16606b04c compiler: revert r25852 since 10.9 is already handled
git-svn-id: trunk@25864 -
2013-10-27 14:17:29 +00:00
paul
43b9308929 compiler: also skip crt1.o for osx 10.9
git-svn-id: trunk@25852 -
2013-10-26 13:36:40 +00:00
Jonas Maebe
a28917086b * updated *crt1* linking logic for OS X 10.8+:
o don't link by default
   o when generating profiling info, link gcrt1.o and specify "-no_new_main"
     linker parameter
  * don't use version-specific crt1.o files when targetting the
    iPhoneSimulator platform
  * don't link a crt1.o file when targetting iOS 6 or later
  (all info from
   http://llvm.org/svn/llvm-project/cfe/trunk/lib/Driver/Tools.cpp )

git-svn-id: trunk@25789 -
2013-10-14 21:38:38 +00:00
marco
2a9916baba * fix mantis #25129 for non OS X BSD systems. Patch by A. Cardenas Marquez
- crtbegin and crtend suffix handling
     - crti before crtbegin

git-svn-id: trunk@25620 -
2013-10-02 09:05:32 +00:00
Jonas Maebe
1af312c129 * don't overwrite result of librarysearchpath.FindFile() in
GetDarwinPrtobjName() if it found something

git-svn-id: trunk@25330 -
2013-08-22 21:37:06 +00:00
Jonas Maebe
528f5d1096 * initialise result of GetDarwinPrtobjName() in case GetDarwinCrt1ObjName()
returns an empty string

git-svn-id: trunk@25328 -
2013-08-22 19:55:57 +00:00
sergei
38058505ba * Changed linking infrastructure to look like assembler one:
* Changed direct references to linker classes in TSystemInfo records to enumerated ids.
  * RegisterExtennalLinker and RegisterInternalLinker procedures replaced by single RegisterLinker procedure and moved to link.pas.
  - TAbstractLinker is no longer necessary, removed.

This change allows to register linker once per id, rather than once per target, and also allows TSystemInfo records to be read-only.

git-svn-id: trunk@25279 -
2013-08-18 12:01:21 +00:00
pierre
8e2fcd6bfe Enable use of dllprt0 for netbsd
git-svn-id: trunk@23848 -
2013-03-15 16:21:22 +00:00
pierre
18ece9cf75 Also use VERSION in scripts for openbsd and netbsd
git-svn-id: trunk@23844 -
2013-03-15 15:39:32 +00:00