Commit Graph

134 Commits

Author SHA1 Message Date
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
Jonas Maebe
1503890756 * don't always pass -no_dead_strip_inits_and_terms, because it automatically
turns on dead code stripping (smart linking). Do specify it when smart
    linking is enabled though.

git-svn-id: trunk@13653 -
2009-09-05 20:19:12 +00:00
Jonas Maebe
6d0eda6e4a * used ld directly rather than libtool to link dynamic libraries, because
libtool from Xcode 3.2 (Mac OS X 10.6) does not support all new linker
    options (in particular -no_order_inits and -no_order_data, both of
    which must be specified when compiling dynamic libraries with FPC and
    Xcode 3.2)

git-svn-id: trunk@13645 -
2009-09-05 10:30:11 +00:00
Jonas Maebe
ec8364904c * set the size of the (invalid) page at address zero to 64kb for 32 bit
Darwin platforms, so that no data can be placed below that address.
    This fixes the strange Windows-compatible resource API, which
    assumes that addresses <64kb do not exist.

git-svn-id: trunk@13600 -
2009-08-26 21:18:53 +00:00
Jonas Maebe
47c28c2db3 * pass -no_dead_strip_inits_and_terms to the linker, since we use these for
dynamic library initialization (this automatically enables dead code
    stripping/smart linking in all cases though, independent of -XX/CX;
    on the other hand, there is no real reason not to use it anymore on
    Mac OS X, since support was introduced in Xcode 1.5 for
    Mac OS X 10.3.9 and that's also the earliest version we support
    for running FPC on)

git-svn-id: trunk@13151 -
2009-05-16 10:42:23 +00:00
Jonas Maebe
afa14de20d + some generic changes preparing for darwin/arm support
git-svn-id: trunk@11849 -
2008-10-02 15:10:13 +00:00
Jonas Maebe
7d1a8f3de2 * always pass (g)crt1.o/bundle1.o as first argument to the linker
for darwin (see #11270)

git-svn-id: trunk@10996 -
2008-05-18 09:49:44 +00:00
Jonas Maebe
150eda304b * factored unix exports handling from t_bsd and t_linux into expunix unit
(todo: at least solaris, maybe others)
  * changed the "exports" section handling:
    a) make everything private which is not exported (implemented for
       darwin and linux)
    b) for the exported symbols:
     - functions/procedures
      1) if no name or index is provided, and if the procedure has aliases
         defined via the public/export directives, then export the default
         mangled name and all defined aliases
      2) otherwise if no name is specified (but there is an index) then
        i) if the procedure is defined as cdecl/cppdecl/mwpascal, use the
           appropriately mangled version of the function name
       ii) otherwise export the name without any mangling(e.g. "exports
           proc1" -> proc1 is the exported name)
     - variables
      1) if no name is provided and the variable was specified as cvar,
         use the mangled name
      2) otherwise if no name is provided, export the name without any
         mangling
  -> initialization/finalization of shared libraries under Linux works
     again (mantis #7838)
  -> sharing symbols between shared library and main program works
     under Linux (mantis #9089)

git-svn-id: trunk@10551 -
2008-03-24 16:55:05 +00:00
michael
174de3eab1 Merged revisions 9693-10480 via svnmerge from
svn+ssh://svn.freepascal.org/FPC/svn/fpc/branches/resources

........
  r9694 | michael | 2008-01-09 21:31:18 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * Initial check-in
........
  r9695 | michael | 2008-01-09 21:35:58 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * New version from Giulio Bernardi
........
  r9697 | michael | 2008-01-09 21:41:54 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * Patch from Giulio Bernardi with resource support
........
  r9698 | michael | 2008-01-09 21:46:33 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * Patch from Giulio Bernardi to add more resource testing
........
  r9699 | michael | 2008-01-09 21:57:26 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * New tool from Giulio Bernardi
........
  r9700 | michael | 2008-01-09 21:58:23 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * New tool from Giulio Bernardi
........
  r9701 | michael | 2008-01-09 22:01:54 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * Added fcl-res
........
  r9702 | michael | 2008-01-09 22:01:58 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * Added fcl-res
........
  r9703 | michael | 2008-01-10 08:54:26 +0100 (Thu, 10 Jan 2008) | 1 line
  
  * Fixed double code
........
  r9704 | jonas | 2008-01-10 10:59:20 +0100 (Thu, 10 Jan 2008) | 2 lines
  
    - removed duplicate code
........
  r9705 | jonas | 2008-01-10 11:25:21 +0100 (Thu, 10 Jan 2008) | 2 lines
  
    + added missing fcl-res dependencies
........
  r9706 | jonas | 2008-01-10 11:58:30 +0100 (Thu, 10 Jan 2008) | 2 lines
  
    + dependencies for fpintres and fpextres
........
  r9707 | yury | 2008-01-10 12:47:51 +0100 (Thu, 10 Jan 2008) | 3 lines
  
  * Fixed compilation of resource, which is included in a unit located in different folder than main source.
  * .res files must be copied to units output folder, otherwise .res files will not be found when only compiled units path is available and compiler does not know anything about sources folder.
  * Improved resource related error messages.
........
  r9708 | michael | 2008-01-10 12:52:13 +0100 (Thu, 10 Jan 2008) | 1 line
  
  * Removed double source after end.
........
  r9709 | michael | 2008-01-10 12:52:48 +0100 (Thu, 10 Jan 2008) | 1 line
  
  * No longer needed
........
  r9710 | tom_at_work | 2008-01-10 22:09:08 +0100 (Thu, 10 Jan 2008) | 1 line
  
  * properly align FPC_RESLOCATION so that linking does not fail on some architectures (e.g. ppc64)
........
  r9711 | tom_at_work | 2008-01-10 23:53:12 +0100 (Thu, 10 Jan 2008) | 1 line
  
  * fix splitting of 64 bit load/stores from/to unaligned memory locations into multiple load/stores, which in some cases generated wrong code
........
  r9712 | michael | 2008-01-11 11:00:08 +0100 (Fri, 11 Jan 2008) | 1 line
  
  * Fixed bug in BSS section on 64-bit platforms
........
  r9720 | giulio | 2008-01-12 10:02:04 +0100 (Sat, 12 Jan 2008) | 1 line
  
  Updated fcl-res documentation: occurrences of reslib changed to fcl-res.
........
  r9740 | giulio | 2008-01-13 19:36:44 +0100 (Sun, 13 Jan 2008) | 3 lines
  
   - Don't try to compile resources on systems with a non windows-like resource support.
   - Don't add the .or file to the list of object files if resource compiling failed.
........
  r10201 | giulio | 2008-02-04 11:35:44 +0100 (Mon, 04 Feb 2008) | 5 lines
  
  * resource compiling supported on OS/2 via wrc
  * CompileResourceFiles and CollectResourceFiles don't do target-specific checks anymore
  * refactored a bit
........
  r10389 | giulio | 2008-02-25 21:32:52 +0100 (Mon, 25 Feb 2008) | 2 lines
  
  Deleted test file which was committed by mistake
........
  r10472 | giulio | 2008-03-10 12:22:18 +0100 (Mon, 10 Mar 2008) | 2 lines
  
  changed define FPC_HAS_RESOURCES to FPC_HAS_WINLIKERESOURCES
........

git-svn-id: trunk@10481 -
2008-03-12 21:33:48 +00:00