Commit Graph

176 Commits

Author SHA1 Message Date
sergei
6280ee2eed * Changed attributes of .pdata section so it is smart-linkable on x86_64.
* Changed alignment of .pdata section to 4.
+ Support saving RELOC_NONE relocations to .o files and reading them back on x86_64.

git-svn-id: trunk@19070 -
2011-09-15 15:22:03 +00:00
sergei
392dafd175 * Another attempt to align section raw data size in COFF headers. Without this, image modification WinAPIs like BeginUpdateResource/EndUpdateResource typically corrupt the image. Resolves #16852 (at least partially).
git-svn-id: trunk@18172 -
2011-08-11 16:42:24 +00:00
sergei
c9f92c0323 * Excluded oso_executable from attributes of user sections. User sections may currently be specified only for variables and typed consts, which are not executable.
* Fixed TLS directory size written to PE header when cross-compiling. It must be the value for target, not for host.

git-svn-id: trunk@18024 -
2011-07-27 14:10:22 +00:00
sergei
6a2e87121b * ogcoff.pas: sort all objsections having '$' in the name, not just .idata$*. This is a documented PECOFF feature and it is required for tls callback stuff to link correctly regardless of the order of declarations in source files.
git-svn-id: trunk@17968 -
2011-07-10 12:24:35 +00:00
sergei
5d5ddbbe3e * Revert rounding section data size, it should be done in a more sophisticated way
git-svn-id: trunk@17950 -
2011-07-07 11:34:57 +00:00
sergei
2d96c34b06 * Improvements to PE executable output:
* Clear bits in section flags, that are only valid for object files
  * Round section datasize up to filealignment (PECOFF v8 documentation requires this)
  * Zero datapos and datasize for all sections w/o data, not just for .bss
  * Produce IMPORT_ADDRESS_TABLE directory in exe header
  * Entirely smartlink away unused DLLs (these used to have two terminating thunks left)

git-svn-id: trunk@17949 -
2011-07-06 20:55:57 +00:00
pierre
372b16b2e6 * Look for __FPC_tls_callbacks, should be reset to nil for DLLs, not yet done
git-svn-id: trunk@17908 -
2011-07-01 19:28:32 +00:00
pierre
30feeff3c2 + TlsDirectory handling code
git-svn-id: trunk@17903 -
2011-07-01 14:30:32 +00:00
florian
f328b6d635 + user section type
+ parsing of section directive for variables
  + section test
  + write section names in the assembler/binary writers correctly
  * allow section only after ; and for embedded targets

git-svn-id: branches/usersections@17154 -
2011-03-20 15:42:28 +00:00
pierre
fd2b777435 * ogcoff.pas:
{ Direct 32 bit sign extended,
        win64 mingw GNU compiler
        also generates this type
        inside coff objects
        We assume they are equivalent to
        IMAGE_REL_AMD64_ADDR32  PM 2010-11-27 }

git-svn-id: trunk@16454 -
2010-11-26 23:46:49 +00:00
pierre
fa4b4906e6 * ogcoff.pas: Add support for RELOC_SECREL32.
* cfidwarf.pas: Fix CIE pointer inside dwarf-FDE entry which must be
    a section relative offset.

git-svn-id: trunk@16062 -
2010-09-29 12:58:21 +00:00
pierre
7c04d8d13b From patch submitted by Willibald Krenn in Bug Report 17500.
* assemble.pas (TInternalAssembler.WriteStab): Use RELOC_ABSOLUTE32 for
   32-bit stab entry.
 * ogcoff.pas: Add check for correct generated reloc section size.
 * systems/t_win.pas: Use 0x400000 image base for x86_64 programs using
   stabs debug information format.

git-svn-id: trunk@16056 -
2010-09-28 10:06:54 +00:00
florian
c1f3d8dcaa * unified names of system_*/systems_* sets
git-svn-id: trunk@14566 -
2010-01-07 18:16:20 +00:00
florian
34227e811d + patch by Sven Barth to add native NT rtl support to the compiler, resolves #14886
git-svn-id: trunk@14565 -
2010-01-07 17:42:11 +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
0c675a4039 * the objc1 unit has been renamed to objc
* the objc unit links against the Foundation instead of against the Cocoa
    framework, and inludes an interface to either the fragile or non-fragile
    obj-c run time depending on the target platform
  + support for the non-fragile Objective-C runtime/ABI, as used on Mac OS X
    for ARM (iPhone) 64 bit (PowerPC/64, x86_64) -- all these targets now
    are now also supported for the objectivec1 modeswitch
  + support for private_extern symbol bindings, required for the above
  * mark objcclasses that are declared in the implementation section of a
    unit as "hidden" (not sure what the effect is, since the Objective-C
    runtime does not seem to do anything with this flag)
  * enabled all obj-c tests for the newly supported platforms

git-svn-id: branches/objc@13763 -
2009-09-27 15:24:50 +00:00
yury
bf00b3e94b * Replaced some ifdef x86_64 by ifdef cpu64bitaddr, since it is more correct.
git-svn-id: trunk@13159 -
2009-05-17 12:43:58 +00:00
yury
ede93974bc * Fixed writing of external debug info when reloc section should be created.
git-svn-id: trunk@13146 -
2009-05-15 22:30:52 +00:00
yury
c4439e4e39 * Properly write 64-bit relocations into .reloc section.
* Warning when 64-bit object file contains 32-bit absolute relocations. In such case an executable image can be loaded into lower 4Gb of address space only.

git-svn-id: trunk@13110 -
2009-05-07 10:46:56 +00:00
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