Commit Graph

13854 Commits

Author SHA1 Message Date
sergei
747cd55b09 * Fixed 64-bit ELF program header definition (field order is different from 32-bit counterpart!)
* Factored values used in the ELF header into constants, so they can be reused when reading object files.
* Writing first 16 bytes of ELF header should be endian-neutral.
* Section symbols must have st_name equal to zero, using section shstridx is incorrect because it is an index into .shstrtab, not into .strtab (actually written content is unchanged, because section_write_symbol is called while shstridx is still zero).

git-svn-id: trunk@21455 -
2012-06-02 11:35:12 +00:00
florian
52372a88ca * arm and x86-64 can do exception handling without a framepointer based stack
git-svn-id: trunk@21454 -
2012-06-01 21:32:23 +00:00
florian
3ae5fc8c04 * patch by Nico Erfurth: adds a check for SM_ASR to also support removal of unnecessary sign extension before STRH.
git-svn-id: trunk@21446 -
2012-05-31 20:24:48 +00:00
florian
af7bb6faab * ignore unused parameters when inlining
git-svn-id: trunk@21445 -
2012-05-31 18:48:38 +00:00
florian
4f273aa08d * patch by Nico Erfurth: Handle STR*/LDR* properly in ARM Peephole optimizers
git-svn-id: trunk@21444 -
2012-05-31 17:00:19 +00:00
pierre
b9f8934d7e * Fix for go32v2 specific failure in test/cg/tcalval5 with -Aas option
git-svn-id: trunk@21443 -
2012-05-31 12:55:56 +00:00
pierre
069cd9f250 Fix go32v2 staticClibprefix used by internal linker
git-svn-id: trunk@21442 -
2012-05-31 09:34:53 +00:00
sergei
14d66a64a4 + Definitions and utility functions for executable ELF files
git-svn-id: trunk@21441 -
2012-05-31 09:23:35 +00:00
sergei
1c271251f8 - Removed tcoffexeoutput.FCoffSyms, it is never used (symbols are written directly to the output)
* Improved TCoffObjOutput.ReadObjData to use one Seek less, also improved error messages.

git-svn-id: trunk@21440 -
2012-05-31 09:01:11 +00:00
sergei
3a89544cd6 + Internal linker for go32v2:
* Enable smart linking on go32v2
  * Adapted external linker script for long section names (ld 2.17 from fpcbuild repository does not seem to actually remove unused sections though)
  * Do not pass '-lc' twice to external linker
  * Pass -Map with correct filename to external linker if -Xm is specified on command line
  * Debug sections for DJCOFF must have zero memory position and flag COFF_STYP_INFO (not COFF_STYP_NOLOAD).

git-svn-id: trunk@21435 -
2012-05-30 13:45:36 +00:00
sergei
1579583484 * COMISD (and COMISS, too) instruction cannot have memory reference as destination, Mantis #22150.
git-svn-id: trunk@21432 -
2012-05-29 14:43:01 +00:00
florian
fbc77b74c2 * patch by Nico Erfurth to remove superfluouse moves
git-svn-id: trunk@21422 -
2012-05-28 21:58:06 +00:00
florian
c348b6f2cc * patch by Nico Erfurth:
- Support MLA and MUL in DataMov2Data
- SMLAL and UMLAL are also reading from oper[0]
- UMLAL, UMULL, SMLAL and SMULL are writing to oper[1]

git-svn-id: trunk@21421 -
2012-05-28 18:11:31 +00:00
florian
0fa1bf27c1 + tmipsaddnode.pass_1 setting expectloc correctly
git-svn-id: trunk@21420 -
2012-05-28 16:24:21 +00:00
florian
1b3dd8eefe * patch by Jeppe Johansen: fixes TCGMIPS.getfpuregister
git-svn-id: trunk@21419 -
2012-05-28 16:23:11 +00:00
florian
2162df1802 * patch by Jeppe Johansen: fix gen_load_cgpara_loc for mips(el)
git-svn-id: trunk@21417 -
2012-05-28 16:21:30 +00:00
Jonas Maebe
5dc75a92a3 * don't write size suffix for popcnt on Darwin, its assembler doesn't
support it (fixes webtbs/tw13186)

git-svn-id: trunk@21412 -
2012-05-28 14:00:02 +00:00
florian
7bdbb3448e * minimum compiler version to build the compiler is 2.6.0
git-svn-id: trunk@21411 -
2012-05-28 13:30:51 +00:00
sergei
6571b4d140 * Factored code to create internal link script for debug sections into a separate procedure.
git-svn-id: trunk@21410 -
2012-05-28 13:28:21 +00:00
Jonas Maebe
9f0fb9cf10 - removed "<<<<<<< HEAD" leftover from a conflicting merge
git-svn-id: trunk@21409 -
2012-05-28 12:08:14 +00:00
sergei
8814f56081 * Fixed oso_debug section attribute being not preserved while reading/writing DJCOFF object files.
* Fixed header data positions for DJCOFF executables, they need adjustment by stub size.
* Fixed symbol values in DJCOFF executables, they must be absolute.
* Fixed missing oso_common flag on TExeOutput.commonObjSection, causing incorrect COFF relocations to this section.

git-svn-id: trunk@21408 -
2012-05-28 11:46:52 +00:00
florian
9e180fb318 * remove unneeded zero extensions from 16 to 32 Bit
git-svn-id: trunk@21404 -
2012-05-28 07:21:27 +00:00
sergei
35e3e363dd * Changed writing section symbols to use storage class COFF_SYM_LOCAL (3), this is what is used by both GCC and MSVC. Previously used COFF_SYM_SECTION (104) is accepted by GNU binutils, but only for PE targets (and silently converted to COFF_SYM_LOCAL), for DJGPP it issues warnings.
* Assign section indexes independent from symbol indexing.
* Fixed section flags not assigned while reading DJGPP object files.
* Fixed objData type for TDJCoffexeoutput.
* Fixed entry point address of DJGPP executables.
* Fixed filling exe section headers for DJGPP.

git-svn-id: trunk@21396 -
2012-05-26 14:22:13 +00:00
Jonas Maebe
a2426178dc * don't insert type conversions in add nodes if both arguments are constant
and if the result does not depend on the types of the arguments (to
    prevent "qwordconst>int64const" being turned into
    "int64(qwordconst)>int64const" and thereby potentially change the outcome)
    (mantis #19622)

git-svn-id: trunk@21395 -
2012-05-26 14:14:59 +00:00
Jonas Maebe
9e0184884e * correctly change the signdness information of tordconstnodes that are
simplified via typeconvnode (corrects resultdef of "qword(1) shl 33",
    mantis #22133)
  * simplify shl/shr nodes after their resultdef has been set, so the
    resultdef used during simplify is set (fixes same expression as above
    when it is calculated by an inline function)

git-svn-id: trunk@21394 -
2012-05-26 13:31:23 +00:00
Jonas Maebe
baa8fa39a8 * converted code to trash variables (-gt) to operate at the node tree level,
and also use this code to trash local variables in inlined routines
   o fixes mantis #22088
   o makes it possible to also implement it for the jvm target in the future

git-svn-id: trunk@21393 -
2012-05-26 11:32:39 +00:00
Jonas Maebe
f2c82e32cd - removed g_indirect_sym_load() from hlcgobj/hlcg2ll because this cgobj
method is only used anymore internally in cgobj.tcg and its descendants
  * made tcg.g_indirect_sym_load() protected to ensure it stays that way

git-svn-id: trunk@21392 -
2012-05-26 11:32:33 +00:00
Jonas Maebe
8234a842e6 * fixed conversion of empty ansistring/widestring constants to pchar on
the jvm target + test

git-svn-id: trunk@21391 -
2012-05-26 11:32:20 +00:00
Jonas Maebe
11968c4261 * use A_J instead of A_B (without explicitly defined condition) to jump to
wrapped interface methods

git-svn-id: trunk@21389 -
2012-05-25 14:50:50 +00:00
florian
21b94f675f + add for MLA the same register interferences as for MUL
* register interferences for MUL/MLA are only needed for less than ARMv6

git-svn-id: trunk@21385 -
2012-05-24 19:14:58 +00:00
sergei
bbb08bbf66 ogcoff.pas:
- removed empty destructor and checks for nil before .Free (they are done in tobject.free itself)
+ added COMDAT definitions.

git-svn-id: trunk@21383 -
2012-05-24 16:34:13 +00:00
Jonas Maebe
ffe68ca284 * do not search overloaded assignment/conversion operators for internal
type conversions (those should always re-interpret the raw bits),
    except for variants (because those are sometimes generated internally)
    -- done so that -gt code at the node tree level can insert explicit
    typecasts to integer types without triggering overloaded explicit
    typecast operators such as in tests/test/terecs14

git-svn-id: trunk@21381 -
2012-05-24 15:34:27 +00:00
Jonas Maebe
0037de6ac9 * disable range/overflow checking for subsetreg/ref code, to prevent
spurious errors when calculating masks (was also the case for the old
    code in cgobj)

git-svn-id: trunk@21380 -
2012-05-24 15:33:49 +00:00
florian
638d0d49c0 + take advantage of the mla instruction when calculating array offsets
git-svn-id: trunk@21375 -
2012-05-23 20:48:26 +00:00
sergei
71c8b9cf8a * ogelf.pas: cleaned up code that creates default sections.
git-svn-id: trunk@21374 -
2012-05-23 14:21:44 +00:00
florian
c75486db89 * patch by Nico Erfurth:
Reorder unaligned Load sequence on ARM

The old version produced code like that:

ldrb rDEST, [rBASE]
ldrb rTemp, [rBASE, #1]
orr  rDEST, rDEST, rTEMP lsl #8 (2 stall cycles)
ldrb rTemp, [rBASE, #2]
orr  rDEST, rDEST, rTEMP lsl #16 (2 stall cycles)
ldrb rTemp, [rBASE, #3]
orr  rDEST, rDEST, rTEMP lsl #24 (2 stall cycles)

This creates a lot of stall-cycles on ARM Implementations with load
delay slots like Marvel Kirkwood or Intel XScale. With the usual up to 2
stall-cycles this code requires a total of 13 cycles (7 instructions + 6 stall
cycles) in best case.

The new code uses a second temp register to avoid the stall cycles.

ldrb rDEST, [rBASE]
ldrb rTemp1, [rBASE, #1]
ldrb rTemp2, [rBASE, #2]
orr  rDEST, rDEST, rTEMP1 lsl #8
ldrb rTemp1, [rBASE, #3]
orr  rDEST, rDEST, rTEMP2 lsl #16
orr  rDEST, rDEST, rTEMP1 lsl #24 (1 stall cycle)

The rescheduling and second register bring the total cycles down to 8.
If a later rescheduling should happen for the last orr it even can go
down to 7.

git-svn-id: trunk@21363 -
2012-05-22 19:09:20 +00:00
sergei
dc03282cb7 + Support assembling expressions ".long L2-L1" where label L1 belongs to the current objsection and L2 comes from any objsection. This is done using relative relocations and is compatible with GNU AS.
* Also fixed ogcoff.pas to handle these relative relocations correctly.

git-svn-id: trunk@21362 -
2012-05-22 14:59:24 +00:00
svenbarth
dbc410de63 Allow the usage of a generic's name without type arguments inside of nested classes inside the generic. This fixes Mantis #19499, but also Mantis #18688.
* symtable.pas:
    + add function "get_generic_in_hierarchy_by_name" which returns a def with the name of the symbol in the given object/record hierarchy (useful only in non-Delphi modes)
    + add function "return_specialization_of_generic" which returns the specialization def of a given class inside the given object/record hierarchy
* pexpr.pas, factor, factor_read_id: instead of checking whether the names of the found symbol and the current_structdef are equal, check whether the generic appears in hierarchy of current_structdef
* ptype.pas:
    * id_type: check whether the found symbol is a generic dummy and we are currently parsing a generic then return the correct def of the generic instead of the dummy one
    * single_type: when using the generic type without type parameters the def must resolve to the specialized def when specializing the class instead of the generic def which the dummy symbol points to
    * read_named_type, expr_type: like in "single_type" we need to resolve the use of the parameterless type name to the correct specialization def instead of the generic def
* pdecobj.pas, object_dec: also set the typesym of the current_structdef as otherwise some assumptions about generics with the above mentioned changes aren't valid anymore (like the def the typesym is unset again afterwards)
+ add tests for both bug reports (the one for 19499 is slightly modified so that it does not contain any errors)

git-svn-id: trunk@21361 -
2012-05-22 12:19:11 +00:00
Jonas Maebe
9bfb8b5d48 * fixed (currently harmless) error in r21287 that specified that the full
contents of a procvar had to be loaded in case of a procedure of object
    or nested procvar rather than only the code address (harmless, because
    this code is only active for low level targets currently and since
    r21330 the location's size was used because the source and destination
    types were the same)

git-svn-id: trunk@21352 -
2012-05-20 21:11:45 +00:00
florian
5f0bcd9248 * patch by Nico Erfurth:
Optimize ARM OP_MUL/OP_IMUL for x*ispowerof2(const+1) cases

Calculations like a*7 can be optimized to a*8-a with the usage of RSB and left
shifts which can be done in a single cycle.

git-svn-id: trunk@21351 -
2012-05-20 20:50:04 +00:00
Jonas Maebe
78bb3e323a * fixed source type information for values loaded in arrayconstructor after
r21069

git-svn-id: trunk@21350 -
2012-05-20 20:34:14 +00:00
florian
21573f50c5 * allow LOC_CONSTANT to be used as vmt pointers in the cg, resolves #21914
git-svn-id: trunk@21349 -
2012-05-20 19:02:36 +00:00
Jonas Maebe
7dbfd9dc81 * don't say a config file is empty if it only contains #define, #undef,
#write and/or #include statements (mantis #20504)

git-svn-id: trunk@21345 -
2012-05-20 15:00:53 +00:00
Jonas Maebe
eb7e192226 * support pointer constants as initialisation values for procvar typed
constants in Delphi mode on non-treetypedconstbuilder platforms
    (mantis #21267)

git-svn-id: trunk@21344 -
2012-05-20 14:51:15 +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
ccf895af5a * link.res is a real linkerscript when we target binutils, not when we
target the AIX linker
  * never quote file names added to link.res when it's not a linkerscript
    (only newline is a separator in the case)

git-svn-id: trunk@21342 -
2012-05-20 13:30:42 +00:00
Jonas Maebe
4a730bd053 * fixed source type for location_force_register() when loading second
parameter of inc/dec into a register

git-svn-id: trunk@21338 -
2012-05-19 14:39:29 +00:00
Jonas Maebe
9d860904fe * merged AIX changes from ncgutil.gen_proc_symbol_end() into
hlcgobj.gen_proc_symbol_end() and removed the routine from ncgutil (it's
    not used anymore)

git-svn-id: trunk@21337 -
2012-05-19 14:39:12 +00:00
florian
6c8eed21c4 + implement auto inlining (-Ooautoinline)
+ implement trashing of local variables if subroutine is inlined
* fix some errors releated to interproc. gotos and inlining
+ node_count function
* inline cannot be used with iochecking and safecall calling conventions
* track inherited usage
* don't inline if inherited is used

git-svn-id: trunk@21335 -
2012-05-19 13:30:02 +00:00
marco
a98e75fc89 * remove used of deprecated function. Use this one from dos.
git-svn-id: trunk@21332 -
2012-05-19 11:34:04 +00:00