Commit Graph

18398 Commits

Author SHA1 Message Date
nickysn
f41692710f - removed bogus comment from TMZExeUnifiedLogicalSegment.CalcMemPos
git-svn-id: trunk@31423 -
2015-08-25 14:04:51 +00:00
nickysn
2467cb34c2 * fixed MemBasePos calculation for segments that go beyond the previous segment base
git-svn-id: trunk@31421 -
2015-08-25 13:06:50 +00:00
nickysn
2c05bcc28f + i8086-msdos internal linker: in the far data memory models, fill
MaxExtraParagraphs in the MZ exe header according to the specified max heap
  size

git-svn-id: trunk@31420 -
2015-08-25 11:40:02 +00:00
nickysn
dad0f015a9 - removed the TOmfObjSectionGroup class, because it is not used
git-svn-id: trunk@31419 -
2015-08-25 11:32:30 +00:00
nickysn
0894ede9cd + enable the i8086-msdos internal linker
git-svn-id: trunk@31417 -
2015-08-25 01:32:46 +00:00
nickysn
6e20e0fc84 + added checks and error messages in case a 16-bit segment or group exceeds 64k
git-svn-id: trunk@31416 -
2015-08-25 01:01:20 +00:00
nickysn
851ebd9850 * use a normalized MemBasePos (i.e. offset<16) for stack segments
git-svn-id: trunk@31415 -
2015-08-25 00:29:02 +00:00
nickysn
f3d5bf3743 * the result of tobjsymbol.address changed from 'aword' to 'qword' as well
git-svn-id: trunk@31414 -
2015-08-25 00:19:26 +00:00
nickysn
8977c0fc78 * TExeSection.Size and .DataPos changed from aword to qword, because:
1) aword follows the ALU size of the CPU, not the address type
  2) MemPos is qword and is already checked against MaxMemPos

git-svn-id: trunk@31413 -
2015-08-25 00:08:02 +00:00
nickysn
fb1be14337 * yet another fix for the MZ relocation offsets
+ support RELOC_SEG and RELOC_SEGREL relocations pointing to an object section

git-svn-id: trunk@31412 -
2015-08-24 23:40:07 +00:00
nickysn
ba1c494cd6 * the code for displaying a symbol address in the linker map file moved to a
method in TObjSymbol

git-svn-id: trunk@31411 -
2015-08-24 22:12:00 +00:00
Jonas Maebe
677595880a + support for get_frame() for the LLVM target (using the llvm.frameaddress()
intrinsic)

git-svn-id: trunk@31409 -
2015-08-24 22:07:03 +00:00
Jonas Maebe
be9d2b1c26 * implement concatcopy for complex types by calling the llvm.memcpy()
intrinsic. This may insert actual calls to a function called memcpy with
    the signature of the libc function, but llvm optimizers are free to
    insert such calls by themselves already. This means that for non-libc
    targets, we will have to add weak symbols for memcpy/memmove/memset
    that call through to move/fillchar when using LLVM, so that these
    implementation are used when not linking to libc

git-svn-id: trunk@31408 -
2015-08-24 22:07:00 +00:00
Jonas Maebe
ba9d54beb5 * don't mangle symbol names for llvm intrinsics
git-svn-id: trunk@31406 -
2015-08-24 22:06:53 +00:00
Jonas Maebe
7a8921a060 * define CPULLVM when using the LLVM backend (in addtion to the CPUXXX define
for the actual target architecture)

git-svn-id: trunk@31405 -
2015-08-24 22:06:50 +00:00
Jonas Maebe
052af9200e * support external declarations for compilerprocs
o since there is no separate implementation for them, we have to immediately
     convert the symbol to lower case after parsing the declaration

git-svn-id: trunk@31404 -
2015-08-24 22:06:47 +00:00
nickysn
faa9362b44 + calculate and fill "min extra paragraphs" in the MZ header
git-svn-id: trunk@31403 -
2015-08-24 21:33:26 +00:00
nickysn
6665cec157 * put the startup code first also when using the internal linker in i8086 far
code memory models

git-svn-id: trunk@31402 -
2015-08-24 21:13:57 +00:00
nickysn
2100714ebe + implemented RELOC_SEG and RELOC_SEGREL fixups for a symbol target
* bug fix in the MZ relocation generated for RELOC_DGROUP/RELOC_DGROUPREL
  relocations
* reduced code duplication in TMZExeOutput.DoRelocationFixup a little by using
  nested procedures

git-svn-id: trunk@31401 -
2015-08-24 21:12:26 +00:00
nickysn
0eb1cd157a * don't subtract two from the end of the stack segment when calculating the
initial SP value - seems to be wlink compatible

git-svn-id: trunk@31399 -
2015-08-24 20:22:01 +00:00
nickysn
2431b6e63b * i8086-msdos internal linker: use a different approach for finding the stack
segment - either its class name must be 'STACK' (wlink compatible) or its
  combine type must be scStack (tlink compatible)

git-svn-id: trunk@31398 -
2015-08-24 20:18:44 +00:00
nickysn
d2a47a7c69 + fill the initial stack address in the MZ exe header
git-svn-id: trunk@31396 -
2015-08-24 18:28:00 +00:00
nickysn
ea27b97f3a * fixed the order of the _NULL and _AFTERNULL segments
git-svn-id: trunk@31395 -
2015-08-24 18:14:55 +00:00
nickysn
18cdc08c26 + prevent certain special omf sections from being smartlinked out
git-svn-id: trunk@31394 -
2015-08-24 18:10:50 +00:00
nickysn
fe69e3324c + implemented RELOC_DGROUP and RELOC_DGROUPREL in TMZExeOutput.DoRelocationFixup
git-svn-id: trunk@31393 -
2015-08-24 17:55:44 +00:00
nickysn
0eda4c954d + handle omf references to a segment with frame method=target
git-svn-id: trunk@31392 -
2015-08-24 17:34:04 +00:00
nickysn
d8f88599de + support REL_DGROUP and REL_DGROUPREL in TExeOutput.RemoveUnreferencedSections
git-svn-id: trunk@31391 -
2015-08-24 17:25:33 +00:00
nickysn
e88dc71983 + import DGROUP omf fixup references
git-svn-id: trunk@31390 -
2015-08-24 16:53:44 +00:00
nickysn
73ea3b7ff1 + implemented fixups targeting a logical segment offset in the omf internal linker
git-svn-id: trunk@31389 -
2015-08-24 15:50:47 +00:00
nickysn
3d3eb6c472 * stop with an error when encountering omf fixups that aren't yet implemented
git-svn-id: trunk@31388 -
2015-08-24 15:20:59 +00:00
nickysn
d7f08866e5 * use the TMZExeOutput.MZFlatContentSection property in TInternalLinkerMsDos.GetTotalSizeForSegmentClass
instead of finding the exe section by name

git-svn-id: trunk@31387 -
2015-08-24 15:09:35 +00:00
nickysn
449506ffb7 + write mz exe section data
+ fill MaxExtraParagraphs in the MZ header with $ffff by default, to prevent DOS
  from loading the program at the highest possible address

git-svn-id: trunk@31386 -
2015-08-24 15:02:37 +00:00
nickysn
fdbfaacec8 + calculate the MZ loadable image size (excluding bss, stack and heap)
+ only write the loadable image size number of bytes to .com files

git-svn-id: trunk@31385 -
2015-08-24 14:42:43 +00:00
nickysn
a7e63581b4 + i8086-msdos internal lniker: find the program entry point and fill it in the
mz exe header; also write it in the linker map file

git-svn-id: trunk@31384 -
2015-08-24 14:22:17 +00:00
nickysn
e0bd25191e + also take into account the frame method when converting the omf start address to a symbol
git-svn-id: trunk@31383 -
2015-08-24 13:46:37 +00:00
nickysn
cff94639d5 * i8086-msdos internal linker: improved handling of the _edata and _end internal
symbols - add them to 'DGROUP' and define them in a section with class 'BSS'

git-svn-id: trunk@31382 -
2015-08-24 12:39:39 +00:00
nickysn
989afc6ecb * show section addresses relative to the segment's MemBasePos in the i8086-msdos
internal linker map file

git-svn-id: trunk@31380 -
2015-08-24 01:31:16 +00:00
nickysn
368ba47d6e * support writing more than 1024 zeros in tobjectwriter.writezeros
git-svn-id: trunk@31379 -
2015-08-24 01:09:53 +00:00
nickysn
fa8841d575 + support omf group-relative fixups pointing to external symbol (e.g.
'wrt dgroup' references)
- removed debug code from TMZExeOutput.DoRelocationFixup

git-svn-id: trunk@31378 -
2015-08-24 00:55:56 +00:00
nickysn
173713ce57 * preserve original order (as specified in the link script) of omf sections with
the same name. This ensures that the startup code always comes first, which is
  important for .com files

git-svn-id: trunk@31377 -
2015-08-24 00:30:24 +00:00
nickysn
f182a98d7b * also preserve TObjSymbol.group when updating external with global symbols
git-svn-id: trunk@31376 -
2015-08-24 00:25:37 +00:00
nickysn
f08e98bfd0 + partial implementation of DoRelocationFixups for the i8086-msdos internal linker
git-svn-id: trunk@31375 -
2015-08-24 00:23:56 +00:00
nickysn
78cbb1ba2b + implemented writing .com files in the i8086-msdos internal linker
git-svn-id: trunk@31374 -
2015-08-23 22:06:30 +00:00
nickysn
fa9a1f706b + i8086-msdos internal linker: calculate the final segments and groups locations
in memory (incl. segment bases) before DoRelocations; list segments and groups
  in the map file as well

git-svn-id: trunk@31373 -
2015-08-23 21:36:24 +00:00
nickysn
5dc42404cf * capitalize omf segment class names, as that's how other 16-bit compilers write them
git-svn-id: trunk@31371 -
2015-08-22 19:07:04 +00:00
nickysn
e09ab50724 * capitalize the group name 'DGROUP' in the generated omf object files, because
that's how it is usually written by other 16-bit compilers

git-svn-id: trunk@31369 -
2015-08-22 16:28:36 +00:00
nickysn
70677e3e44 + added a descendant class for omf section groups, which adds base address, size
and a method to calculate these new fields

git-svn-id: trunk@31363 -
2015-08-22 12:23:49 +00:00
marco
f59b88f6f8 * Add support for libraries with C linking under Haiku
Patch by Olivier, mantis #28558

git-svn-id: trunk@31362 -
2015-08-22 12:23:15 +00:00
nickysn
b74a104e48 * instantiate TObjSectionGroup through a class type, to allow using a child
class for certain object formats

git-svn-id: trunk@31360 -
2015-08-22 11:27:22 +00:00
nickysn
9aeb94676c + added virtual method to tobjsection for returning a string representation of
the section's base address for the internal linker map file
* implemented it for omf sections to return the address in 'seg:ofs' format

git-svn-id: trunk@31359 -
2015-08-21 16:21:16 +00:00
nickysn
a762532ae1 * changed the MemPos field in TObjSection and TExeSection from aword to qword:
1) aword follows the ALU size of the CPU, not the address size
  2) it is already qword in TExeOutput and its methods and there's already
     MaxMemPos to check if the limits of the platform/exe format have been
     exceeded

git-svn-id: trunk@31357 -
2015-08-21 14:13:27 +00:00
nickysn
157345c9c2 + obtain and return the internal module name in brackets in the internal omf
library reader (just like the internal .ar reader does)

git-svn-id: trunk@31355 -
2015-08-20 23:24:54 +00:00
nickysn
808b5dfb78 * allow gaps between LEDATA records, as nasm seems to produce them. They're
automatically filled with zeros. This fixes reading of the tiny memory model
  startup code object module by the i8086-msdos internal linker.

git-svn-id: trunk@31354 -
2015-08-20 22:57:15 +00:00
nickysn
1b9eeee25d + order omf sections first by classname, then by name
git-svn-id: trunk@31352 -
2015-08-20 21:21:52 +00:00
nickysn
eed7e3aa6b + implemented GetCode/Data/BssSize in the i8086-msdos internal linker
git-svn-id: trunk@31351 -
2015-08-20 21:11:09 +00:00
nickysn
7d586df038 * override DoRelocationFixup in TMZExeOutput - doing nothing for now, but
prevents the "abstract method called" error

git-svn-id: trunk@31350 -
2015-08-20 20:55:24 +00:00
nickysn
0fb92b803b * set the MZ exe section limit to 640k
git-svn-id: trunk@31348 -
2015-08-20 15:01:39 +00:00
nickysn
07fff73527 * fixed the "Incompatible section options" error when using the omf internal linker to produce msdos executables
git-svn-id: trunk@31347 -
2015-08-20 14:50:59 +00:00
nickysn
a4c188ff01 + partial implementation of omf fixup reading
git-svn-id: trunk@31346 -
2015-08-19 15:55:03 +00:00
Jonas Maebe
4c5191f5d7 * generate LLVM typedefs for file-typed data
git-svn-id: trunk@31344 -
2015-08-18 16:10:29 +00:00
Jonas Maebe
2cf17c0487 * don't generate DWARF cfi when targeting LLVM, it will do that itself
git-svn-id: trunk@31343 -
2015-08-18 16:09:44 +00:00
nickysn
6d6ed840a4 * set the data record start offset of the omf fixup object when reading omf fixups
git-svn-id: trunk@31342 -
2015-08-18 15:18:03 +00:00
nickysn
ebde434255 * specify the proper segment ordering in the link script of the i8086-msdos
internal linker

git-svn-id: trunk@31341 -
2015-08-18 14:44:00 +00:00
nickysn
cbc676e80e * ignore case (i.e. always convert to upper case) in omf segment/class/overlay/group names
git-svn-id: trunk@31340 -
2015-08-18 14:41:29 +00:00
nickysn
d4b0b6f6e6 * use SegmentName+'||'+ClassName for the name of OMF sections when reading OMF
files, because omf segments are (according to the spec) identified by the
  tuple <SegmentName,ClassName,OverlayName> and not just by name (and we ignore
  the overlay name)

git-svn-id: trunk@31339 -
2015-08-18 14:31:59 +00:00
nickysn
0dab94e35d * i8086-msdos internal linker: put the static libraries in a group, to enable
multiple passes when resolving symbols

git-svn-id: trunk@31338 -
2015-08-18 13:37:57 +00:00
nickysn
3c0d83bd74 * fixed reading of OMF library dictionary
git-svn-id: trunk@31337 -
2015-08-17 13:03:57 +00:00
nickysn
9ff0057a94 * return true if TOmfObjInput.ReadObjData is successful
git-svn-id: trunk@31336 -
2015-08-17 12:25:59 +00:00
Jonas Maebe
add015f808 * ensure that the dwarf file table contains an entry if the current unit
contains any code, even if we cannot generate any debug info for that
    code (because the default file is file number 1, and if that table is
    empty some gdb versions crash)

git-svn-id: trunk@31335 -
2015-08-17 08:47:38 +00:00
Jonas Maebe
e06181749c * guarantee the order of parameter pushes again after r31201 on platforms
that don't use a fixed stack (mantis #28454)
   o moved the code to finalise managed out parameters from ncgcal to ncal,
     and add it to the init code of the call node (so it's evaluated before
     any parameters are processed, ensuring that mantis #28390 stays fixed)

git-svn-id: trunk@31328 -
2015-08-16 12:47:09 +00:00
Jonas Maebe
c95a3f2cf7 * firstpass rather than typecheckpass statements added to the call node
init/done block, as these can be added while pass_1 is ongoing

git-svn-id: trunk@31327 -
2015-08-16 12:47:04 +00:00
nickysn
41203a9152 * support far classrefdef targets on i8086 in thlcgcpu.a_loadaddr_ref_reg. This
fixes code generation for loadvmtaddr nodes in i8086 far data memory models
  after r31064.

git-svn-id: trunk@31326 -
2015-08-15 17:24:49 +00:00
nickysn
ef207475fd + parse omf modend records and add symbol for module start address
git-svn-id: trunk@31324 -
2015-08-14 15:42:43 +00:00
nickysn
e1298a035c * provide msdos-specific dummy overrides for GetCode/Data/BssSize to avoid crash
when using the (not yet finished) internal linker

git-svn-id: trunk@31323 -
2015-08-14 14:36:18 +00:00
nickysn
d4a4b9a57b * refactored the internal linker ar object reader object creation to allow using
different 'ar' implementations under different platforms
* use the omflib reader instead of the ar reader in the msdos internal linker

git-svn-id: trunk@31322 -
2015-08-14 13:52:45 +00:00
nickysn
8206c6dbd0 * the code for determining the code, data and bss sizes in the internal linker
moved to virtual methods, to allow for platform specific overrides (e.g. for
  supporting section names, other than '.text', '.data' and '.bss', etc.)

git-svn-id: trunk@31321 -
2015-08-13 15:07:24 +00:00
nickysn
e59c164844 + parse FIXUPP records in the omf object reader (although converting them TOmfRelocation is not yet implemented)
git-svn-id: trunk@31320 -
2015-08-13 13:44:46 +00:00
Jeppe Johansen
59f164b948 Changed type of size argument from aint to asizeint. This previously broke things on 8bit targets.
git-svn-id: trunk@31319 -
2015-08-13 01:57:09 +00:00
nickysn
c3133c498a + added property tobjectreader.pos, which returns the current position when reading an object file
git-svn-id: trunk@31315 -
2015-08-11 15:46:44 +00:00
nickysn
515d702408 - removed semicolon after 'begin'
git-svn-id: trunk@31314 -
2015-08-11 14:30:32 +00:00
nickysn
0cd1a88588 * fixed memory leak in TOmfObjInput.ReadExtDef
git-svn-id: trunk@31313 -
2015-08-11 13:39:26 +00:00
nickysn
9fc100574c + added property TObjSymbol.group for use with the omf object format
git-svn-id: trunk@31312 -
2015-08-11 13:38:28 +00:00
nickysn
c50991713c + implemented reading of omf public names
git-svn-id: trunk@31311 -
2015-08-11 13:04:22 +00:00
Jonas Maebe
0d87df71a9 * default to ARMv7/VFPv3 for Darwin/ARM (since that's what most iOS devices
use nowadays)

git-svn-id: trunk@31302 -
2015-08-09 09:08:26 +00:00
svenbarth
39016c032e Fix for Mantis #28442. Do not generate the VMT record definition for generic classes. It isn't used anyway.
nobj.pas, TVMTBuilder:
  * generate_vmt_def: check for df_generic (not is_generic!) and abort if set

+ added test

git-svn-id: trunk@31301 -
2015-08-07 15:02:55 +00:00
Jonas Maebe
4c0807c596 * simplified enum lookup table management by using tfplist instead of
an ad hoc dynamic array implementation

git-svn-id: trunk@31295 -
2015-08-06 18:34:31 +00:00
Jonas Maebe
a722b5dbc5 * add alignment padding to internally constructed llvm records
git-svn-id: trunk@31290 -
2015-08-05 21:06:09 +00:00
Jonas Maebe
b4e61b2469 * enable the llvm code generator for VMT generation
git-svn-id: trunk@31288 -
2015-08-05 21:06:04 +00:00
Jonas Maebe
bfa94ae908 * further (final?) reworking of llvm external symbol handling:
o all external symbol definitions are now inserted in the llvmtype post pass
     based on all declarations and types used in llvm instructions
   o this means we don't have to use the workaround with the Pascal mangled
     names anymore for all external names, as we now insert the external
     references only once we know all type information

git-svn-id: trunk@31287 -
2015-08-05 21:06:01 +00:00
Jonas Maebe
6dcf61f057 * an alias is an explicit definition of a symbol -> override types gleaned
from implicit ones

git-svn-id: trunk@31286 -
2015-08-05 21:05:58 +00:00
Jonas Maebe
a58504990a * fixed llvm handling of routines that are normally declared in the
interface of a unit, or forward declared, and then the implementation turns
    out to be external. We now properly generate a wrapper routine at the
    Pascal level for the original declaration that calls through to the
    external routine

git-svn-id: trunk@31285 -
2015-08-05 21:05:55 +00:00
Jonas Maebe
1cdaf8e332 * don't write external linkage for aliases: llvm 3.6 has a bug that rejects
linkage types for aliases (or its documentation hasn't been updated), and
    external linkage is the default so it doesn't matter for earlier versions

git-svn-id: trunk@31284 -
2015-08-05 21:05:52 +00:00
florian
29ba426fcc * call DefaultReplacements for #WRITE and #INCLUDE, resolves #28315
git-svn-id: trunk@31263 -
2015-08-02 20:45:49 +00:00
florian
9a55e8fa3c * do not call typecheckpass unncessarily in generic definitions, it might cause only errors, resolves #28058
git-svn-id: trunk@31262 -
2015-08-02 20:29:30 +00:00
florian
f1decfb6b6 * do not generate a vmt record for generics, they are only needed for specializations
git-svn-id: trunk@31261 -
2015-08-02 19:51:08 +00:00
Jeppe Johansen
2b80d46492 Added STM32F7xx controller units and types.
git-svn-id: trunk@31257 -
2015-07-31 22:21:16 +00:00
Jonas Maebe
9a8a323578 * (again) fixed loading the address of the string data of an ansi/
unicodestring constants: specify the type of the pointer to the
    string record (which is indirect) rather than that of the string
    array (which will implicitly be the result of the getelementptr)

git-svn-id: trunk@31256 -
2015-07-30 16:58:19 +00:00
Jonas Maebe
d7f6744f7b * converted ncgrtti to the high level typed constant builder
o the result is still not very clean due to the fact that this data
     is almost completely unstructured due to variable-length strings
     everywhere, which means that
    a) we cannot just load recorddefs from the system or typeinfo unit
       and use those as templates
    b) we cannot easily reuse the recorddefs we create ourselves (except
       if the strings have the same length -- this is the reason for all
       of the names specified to begin_anonymous_record: to reuse defs
       as much as possible rather than creating new ones all the time)
    c) we have to add explicitly aligned subrecords everywhere to insert
       explicit alignment on platforms that need it

git-svn-id: trunk@31255 -
2015-07-30 16:58:17 +00:00
Jonas Maebe
c946a85ae6 * give an internalerror if a typed const builder is finalised while there
is still an unfinished aggregate

git-svn-id: trunk@31254 -
2015-07-30 16:58:14 +00:00
Jonas Maebe
2cfc3ca4d1 * end the vmtdef aggregate so appropriate padding is inserted (if necessary)
git-svn-id: trunk@31253 -
2015-07-30 16:58:11 +00:00
Jonas Maebe
e93660c170 - removed ttai_lowleveltypedconstbuilder.queue_addrn(), as we are always
implicitly taking the address of a complex expression in a typed constant
    (you cannot put the contents of another memory location in a typed
    constant)

git-svn-id: trunk@31252 -
2015-07-30 16:58:07 +00:00
Jonas Maebe
0e42559047 * support for queueing an access to a series of fieldvarsyms by name in the
typed const builder

git-svn-id: trunk@31251 -
2015-07-30 16:58:04 +00:00
Jonas Maebe
6f4fe415e9 * support specifying the alignment of the start of an anonymous record
in the typed const builder (packrecords is not enough in case there are
    only fields smaller than the desired alignment)

git-svn-id: trunk@31250 -
2015-07-30 16:58:01 +00:00
Jonas Maebe
6f5905684f + support for specifying the name of fields added to anonymous record
types that are constructed on the fly by the high level typed const
    builder

git-svn-id: trunk@31249 -
2015-07-30 16:57:58 +00:00
Jonas Maebe
b55c7df996 * factored out internal type prefixes
git-svn-id: trunk@31248 -
2015-07-30 16:57:55 +00:00
Jonas Maebe
413680f593 * factored out getting a previously created internal type by name
git-svn-id: trunk@31247 -
2015-07-30 16:57:52 +00:00
Jonas Maebe
ddeab221c0 * when starting a queued expression, immediately emit any necessary padding
bytes,becayse if we emit them at the end then we may interpret the first
    padding byte as the final component of the queued expression

git-svn-id: trunk@31246 -
2015-07-30 16:57:49 +00:00
Jonas Maebe
e34a16d1f1 * change rtti_mangledname resultdef into TSymStr
git-svn-id: trunk@31245 -
2015-07-30 16:57:45 +00:00
Jeppe Johansen
ffe67a93b4 Fix is_calljmp to include call instructions. This was breaking some optimizations previously.
Add debug messages to peephole optimizations and add some extra optimizations.

git-svn-id: trunk@31244 -
2015-07-30 06:29:21 +00:00
Jeppe Johansen
55669f62b1 Added most AVR controllers.
Made absolutevarsym use PUint instead of AWord for its offset to fix range errors.

git-svn-id: trunk@31242 -
2015-07-29 21:01:21 +00:00
florian
ee89e99189 * correctly write an error if one tries to implement a method introduced in a generic in a specialization of the generic, resolves issue #23169
git-svn-id: trunk@31241 -
2015-07-28 21:16:47 +00:00
florian
d014572b8e * do not use an extra register, if CPC does a comparison with 0,
this was previously "fixed" by the peephole optimizer, but this increased
  register pressure

git-svn-id: trunk@31239 -
2015-07-27 19:49:05 +00:00
florian
df999735f3 * use R1 in comparisons if left=0 instead of loading 0 into (a) register(s)
git-svn-id: trunk@31238 -
2015-07-27 19:49:03 +00:00
florian
4d3552943d * correctly write OUTPUT_ARCH to the linker script, resolves issue #28395
git-svn-id: trunk@31236 -
2015-07-27 19:49:00 +00:00
pierre
dc06f85b58 Set ALLOW_WARNINGSS to 1 for m68k and avr compiler to allow successful fullinstall completion
git-svn-id: trunk@31214 -
2015-07-15 15:27:27 +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
pierre
960a72f821 Use AnsiString and sysutils GetEnvironmentVariable function to avoid truncation of PATH to 255 chars
git-svn-id: trunk@31202 -
2015-07-11 13:59:06 +00:00
Jonas Maebe
9118146bc1 * ensure that managed out-parameters are processed before any other
parameters:
   1) since they are finalised on the caller side, if that same value
      is passed as a value parameter as well and its reference count
      was 1, then the value parameter will contain an invalid pointer
   2) since finalisation involves a call, for optimal code generation
      purposes they should also be evaluated first
    (mantis #28279, #28390)

git-svn-id: trunk@31201 -
2015-07-10 22:04:35 +00:00
Jonas Maebe
5f21d6df93 * enable -godwarfsets by default
git-svn-id: trunk@31199 -
2015-07-07 17:12:31 +00:00
Jonas Maebe
945fd4fcf5 * wait till the end of typecheckpass before we load a call context's self
parameter instead of immediately doing it in the constructor of the call
  node, and then only create it if we actually need it.

  It was previously created in the call node constructor because it needs to be
  done before pass_1 (which is where it is actually used) due to pass_1 possibly
  being performed in the context of inlining (and then a wrong self parameter
  may be found, or none at all), and it was done unconditionally because at that
  point we don't know yet whether or not a self parameter will be necessary (as
  we haven't resolved the overloads/procdef yet).

  The problem with this is that if we use the parentfpstruct way of handling
  accesses to outer scope locals/parameters, we need to know all locals/
  parameters that will be accessed from nested routines after typecheckpass,
  otherwise we get crashes. The problem was that if a call to an RTL routine was
  generated by the compiler in a routine nested inside a method during pass_1,
  and this nested routine itself did not access self of the method (so self was
  not added to its parentfpstruct during the typecheckpass), then the
  unconditional reference to self when creating the call caused a compiler
  crash (introduced in r30908)

git-svn-id: trunk@31197 -
2015-07-07 16:34:14 +00:00
Jonas Maebe
5d15a28e75 - reverted workaround from r15939 that hasn't been necessary since FPC 2.6.0,
since that version already shiped with GNU AS 2.21 (mantis #17337)

git-svn-id: trunk@31196 -
2015-07-06 08:05:37 +00:00
florian
ba1297b1ab + provide also 8 and 16 bit div/mod helper
* tmoddivnode.first_moddivint does not force a 32 bit helper, the used helper depends now on the resultdef type set by tmoddivnode.pass_typecheck

git-svn-id: trunk@31195 -
2015-07-05 20:16:50 +00:00
florian
cf64e05c6f * use generic mod/div code for avr
git-svn-id: trunk@31194 -
2015-07-05 17:05:43 +00:00
Jonas Maebe
af2c7bf00f * don't perform CSE on typeconversion nodes inserted for absolute
references, or anything below them (mantis #27210)

git-svn-id: trunk@31193 -
2015-07-04 22:28:31 +00:00
Jonas Maebe
1bcc276dcf * remove implicit typecast to extended automatically inserted for trunc/round
(due to the declaration in the system unit) on x86_64 if this allows us
    to use SSE code instead (mantis #28366)

git-svn-id: trunk@31192 -
2015-07-03 21:01:18 +00:00
Jonas Maebe
fa1ac2515e * don't look for overloaded operators in case of internally generated
type conversions (mantis #28375)

git-svn-id: trunk@31191 -
2015-07-03 20:19:48 +00:00
Jonas Maebe
ee87d3bba9 * fixed "case <string> of" with multiple labels for a single statement after
r30855 (mantis #28372)

git-svn-id: trunk@31190 -
2015-07-03 20:04:25 +00:00
Jonas Maebe
e9d2eb6cff * fixed a_load_reg_reg() when storing an array/record to another
array/record type (can happen for parameters/function results
    that got a different type for ABI reasons)

git-svn-id: trunk@31189 -
2015-07-03 20:04:22 +00:00
Jonas Maebe
36e5291d94 * converted tcgguidconstnode.pass_generate_code to use the high level typed
constant builder

git-svn-id: trunk@31188 -
2015-07-03 20:04:18 +00:00
Jonas Maebe
7a8b5fd6c5 * several fixes for emitting aggregate typed constants with C/ABI packing:
o don't emit explicit padding bytes (LLVM adds them)
   o don't mark them in LLVM as packed either

git-svn-id: trunk@31187 -
2015-07-03 20:04:15 +00:00
Jonas Maebe
4edb6e68fd * fixed emitting Pascal extended typed constants inside aggregates for llvm
(have to be emitted as arrays of bytes to ensure they don't take up
     more than 10 bytes)

git-svn-id: trunk@31186 -
2015-07-03 20:04:11 +00:00
Károly Balogh
0d1c85a095 Amiga-likes: support unit_env environment variable for unit paths
git-svn-id: trunk@31180 -
2015-06-29 21:42:40 +00:00
Károly Balogh
a5abd4acd7 AROS/x86_64: fixed resources to use res_elf, set default stacksize for the more sensible 1MB instead of 8MB
git-svn-id: trunk@31179 -
2015-06-29 21:30:53 +00:00
Károly Balogh
02b9b1743e AROS/x86_64: fixed linker support by removing duplicated code and unifying it with i386
git-svn-id: trunk@31178 -
2015-06-29 21:28:51 +00:00
Károly Balogh
77bdd83bfc AROS/x86_64: regenerated Makefiles
git-svn-id: trunk@31177 -
2015-06-29 00:09:06 +00:00
Károly Balogh
f0ccbc87f2 AROS/x86_64: enable syscalls code in the parser, fix EAX->RAX reference base while calculating syscall offset
git-svn-id: trunk@31172 -
2015-06-28 23:04:51 +00:00
florian
af6ffd751f + generate optimized code for shifts/rotates by constants
git-svn-id: trunk@31170 -
2015-06-28 20:28:51 +00:00
Károly Balogh
7ca62febcd AROS/x86_64: initial AROS/x86_64 support and implement syscalls for AROS/x86_64
git-svn-id: trunk@31169 -
2015-06-28 19:16:40 +00:00
Jonas Maebe
7866bae173 * don't crash when trying to access the call_self_node in case it doesn't
exit, but instead give an error (bug introduced in r30950, mantis #28338)

git-svn-id: trunk@31150 -
2015-06-23 21:23:29 +00:00
Jonas Maebe
b21610050f * don't store reusable defs based on other defs from localsymtables into the
static/globalsymtable. The static/global symtable is stored to the PPU
    while the localsymtables are not, which means we get dangling references
    when reloading such defs from the ppu afterwards

git-svn-id: trunk@31149 -
2015-06-23 21:23:25 +00:00
Jonas Maebe
508828958c * changed getprocaddressprocvar() into a tprocvardef.getreusableprocaddr()
class method

git-svn-id: trunk@31148 -
2015-06-23 21:23:22 +00:00
Jonas Maebe
f40ea04540 * changed getarraydef() into a tarraydef.getreusable() class method
git-svn-id: trunk@31147 -
2015-06-23 21:23:18 +00:00
marco
8d145ce706 * initialize secalign before case statement to avoid warning. Mantis #28326
git-svn-id: trunk@31145 -
2015-06-22 11:48:42 +00:00
Jonas Maebe
f402b0d7df * changed getpointerdef() into a tpointerdef.getreusable() class method
o allows removing the ugly x86 hacks

git-svn-id: trunk@31144 -
2015-06-22 08:17:49 +00:00
Jonas Maebe
62784ef902 * copy the vmt_entry node in tcallnode.dogetcopy (mantis #28313)
o mention why it doesn't have to be compared in tcallnode.docompare

git-svn-id: trunk@31071 -
2015-06-16 21:24:55 +00:00
Jonas Maebe
d60f60154a * fixed the def used to load non-objc loadvmtaddr nodes (for llvm)
git-svn-id: trunk@31064 -
2015-06-13 22:48:48 +00:00
Jonas Maebe
3597e710b6 * fixed several VMT element types to correspond to the types used to
construct the VMT def in the VMT builder in r30950

git-svn-id: trunk@31063 -
2015-06-13 22:48:46 +00:00
Jonas Maebe
4c11d34169 * fixed loading the address of the string data of an ansi/unicodestring
constant in the llvm code generator (the constant is a record rather than
    a pointer to a record -> not indirect)

git-svn-id: trunk@31062 -
2015-06-13 22:48:43 +00:00
Jonas Maebe
b176ed9f80 * ensure that the llvmst is initialised before using a field's llvmfieldnr
(and at the same time take advantage of this to perform a sanity check)

git-svn-id: trunk@31061 -
2015-06-13 22:48:40 +00:00
Jonas Maebe
89c4bd8522 * index the llvm shadow symtable with a fieldvarsym rather than with the
index of the corresponding llvm fieldvar, as this index is a member
    of the fieldvarsym that only gets initialised once the llvm shadow
    symtable gets built, which in turn is triggered by trying to access
    it for the first time -> if fieldvarsym.llvmfieldnr got loaded by
    the compiler before evaluating the llvmst expression and if the
    llvmst hadn't been built yet, this llvmfieldnr was not yet initialized

git-svn-id: trunk@31060 -
2015-06-13 22:48:37 +00:00
Jonas Maebe
494206fd6a * use queue_is_active() method to determine whether the complex typed
expression queue is active rather than the existing ad hoc check,
    which failed when no item had been added to the queue yet

git-svn-id: trunk@31059 -
2015-06-13 22:48:34 +00:00
Jonas Maebe
8d0c5ecf5a * added protected queue_is_active() function to determine whether the
complex typed constant expressions queue is currently active

git-svn-id: trunk@31058 -
2015-06-13 22:48:31 +00:00
Jonas Maebe
bcd04953c2 * fixed open array constructors for llvm
git-svn-id: trunk@31057 -
2015-06-13 22:48:28 +00:00
Jonas Maebe
b9d4d9b141 * corrected type passed to a_bit_test_reg_loc_reg() (we force left into
a register of size opdef before)

git-svn-id: trunk@31056 -
2015-06-13 22:48:26 +00:00
Jonas Maebe
9175809d5d * use correct llvm type conversion operator when loading a "named register"
with a pointer value into an integer register or vice versa

git-svn-id: trunk@31055 -
2015-06-13 22:48:23 +00:00
Jonas Maebe
cf2e46c2c1 * reworked external symbol handling on llvm to deal with the fact that
a single external symbol may be used with multiple declarations that
    have different types:
   o always declare an alias with the Pascal-mangled name that aliases the
     external symbol, with the type of that Pascal declaration
   o if the external symbol is not actually external but in the same unit,
     we will determine the type of that symbol via its declaration and
     insert type conversions in the alias declarations in case they use a
     different type
   o if it is external (so there is no declaration from which we can determine
     its real type) and there are nevertheless multiple aliases for it with
     different types, we just take the type of the first alias and insert
     type conversions for the other aliases. LLVM will take care of the
     conflicting types in multiple modules when performing WPO if necessary

git-svn-id: trunk@31054 -
2015-06-13 22:48:20 +00:00
Jonas Maebe
b39bc5888a * moved the import name handling entirely to hlcgobj so it can be
overridden

git-svn-id: trunk@31053 -
2015-06-13 22:48:17 +00:00
Jonas Maebe
54dd25b448 * support llvm aliases for defs other than procdef
git-svn-id: trunk@31052 -
2015-06-13 22:48:14 +00:00
Jonas Maebe
4eea652576 * fixed writing non-default linkage and visibility of llvm alias declarations
git-svn-id: trunk@31051 -
2015-06-13 22:48:11 +00:00
Jonas Maebe
1019a6b090 * use the def of the paraloc rather than the parasym's vardef in
gen_load_para_value(), as this may be different depending on
    the calling conventions
  * adapt llvm's gen_load_cgpara_loc() to use this passed def rather
    than hardcoding the para's def (although these will normally match)

git-svn-id: trunk@31050 -
2015-06-13 22:48:08 +00:00
Jonas Maebe
b9c9422fa7 * fixed type of reference used to store an ansichar that was converted
inline to a shortstring

git-svn-id: trunk@31049 -
2015-06-13 22:48:05 +00:00
Jonas Maebe
2cdf969649 * don't define asmsymbols for weak external functions as local/global
git-svn-id: trunk@31048 -
2015-06-13 22:48:02 +00:00
Jonas Maebe
75a6ba4113 - removed symcpu dependencies
git-svn-id: trunk@31047 -
2015-06-13 22:47:59 +00:00
Jonas Maebe
ab0d445999 * fixed truncation errors for a*int/word in ppudump for architectures
> 32 bits

git-svn-id: trunk@31046 -
2015-06-13 22:47:56 +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
florian
c0dd2047f9 * cosmetics, entries are now properly aligned
git-svn-id: trunk@31039 -
2015-06-13 16:55:36 +00:00
florian
919c539ff5 * better estimation of callparanode complexity
git-svn-id: trunk@31038 -
2015-06-13 16:50:55 +00:00
Jeppe Johansen
ab9c8bb569 Fixed startup assembler code for the case where there's no data in .bss and/or in .data.
Fixed _stack_top symbol calculation so it works for all controllers.
Added ATTINY2313 controller.

git-svn-id: trunk@31031 -
2015-06-13 12:30:50 +00:00
Jeppe Johansen
03880c2f74 Added some peephole optimizations, and fixed generic unconditional jump optimizations, for AVR.
Fixed multiplication code generation for AVR controllers without mul instructions.
Added handling of the old interrupt procedure directive such that procedures with that use RETI instead of RET.

git-svn-id: trunk@31030 -
2015-06-13 12:25:11 +00:00
Jeppe Johansen
c5b24c5ce3 Changed cast to allow more loop iterations than the native bit-ness of the architecture.
git-svn-id: trunk@31029 -
2015-06-13 12:20:12 +00:00
florian
b1147ba1b7 + OpCmp2Op optimization for AVR
git-svn-id: trunk@31013 -
2015-06-09 21:06:37 +00:00
Károly Balogh
0dafa78d27 ppudump: made it compile with -Sew by turning off unreachable code warning for Real80BitToStr() function
git-svn-id: trunk@31010 -
2015-06-07 23:59:24 +00:00
Károly Balogh
21329e6606 Amiga: enable using of external resources we have no internal resource support yet for Amiga Hunk executables
git-svn-id: trunk@31007 -
2015-06-07 18:07:06 +00:00
Károly Balogh
8a09c5f40d MorphOS: register ELF resources info
git-svn-id: trunk@31004 -
2015-06-07 17:37:22 +00:00
Károly Balogh
8e3ebb87cd use res_elf on MorphOS for resources
git-svn-id: trunk@31003 -
2015-06-07 16:42:32 +00:00
nickysn
318874837f + implemented 16-bit dos MZ exe header writer
git-svn-id: trunk@31002 -
2015-06-07 14:31:02 +00:00
nickysn
2c1049b5d4 + read the LEDATA omf records (i.e. the actual section data)
git-svn-id: trunk@30975 -
2015-06-04 23:03:22 +00:00
nickysn
d0d3cef868 + implemented reading of omf extdef (external symbols) records
git-svn-id: trunk@30973 -
2015-06-03 13:07:48 +00:00
Jeppe Johansen
db6093023b Fixed initialization code for MK20D7 controllers.
Added flash configuration section to RTL and linker script.

git-svn-id: trunk@30972 -
2015-06-02 22:59:03 +00:00
nickysn
096743d74d + also read the omf segment size and set objsec.Size
git-svn-id: trunk@30971 -
2015-06-01 23:31:53 +00:00
nickysn
1cae939615 + implemented parsing of omf group definitions as well
git-svn-id: trunk@30970 -
2015-06-01 23:03:48 +00:00
nickysn
5539d6366f + implemented reading of SEGDEF omf records
git-svn-id: trunk@30969 -
2015-06-01 21:28:55 +00:00
nickysn
28f7f16fc7 + implemented reading of the LNAMES omf record
git-svn-id: trunk@30968 -
2015-06-01 14:25:51 +00:00
nickysn
be57d4900d + started implementing TOmfObjInput.ReadObjData - we go through the expected
records and read them (without parsing them yet) and verify their checksums

git-svn-id: trunk@30965 -
2015-05-31 22:32:54 +00:00
florian
9216e561e2 + make use of sbi/cbi
git-svn-id: trunk@30964 -
2015-05-31 21:11:53 +00:00
florian
a3553a7320 + adds missing ct_atmega168 and ct_atmega368 symbols, thanks to mischi
git-svn-id: trunk@30960 -
2015-05-31 17:59:39 +00:00
Jonas Maebe
337716d413 * fixed subscripting classes in llvm
* fixed subscripting an objectdef in llvm if the field belongs to a
    parent type

git-svn-id: trunk@30957 -
2015-05-31 16:51:07 +00:00
Jonas Maebe
6c5f1327f4 * generate the correct llvm type description for classrefdef
git-svn-id: trunk@30956 -
2015-05-31 16:51:04 +00:00
Jonas Maebe
dd3d0ae5bc * set the type of the hidden $vmt parameter to the correct classrefdef and
adjust the parameter comparison code to ignore types of $vmt parameters
    when comparing (previously they were all voidpointer and hence also
    equal)

git-svn-id: trunk@30955 -
2015-05-31 16:51:02 +00:00
Jonas Maebe
e9800ad3f9 * make the resultdef of left and right equal when comparing a procvar
with nil (for llvm)

git-svn-id: trunk@30954 -
2015-05-31 16:50:59 +00:00
Jonas Maebe
0d00c1a19d * fixed type used when subscripting implicit pointer types (don't add
another indirection)

git-svn-id: trunk@30953 -
2015-05-31 16:50:56 +00:00
Jonas Maebe
a0a77f3105 * suppress (harmless) range error
git-svn-id: trunk@30951 -
2015-05-31 16:50:50 +00:00
Jonas Maebe
3f736f6114 * handle the loading of VMT entries at the node level, so it's done in a
type-safe way (for LLVM, and also internal consistency checking between
    the VMT as generated in nobj.pas and ncgvmt.pas)
   o also converted the VMT validity checking to the node level

git-svn-id: trunk@30950 -
2015-05-31 16:50:47 +00:00
Jonas Maebe
822b943d08 - removed most special handling of self (the self parameter has had the
correct type since quite a while)
   o exceptions:
    o objects/records (self is a "var" parameter there, and sometimes
      we want to load it as a pointer to an object instead
    o Objective-C class methods, where self has to be id (to have a signature
      compatible with what Objective-C compilers generate), but when loading
      it we want a classrefdef of the current class for type check and
      method resolving

git-svn-id: trunk@30949 -
2015-05-31 16:50:44 +00:00
Jonas Maebe
fa9ba26cb4 * fixed the type of self in Objective-C category methods
git-svn-id: trunk@30948 -
2015-05-31 16:50:42 +00:00
Jonas Maebe
703e31512d * moved JVM-specific code of tloadvmtaddrnode.pass_1 to njvmmem
* create separate nodes for Objective-C in tloadvmtaddrnode.pass_1
    instead of implicitly relying on the fact that the Objective-C
    ISA field is at the same offset as the VMT of Object-Pascal
    classes
   o translate the resulting loads of ISA field into direct pointer
     accesses, so that even on non-fragile ABI platforms we don't
     go via an indirection (like clang/gcc)

git-svn-id: trunk@30947 -
2015-05-31 16:50:39 +00:00
Jonas Maebe
033c28e5ac * removed unnecessary and potentially wrong typecast
git-svn-id: trunk@30946 -
2015-05-31 16:50:36 +00:00
Jonas Maebe
48ffe7b033 * don't create RTTI for internally generated recorddefs (doing so can cause
undefined references to RTTI for some of the fields, and we don't need
    it anyway because these types are not user-visible and we don't generate
    variables of these types)

git-svn-id: trunk@30945 -
2015-05-31 16:50:33 +00:00
Jonas Maebe
0eab091e1a * factored symansistr-define-conditional handling of fforcedprocname into
a property

git-svn-id: trunk@30944 -
2015-05-31 16:50:30 +00:00
florian
cf552b2a0b + ATmeag168/ATmeag368 support
git-svn-id: trunk@30938 -
2015-05-30 18:01:14 +00:00