Commit Graph

207 Commits

Author SHA1 Message Date
yury
5cd83b26d9 * More proper check for executable image size limits.
* Proper handling of 64-bit COFF relocations.
* Use jumps with 32-bit relative addressing in imports on win64.
* This fixes are related to bug #13657. The bug is not fully fixed yet...

git-svn-id: trunk@13104 -
2009-05-06 18:07:07 +00:00
yury
99917e034d * Fixed visibility notes of some overrode methods.
git-svn-id: trunk@13095 -
2009-05-04 10:24:47 +00:00
yury
9d78ca3f19 * RELOC_SECREL32 must be relative to EXE section, not to object file section.
* Write zero to relocs in debug sections, which point to unused sections, eliminated by linker.
* It seems internal linker creates correct dwarf debug info now.

git-svn-id: trunk@13093 -
2009-05-04 09:42:51 +00:00
yury
50060dfd52 * Do not assume sizeof(pint) section alignment if no alignment is specified for the section.
git-svn-id: trunk@13092 -
2009-05-04 08:27:36 +00:00
yury
070fa422b5 * Partially reverted r12648. PE flags should be set in main PE header (and it is done already). LoaderFlags in optional header are obsolete.
git-svn-id: trunk@13088 -
2009-05-03 14:43:46 +00:00
florian
442333d05f * fixed string length which makes ObjC section names fit
git-svn-id: trunk@12889 -
2009-03-14 20:26:31 +00:00
Jonas Maebe
6165536b5e + added {$modeswitch objectivec1}/-Mobjectivec1 mode switch to enable
the use of Objective-C 1.0 constructs. Because it is a mode switch, it
    can be used cumulatively with every syntax mode. Note that a {$mode xxx}
    statement resets all mode switches as well, so you cannot use the
    -Mobjectivec1 variant if you have such a statement in a unit. This
    modeswitch is currently only enabled for Darwin/PowerPC and Darwin/i386,
    as the backend support is not yet implemented for other platforms.
  + implemented selector() statement that can be used to create an Objective-C
    selector for the message with the specified *constant* name (in the future,
    it will also work for Objective-C method identifiers)
  + added SEL type to the system unit (the selector() statement returns it)
  + added all Objective-C segments to the assembler writers
  + (currently mostly dummy) objc1 unit that is automatically included if the
    {$modeswitch objectivec1} statement is used
  + some tests for the selector() statement

git-svn-id: trunk@12870 -
2009-03-08 18:40:32 +00:00
yury
89d466a3dc * Fixed writing debug link for external symbols file. Bug #13041.
git-svn-id: trunk@12686 -
2009-02-05 11:44:52 +00:00
florian
a3d784b8e5 * internal coff linker takes care of min./max. stack size as well as pe flags
git-svn-id: trunk@12648 -
2009-02-01 18:22:18 +00:00
Jonas Maebe
b1c3f76ff9 * changed the supported targets for assembler writers to a set, and
(hopefully correctly) limited all assembler writers to only the
    OSes they support (mantis #11801)

git-svn-id: trunk@12622 -
2009-01-28 15:12:43 +00:00
yury
9cc15bd994 * Do not write COFF string table into EXE if COFF symbol table is not present. It fixes loading of stripped DLL on Win9x. Bug #12629.
git-svn-id: trunk@12352 -
2008-12-12 14:54:14 +00:00
yury
4cabbe0e39 * Fixed compiler cycling with enabled range and overflow checking.
git-svn-id: trunk@11489 -
2008-07-29 21:11:03 +00:00
yury
eb9c9c77d8 * More correct fix for overflow check for RELOC_RELATIVE_24.
* Fixed 2007062701 while linking DLL.

git-svn-id: trunk@11484 -
2008-07-29 08:44:05 +00:00
yury
c92c034882 * Fixed overflow check for RELOC_RELATIVE_24.
git-svn-id: trunk@11483 -
2008-07-28 22:30:46 +00:00
yury
4cb3fef484 * Fixed executable size limit for wince.
git-svn-id: trunk@11482 -
2008-07-28 22:06:15 +00:00
yury
c84aa860bd * Added error message if resulting executable image size is too big to fit in memory. bug #11702.
git-svn-id: trunk@11481 -
2008-07-28 21:54:18 +00:00
yury
5e11e697b4 * Use unsigned integers for sizes and positions to break 2GB limit in tdynamicarray, object writer, internal linker, coff and PE headers.
git-svn-id: trunk@11480 -
2008-07-28 20:29:25 +00:00
yury
0bcaf8845f * Fixed 'mixed signed/unsigned' warnings.
* Suppressed 2 unreachable code warnings.
* Now x86 compiler compiles without warnings and notes! It will be great to keep such state in future...

git-svn-id: trunk@11455 -
2008-07-23 13:16:46 +00:00
yury
491f0fa1d8 * Replaced all user defined warnings by TODO comments to reduce compiler noise.
git-svn-id: trunk@11443 -
2008-07-23 11:00:03 +00:00
yury
fd0ed50331 * Removed/commented more unused variables.
* Fixed some uninitialized variable warnings.

git-svn-id: trunk@11442 -
2008-07-23 10:48:53 +00:00
yury
d5a3a28379 * Set PE_FILE_LARGE_ADDRESS_AWARE flag for win64 executables to allow access more than 2GB of memory.
* Fixed $setpeflags directive. Flags should be set in main PE header. LoaderFlags in optional header are obsolete.

git-svn-id: trunk@11433 -
2008-07-22 11:53:55 +00:00
yury
fcceb9cfa1 * Removed/ifdefed/commented unused local variables.
git-svn-id: trunk@11430 -
2008-07-20 23:00:31 +00:00
yury
efb280e0e9 * Use system_wince in all places.
git-svn-id: trunk@11429 -
2008-07-20 22:39:19 +00:00
yury
0e17d9e4d9 * Use system_wince instead of [system_arm_wince,system_i386_wince].
git-svn-id: trunk@11426 -
2008-07-20 22:22:57 +00:00
yury
22df9855d9 * For some unknown reason WM 6.1 requires .idata section to be read only. Otherwise it refuses to load DLLs greater than 64KB. Earlier versions of WinCE load DLLs regardless of .idata flags.
git-svn-id: trunk@11421 -
2008-07-20 20:28:37 +00:00
florian
9e88af9a78 * support ABSOLUTE32 in the COFF writer on x86-64, resolves #10641
git-svn-id: trunk@11376 -
2008-07-13 09:10:50 +00:00
florian
cad678840e + internal linker takes care of setpeflags
git-svn-id: trunk@10499 -
2008-03-17 21:06:35 +00:00
peter
f915cbc4ca * replace constants to formal const with variables
git-svn-id: trunk@10425 -
2008-03-02 14:01:22 +00:00
Jonas Maebe
f36e5411af * split cpu64bit compiler define into
a) cpu64bitaddr, which means that we are generating a compiler which
       will generate code for targets with a 64 bit address space/abi
    b) cpu64bitalu, which means that we are generating a compiler which
       will generate code for a cpu with support for 64 bit integer
       operations (possibly running in a 32 bit address space, depending
       on the cpu64bitaddr define)
   All cpus which had cpu64bit set now have both the above defines set,
   and none of the 32 bit cpus have cpu64bitalu set (and none will
   compile with it currently)
  + pint and puint types, similar to aint/aword (not pword because that
    that conflicts with pword=^word)
  * several changes from aint/aword to pint/pword
  * some changes of tcgsize2size[OS_INT] to sizeof(pint)

git-svn-id: trunk@10320 -
2008-02-13 20:44:00 +00:00
florian
ddad44bc1e * win64 -glw build fix
git-svn-id: trunk@9817 -
2008-01-20 15:13:42 +00:00
peter
793fd8fc09 * Add -Xg to help pages
* -Xg now produces a .dbg file with debuginfo
    that can be used by gdb. The main executable gets
    a debuglink section that references the .dbg file.

git-svn-id: trunk@9778 -
2008-01-17 01:20:37 +00:00
yury
13d948c07b * Fixed: import Address Table should contain the same data as Import Lookup Table.
* Perform import by name with index as hint, if both import name and import index are specified.
* Fixed import by ordinal when external linker is used.
* Fixed some warnings and notes.

git-svn-id: trunk@9083 -
2007-11-02 23:07:15 +00:00
peter
488c06d275 * don't reuse emptyint
git-svn-id: trunk@8724 -
2007-10-02 18:41:07 +00:00
peter
9f0ca44c94 * new tf_smartlink_library flag
* use create_smartlink[_sections|_library] to check what to 
    do for smartlinking

git-svn-id: trunk@8715 -
2007-10-01 16:55:08 +00:00
Jonas Maebe
70c2414daa * split off sec_rodata_norel from sec_rodata, and only put constant data
without relocations in sec_rodata_norel. It should be possible to make
    this new section read-only on all platforms, although currently it
    is only done for darwin, and for non-pic code written using the
    -Aas assembler writer.

    Most platforms also have a special section for "constant but with
    relocations" data, but such a section is currently only used for
    Darwin (others still use plain .data sections for that, like they
    did before)

git-svn-id: trunk@8650 -
2007-09-26 15:49:01 +00:00
florian
4151029ee5 + .fini section support
git-svn-id: trunk@8174 -
2007-07-28 08:40:10 +00:00
yury
28f0d47d83 * Don't be too strict while reading COFF symtable if obj file does not have COFF string table (to be compatible with LD and MS linkers). It fixes bug #9175.
git-svn-id: trunk@7913 -
2007-07-01 19:57:09 +00:00
yury
04147151e4 * Fixed stabs generation for DLLs by internal assembler (use RELOC_ABSOLUTE in all cases).
* Do not generate relocs by internal linker for sections which are not loaded in memory.

git-svn-id: trunk@7829 -
2007-06-26 22:51:21 +00:00
yury
38b8731ba0 * Restored relocs generation for dlls by internal linker. It fixes bug #9048.
* It is possible to generate relocs for exe with internal linker using -WB switch.

git-svn-id: trunk@7743 -
2007-06-20 15:47:10 +00:00
yury
73b8fba64b * fixed linking with eVC++ object files (bug #8542).
git-svn-id: trunk@7556 -
2007-06-02 22:14:35 +00:00
yury
821c91c230 * fix Mantis #8760: do not put actually empty sections in executable by internal linker.
* .bss section no longer required by internal linker.

git-svn-id: trunk@7316 -
2007-05-12 13:32:52 +00:00
yury
b2605b8ff6 * Internal linker now correctly links to gcc import libraries. It fixes win32 IDE with debugger support.
git-svn-id: trunk@7278 -
2007-05-05 19:21:30 +00:00
peter
29ffdefacb * secrel32 relocation support required by dwarf2 under windows
git-svn-id: trunk@7172 -
2007-04-25 09:06:36 +00:00
peter
71a11fafe9 * support long section names in executable
git-svn-id: trunk@7170 -
2007-04-25 07:32:13 +00:00
pierre
a7f5951cb0 * force empty .idata section at end of each dll to be in executable with oso_keep option
git-svn-id: trunk@7126 -
2007-04-17 23:09:09 +00:00
yury
7547f3a0c0 * Allow @ and ? characters in imported function name when AS is used. It fixes bug #8391.
+ test.

git-svn-id: trunk@6669 -
2007-02-26 17:51:38 +00:00
peter
9f3de7e809 * -Xg generates a separate file with the debug info sections
git-svn-id: trunk@6628 -
2007-02-24 15:06:31 +00:00
florian
6588b2cb57 * fix resource embedding on arm-wince
git-svn-id: trunk@6576 -
2007-02-20 18:01:10 +00:00
florian
c238bb15d1 * .init section support
git-svn-id: trunk@5835 -
2007-01-07 10:03:52 +00:00
yury
f8cfa49971 * enabled af_smartlink_sections for i386-wince.
git-svn-id: trunk@5743 -
2006-12-29 21:06:05 +00:00
yury
f258b907fb * Set procalign alignment for sections of import jumps table.
git-svn-id: trunk@5376 -
2006-11-14 17:05:46 +00:00
peter
f21f055373 * change hashobjectlist.Delete() calls to :=nil now that the .Delete() behaviour
is changed

git-svn-id: trunk@5365 -
2006-11-13 22:04:21 +00:00
yury
5f484a0f14 * section "fpc" was renamed to ".fpc".
* compiler version string is stored in .fpc.version section.
* debug start/end links are stored in .fpc.links section.
* fixed linking with eVC++ object files by internal linker.
* .fpc.links section is removed by internal linker before writing executable, because it is no longer needed.

git-svn-id: trunk@5305 -
2006-11-10 10:33:41 +00:00
yury
f89a0ac4c1 * small fix for previous commit.
git-svn-id: trunk@5252 -
2006-11-05 19:47:24 +00:00
yury
aa9c217f6b * unused coff symbols are removed by internal linker.
git-svn-id: trunk@5251 -
2006-11-05 19:39:50 +00:00
peter
4df4a4f7d1 * dynamic growth of blocks in tdynamicarray
* revert to old expand algorithms for fplist 

git-svn-id: trunk@5204 -
2006-11-03 13:44:44 +00:00
peter
cb246eb781 * Remove dos,strings units, use SysUtils instead
* replace split* functions with Extract* functions
  * Add Directory caching

git-svn-id: trunk@5102 -
2006-10-30 23:29:35 +00:00
peter
070b86a512 * order of named sections added
* fix debugstart and debugend labels

git-svn-id: trunk@5098 -
2006-10-30 22:34:22 +00:00
florian
85d63d9fa9 * settings refactored
git-svn-id: trunk@5094 -
2006-10-30 18:02:58 +00:00
peter
b7386124c4 * quick fix for broken relocation in stabs
git-svn-id: trunk@4874 -
2006-10-12 21:56:16 +00:00
peter
2ecd4522be * make rvasize the same as datasize
git-svn-id: trunk@4546 -
2006-09-03 20:41:02 +00:00
peter
bf1c390027 * refactor import library generation
* support variable imports in internal linker

git-svn-id: trunk@4544 -
2006-09-03 19:22:31 +00:00
yury
5aef17adae * Internal linker now creates .reloc section for DLLs.
git-svn-id: trunk@4046 -
2006-07-01 21:45:54 +00:00
yury
03f892719d * added import by ordinal number in internal linker.
git-svn-id: trunk@4037 -
2006-07-01 15:53:18 +00:00
peter
89e2f8b5df * prevent crash when reading unknown section
git-svn-id: trunk@4006 -
2006-06-29 21:29:15 +00:00
peter
f5c1839ff0 * support static library (.a) linking
* move win linker script to t_win
  * rename some win32 to win in t_win

git-svn-id: trunk@3991 -
2006-06-28 20:26:53 +00:00
florian
dc2bef3875 + implemented directives $setpeflags, $maxstacksize, $minstacksize and $imagebase, fixes #6349 and #6714
git-svn-id: trunk@3935 -
2006-06-25 10:22:42 +00:00
yury
01edb71190 * internal linker removes imports referenced by unused code.
git-svn-id: trunk@3832 -
2006-06-09 20:57:48 +00:00
yury
fb9f8bb2a1 * Support for -WB<image_base> option in internal linker.
git-svn-id: trunk@3828 -
2006-06-09 11:08:46 +00:00
yury
e80e5be980 * RELOC_RVA fix for ARM cpu.
* Added offset overflow check for RELOC_RELATIVE_24.

git-svn-id: trunk@3827 -
2006-06-09 11:06:10 +00:00
yury
550626ef34 - Removed need of assembler startup files for wince. Now compiler directly creates .pdata section needed for arm-wince exception handling.
git-svn-id: trunk@3764 -
2006-06-02 08:36:25 +00:00
yury
ba04f1a147 * Internal linker does not leave reference to .dll if no imports from it are used.
* Internal linker writes FPC version to EXE header.
* Internal linker writes subsystem version 3.0 for wince.

git-svn-id: trunk@3760 -
2006-05-31 22:32:08 +00:00
yury
b73557ea4e * fixed wince internal linker.
git-svn-id: trunk@3719 -
2006-05-28 20:09:22 +00:00
yury
2bf89e2040 * Internal linker support for wince.
git-svn-id: trunk@3712 -
2006-05-27 22:49:22 +00:00
peter
a57708e63d * DLL support
git-svn-id: trunk@3623 -
2006-05-21 21:07:49 +00:00
peter
392ef22a7f * win imports are only by importname not anymore per procdef
git-svn-id: trunk@3622 -
2006-05-21 20:40:18 +00:00
florian
688547953d * fixed win64 coff writing
git-svn-id: trunk@3493 -
2006-05-13 16:04:33 +00:00
florian
83a0c8cd4b + support for more win64 specific relocs
git-svn-id: trunk@3482 -
2006-05-11 19:34:21 +00:00
peter
739c322f60 * fix dllscanner for win32
git-svn-id: trunk@3449 -
2006-05-07 10:20:17 +00:00
florian
cae35add51 + reading of winx64 coff object files generated by MS-VC
git-svn-id: trunk@3426 -
2006-05-06 07:59:37 +00:00
yury
9ad6409662 * Fixed linking for arm-wince target.
git-svn-id: trunk@3349 -
2006-04-29 09:44:22 +00:00
florian
001ca388eb * fixed important library writing on arm
git-svn-id: trunk@3336 -
2006-04-26 18:11:25 +00:00
peter
ce58e15393 * fix coff section names to fix resourcestrings with
the external linker
  * create import libraries for dll imports, this uses
    the new objdata framework to generate the binary
    object files directly without needing an assembler pass
  * store import_dll and import_name in ppu
  * external linker uses import libraries
  * internal linker uses import info from symtables,
    no dlls are needed anymore

git-svn-id: trunk@3255 -
2006-04-17 20:48:22 +00:00
peter
82b6546997 * fix importing for win32
git-svn-id: trunk@3147 -
2006-04-05 07:17:41 +00:00
peter
96db39b15d * fix compile for win32
git-svn-id: trunk@3146 -
2006-04-05 06:31:01 +00:00
Vincent Snijders
3c8968a4b3 * moved misplaced comma
git-svn-id: trunk@3145 -
2006-04-05 06:21:21 +00:00
florian
a69ae7ca34 * fixed win32->win64 cross compilation
* fixed win64 import section generation in linker module

git-svn-id: trunk@3143 -
2006-04-04 20:43:34 +00:00
peter
d542fd97fb * use TFPHashObjectList instead of TDictionary
git-svn-id: trunk@3133 -
2006-04-02 21:18:04 +00:00
peter
e2f768982d * fix idata generation
git-svn-id: trunk@3118 -
2006-04-02 00:58:28 +00:00
peter
be88cd47b2 Merged revisions 3090-3113 via svnmerge from
svn+ssh://peter@www.freepascal.org/FPC/svn/fpc/branches/linker/compiler

r3090 | peter | 2006-03-30 15:10:15 +0100 (Thu, 30 Mar 2006) | 2 lines

  * infrastructure for .vtable directives

r3094 | peter | 2006-03-31 10:01:48 +0100 (Fri, 31 Mar 2006) | 2 lines

  * vtable directive fixes

r3113 | peter | 2006-04-01 22:49:57 +0100 (Sat, 01 Apr 2006) | 2 lines

  * Smart VTable linking using Symbols

git-svn-id: trunk@3115 -
2006-04-02 00:11:17 +00:00
florian
5e51aa7968 * fixed pe flags x86_64
* fixed idata for x86_64

git-svn-id: trunk@3112 -
2006-04-01 20:09:13 +00:00
florian
3129dd042e * fixed i386 compilation
git-svn-id: trunk@3110 -
2006-04-01 15:10:46 +00:00
florian
79b2432369 * fixed relocation fixup for x86_64
git-svn-id: trunk@3107 -
2006-04-01 13:41:11 +00:00
florian
3324a4a14b * additional ie
git-svn-id: trunk@3106 -
2006-04-01 13:23:15 +00:00
florian
44f797e5bc + x86_64 relocation support
git-svn-id: trunk@3105 -
2006-04-01 13:13:40 +00:00
florian
1d46c65496 * enabled internal linker for winx64
* more descriptive error messages for the coff reader
* fixed coff magic for x64

git-svn-id: trunk@3104 -
2006-04-01 12:39:15 +00:00
peter
7f4b051f99 * support subsystem
* fixed stab
  * always keep .rsrc section

git-svn-id: trunk@3089 -
2006-03-30 11:24:17 +00:00
peter
f9ccac3f30 * alignment of dwarf sections
git-svn-id: trunk@3059 -
2006-03-27 12:51:05 +00:00
peter
37c81492ad Merged revisions 2827,2831,2837,2932-2980 via svnmerge from
svn+ssh://peter@www.freepascal.org/FPC/svn/fpc/branches/linker/compiler

r2827 (peter)
  * smartlinking of resourcestrings


r2831 (peter)
  * process_ea 64bit fixes


r2837 (peter)
  * linker script

git-svn-id: trunk@2981 -
2006-03-19 22:12:52 +00:00
peter
b7fe6797bf Merged revisions 2921-2922,2925 via svnmerge from
http://svn.freepascal.org/svn/fpc/branches/linker/compiler

........
r2921 | peter | 2006-03-15 08:35:00 +0100 (Wed, 15 Mar 2006) | 2 lines

  * pass ObjectWriter to ObjectOuput

........
r2922 | peter | 2006-03-15 12:40:30 +0100 (Wed, 15 Mar 2006) | 2 lines

  * refactor asmdata

........
r2925 | peter | 2006-03-15 16:09:39 +0100 (Wed, 15 Mar 2006) | 3 lines

  * add cfi to asmdata
  * move asmlist, asmcfi, asmdata to own unit

........

git-svn-id: trunk@2932 -
2006-03-16 08:52:22 +00:00