Commit Graph

142 Commits

Author SHA1 Message Date
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
pierre
1ad6aacb78 * Also use dllprt0 for openbsd
git-svn-id: trunk@23829 -
2013-03-14 13:51:16 +00:00
pierre
1dd964960c * Enable use of amd64 ld GNU linker for i386 by adding target and emul command line args for freebsd
git-svn-id: trunk@23282 -
2013-01-01 23:00:02 +00:00
Jonas Maebe
cf717c4b75 * use -iphone_os_min rather than -ios_version_min, because the former
(older) version of the parameter is still supported by current linker
    versions, but the older version isn't supported by older linker
    versions

git-svn-id: trunk@22954 -
2012-11-08 20:17:42 +00:00
Jonas Maebe
c27f9da1b2 * always surround ld link.res SEARCH_DIR() arguments with double quotes,
rather than with single/double quotes depending on the target platform
    (ld only supports double quotes), and rather than only quoting when
    necessary (wastes time since quotes are always allowed, and double
    quotes inside a directory name cannot be escaped for ld; they are
    simply not supported by the program) (mantis #22059, follow-up to
    r21069 and r21208)

git-svn-id: trunk@21343 -
2012-05-20 13:30:51 +00:00
Jonas Maebe
0841ee6e4f * GNU ld only supports double quotes in its response file -> requote there
as well under Unix (mantis #21928, caused by r21069)

git-svn-id: trunk@21208 -
2012-05-03 12:41:16 +00:00
Jonas Maebe
14cfe770a4 * replaced most (if not all) remaining fields/parameters in the compiler
that deal with paths/filenames with TPathStr (= ansistring) to prevent
    cutting off long paths (no change in speed when compiling the compiler,
    1% extra memory usage)

git-svn-id: trunk@21120 -
2012-04-29 17:36:23 +00:00
pierre
175ec19308 + Register for system_x86_64_ntbsd
git-svn-id: trunk@20732 -
2012-04-06 22:04:20 +00:00
pierre
b6576452ed Use correct dynamic linker for x86_64 openbsd system
git-svn-id: trunk@20728 -
2012-04-06 21:21:56 +00:00
pierre
7e71e1d3a0 + Add system_x86_64_openbsd_info record
git-svn-id: trunk@20715 -
2012-04-05 21:06:56 +00:00
Jonas Maebe
eb2cccffda + -WM<X> and -WP<x> command line parameters to specify the minimally required
Mac OS X/iOS version for the compiler code
   o such a parameter is not passed, extract the information from the
     environment variables MACOSX_DEPLOYMENT_TARGET/IPHONEOS_DEPLOYMENT_TARGET,
     like gcc
   o if neither the parameter nor the environment variable is used, use preset
     default values
   o pass on this version setting on to the Darwin linker
   o use this setting to determine which version of the startup code (crt1.o
     etc) to use, if any (based on information gathered from the GCC sources)
   o define a symbol called MAC_OS_X_VERSION_MIN_REQUIRED/
     IPHONE_OS_VERSION_MIN_REQUIRED based on this parameter
   o for usage information, see
     http://wiki.freepascal.org/FPC_New_Features_Trunk#Support_for_specifying_and_querying_the_deployment_version

git-svn-id: trunk@20503 -
2012-03-10 19:31:57 +00:00
pierre
8efbcbaabb NetBSD also needs explicit DynamicLinker
git-svn-id: trunk@20293 -
2012-02-09 17:38:10 +00:00
Jonas Maebe
6a5cf6cf8d * always pass -arch parameter to linker when targetting Darwin, instead of
skipping this for dynamic libraries (not sure why that was done, but
    apparently not passing -arch triggers a bug in Xcode 4.2 Lion linker,
    mantis #21159)

git-svn-id: trunk@20211 -
2012-02-01 19:01:58 +00:00
Jonas Maebe
3188916cda * also replace $CATRES for shared libraries (fix for r19649)
git-svn-id: trunk@19661 -
2011-11-20 20:06:43 +00:00
pierre
836da25e81 * Do not call with UseShell = true if CatFileContent expands the file into parameters
git-svn-id: trunk@19650 -
2011-11-18 22:08:51 +00:00
pierre
b1bd1d29ec Replace cat $RESby $CATRES and call CatFileContent method
git-svn-id: trunk@19649 -
2011-11-18 21:33:24 +00:00
pierre
0cd15043b3 * Set a default dynamic linker for OpenBSD
git-svn-id: trunk@19451 -
2011-10-10 21:45:21 +00:00
pierre
1f0e5b496f Try to support shared libraries for freebsd
git-svn-id: trunk@19242 -
2011-09-26 10:25:27 +00:00
Jonas Maebe
ec8c7b4888 + when compiling for Darwin/ARM, pass the subarchitecture to the linker.
The old linker option to accept object files from all subarchitecture
    types no longer works.
  + support for subarchitectures in fcl-res/fpcres

git-svn-id: trunk@18070 -
2011-08-02 20:41:39 +00:00
Jonas Maebe
1b5fed238a * don't quote the Darwin syslibroot path in link.res, it's not reinterpreted
by the shell since it's cat'ed into the command line

git-svn-id: trunk@17422 -
2011-05-09 21:26:36 +00:00
Jonas Maebe
9cd6a7ad85 * correctly handle -XR (sysroot) paths with spaces under Darwin
git-svn-id: trunk@17421 -
2011-05-09 20:14:17 +00:00
Jonas Maebe
601b90d74c * don't specify a custom pagezero size on Mac OS X when compiling with -gv
(Valgrind support), because Valgrind cannot deal with that

git-svn-id: trunk@16916 -
2011-02-14 20:31:30 +00:00
Jonas Maebe
1271c221f3 - reverted change accidentally committed as part of r16050 that could break
internal resources on 32 bit Darwin platforms with small programs

git-svn-id: trunk@16417 -
2010-11-24 11:03:11 +00:00
Jonas Maebe
8b0301409a + i386/iphonesim target for the new iPhoneSimulator in Xcode 3.2.4 and
later: the same as i386/darwin, except
      a) uses the non-fragile Objective-C ABI/runtime
      b) does not require stubs for direct calls/jumps (not required for
         i386/darwin under 10.6 and later either, but still generated
         there for backwards compatibility)
      c) only the same packages are enabled as for ARM/Darwin
      d) MacOSAll is compiled specifically for the iPhoneSimulator SDK
    This target also defines the symbol "darwin" apart from the target
    name "iphonesim" for source code compatibility reasons.

git-svn-id: trunk@16065 -
2010-09-29 21:56:47 +00:00
Jonas Maebe
f13f6627c4 * moved use_fixed_stack from cgutils to a method in paramgr so it can
be used outside the code generator
  * renamed tabstractprocdef.requiredargarea into callerargareasize,
    and also added calleeargareasize field; added init_paraloc_info(side)
    method to init the parameter locations and init those size fields and
    replaced all "if not procdef.has_paraloc_info then ..." blocks with
    procdef.init_paraloc_info(callersize)"
  * moved detection of stack tainting parameters from psub to
    symdef/tabstractprocdef
  + added tcallparanode.contains_stack_tainting_call(), which detects
    whether a parameter contains a call that makes use of stack paramters
  * record for each parameter whether or not any following parameter
    contains a call with stack parameters; if not, in case the current
    parameter itself is a stack parameter immediately place it in its
    final location also for use_fixed_stack platforms rather than
    first putting it in a temporary location (part of mantis #17442)
  * on use_fixed_stack platforms, always first evaluate parameters
    containing a stack tainting call, since those force any preceding
    stack parameters of the current call to be stored in a temp location
    and copied to the final location afterwards

git-svn-id: trunk@16050 -
2010-09-26 21:24:14 +00:00
Jonas Maebe
356026f849 * use new_section() instead of tai_section.create() everywhere
- sort of reverted r14134, which is no longer required after the above
    change (new_section() inserts the alignment itself)
  * made the tai_section.create() constructor private so it cannot be
    called directly anymore

git-svn-id: trunk@15482 -
2010-06-26 10:50:14 +00:00
Jonas Maebe
61df8f05a0 * fixed max length of gcsectionsstr (mantis #15984)
git-svn-id: trunk@15014 -
2010-03-14 11:07:08 +00:00
Jonas Maebe
2e544bd8de * smartlink dynamic libraries under Mac OS X (mantis #15984)
git-svn-id: trunk@15011 -
2010-03-13 23:37:20 +00:00
Jonas Maebe
d19eaab7c6 * don't specify ARM architecture subtype to linker, because then it will
refuse linking in compiled resources (because those have a generic
    cpu subtype)

git-svn-id: trunk@14330 -
2009-12-04 20:29:05 +00:00
Jonas Maebe
d1538ab023 o added ARM VPFv2/VFPv3 support:
+ RTL support:
      o VFP exceptions are disabled by default on Darwin,
        because they cause kernel panics on iPhoneOS 2.2.1 at least
      o all denormals are truncated to 0 on Darwin, because disabling
        that also causes kernel panics on iPhoneOS 2.2.1 (probably
        because otherwise denormals can also cause exceptions)
    * set softfloat rounding mode correctly for non-wince/darwin/vfp
      targets
    + compiler support: only half the number of single precision
      registers is available due to limitations of the register
      allocator
    + added a number of comments about why the stackframe on ARM is
      set up the way it is by the compiler
    + added regtype and subregtype info to regsets, because they're
      also used for VFP registers (+ support in assembler reader)
    + various generic support routines for dealing with floating point
      values located in integer registers that have to be transferred to
      mm registers (needed for VFP)
    * renamed use_sse() to use_vectorfpu() and also use it for
      ARM/vfp support
    o only superficially tested for Linux (compiler compiled with -Cpvfpv6
      -Cfvfpv2 works on a Cortex-A8, no testsuite run performed -- at least
      the fpu exception handler still needs to be implemented), Darwin has
      been tested more thoroughly
  + added ARMv6 cpu type and made it default for Darwin/ARM
  + ARMv6+ implementations of atomic operations using ldrex/strex
  * don't use r9 on Darwin/ARM, as it's reserved under certain
    circumstances (don't know yet which ones)
  * changed C-test object files for ARM/Darwin to ARMv6 versions
  * check in assembler reader that regsets are not empty, because
    instructions with a regset operand have undefined behaviour in that
    case
  * fixed resultdef of tarmtypeconvnode.first_int_to_real in case of
    int64->single type conversion
  * fixed constant pool locations in case 64 bit constants are generated,
    and/or when vfp instructions with limited reach are present

  WARNING: when using VFP on an ARMv6 or later cpu, you *must* compile all
    code with -Cparmv6 (or higher), or you will get crashes. The reason is
    that storing/restoring multiple VFP registers must happen using
    different instructions on pre/post-ARMv6.

git-svn-id: trunk@14317 -
2009-12-03 22:46:30 +00:00
Jonas Maebe
edacea82be * changed assembler directives for darwin lazy/non-lazy symbol pointers
and init/fini routines into their section equivalents (based on patch
    by Dmitry Boyarintsev, mantis #15037)

git-svn-id: trunk@14128 -
2009-11-09 22:20:01 +00:00
Jonas Maebe
9da0729d7c * fixed copy/paste error in r13645: fallback to /usr/lib/dylib1.o rather
than /usr/lib/bundle1.o when dylib1.o is not found

git-svn-id: trunk@13658 -
2009-09-06 09:38:19 +00:00
Jonas Maebe
8eb3a34633 * increased length of GCSectionsStr so it can contain the full new
smart linking string for Darwin
  * removed another -no_dead_strip_inits_and_terms that was hardcoded in all
    situations

git-svn-id: trunk@13657 -
2009-09-06 09:35:03 +00:00