Commit Graph

199 Commits

Author SHA1 Message Date
nickysn
dd9ea88b79 * TObjSection.MemPos reverted back to qword after r33692, since it breaks the
i8086-msdos internal linker for .exe files larger than 64kb (thanks pierre for
  investigating this issue)

git-svn-id: trunk@33740 -
2016-05-21 16:45:36 +00:00
florian
f950dca8a5 * use PUInt for passing around sizes in ogbase as the width of the data type should dependent on the address size and not the ALU size
git-svn-id: trunk@33692 -
2016-05-16 07:55:09 +00:00
florian
90b284e169 + generate .debug_aranges sections for dwarf debug info: enables faster address to debug info translation
git-svn-id: trunk@33454 -
2016-04-08 20:19:59 +00:00
nickysn
87baa8c43f * in the internal assembler writer, when starting a new object file, set the
cputype to current_settings.cputype, instead of cpu_none (which indicates no
  restrictions)

git-svn-id: trunk@33142 -
2016-03-02 01:12:56 +00:00
nickysn
5576caada6 * handle the asd_cpu asd_cpu directive and keep track of the currently selected
CPU in the internal assembler

git-svn-id: trunk@33123 -
2016-02-27 00:50:01 +00:00
nickysn
db5e67c3fe + introduced a new type TRelocDataInt for use as the 'data' parameter for
TObjData.writeReloc; on i8086 it was changed to longint to allow using 32-bit
  relocations
+ added support for writing 32-bit OMF relocations

git-svn-id: trunk@32936 -
2016-01-13 17:57:36 +00:00
nickysn
e628729e1d + support 48-bit (16:32) far pointer relocations in the OMF internal linker
git-svn-id: trunk@32928 -
2016-01-11 17:50:27 +00:00
nickysn
c8e20dfe74 + added i8086-specific consts RELOC_ABSOLUTE16 and RELOC_RELATIVE16, which are
aliases for RELOC_ABSOLUTE and RELOC_RELATIVE
* use RELOC_ABSOLUTE16 and RELOC_RELATIVE16, instead of RELOC_ABSOLUTE and
  RELOC_RELATIVE in the linker-related parts of the OMF support (OMF object
  reader and MZ exe output). This will make the code more readable, when 32-bit
  relocation support is added to the linker. It will also make easier to reuse
  this code for i386, in case we add an i386 target, that uses the OMF object
  format.

git-svn-id: trunk@32923 -
2016-01-11 15:24:34 +00:00
Jeppe Johansen
1b02dd27dc Make relocation type more precise compared to output of gas.
Change and to or in case symbol in other section is not exported.

git-svn-id: trunk@32852 -
2016-01-05 07:23:20 +00:00
nickysn
0d48e5f6c7 + added support to the omf/i8086-msdos internal linker for omf relocation with
location type 3 (fltFarPointer). This isn't generated by nasm, nor by the
  internal object writer (yet), but may be generated by other
  assemblers/compilers - TASM generates it (tested with it), MASM probably also
  does.

git-svn-id: trunk@32346 -
2015-11-16 14:51:05 +00:00
nickysn
78362ed6ae * RELOC_ABSOLUTE32 made different than RELOC_ABSOLUTE on i8086 (and fixed all
the i8086 bugs, related to code that assumes that they are the same)
+ also added RELOC_RELATIVE32 on i8086
* RELOC_ABSOLUTE32 and RELOC_RELATIVE32 are not yet implemented in the OMF
  object writer and linker (and currently produce an internal error), but will
  be implemented in the future, as the OMF format supports both 16-bit and
  32-bit relocations

git-svn-id: trunk@32311 -
2015-11-13 15:56:26 +00:00
nickysn
b744c83581 + implemented support for omf fixup records with target group other than 'DGROUP' in the i8086-msdos internal linker
git-svn-id: trunk@32294 -
2015-11-12 16:40:17 +00:00
nickysn
1487236f29 + support addr_fardataseg references in the internal asm writer
git-svn-id: trunk@31511 -
2015-09-04 14:33:48 +00:00
nickysn
cbaa02e7b5 + support writing more than 1024 zeros in TObjSection.WriteZeros
git-svn-id: trunk@31505 -
2015-09-04 13:26:37 +00:00
nickysn
4a855b140a + support mixing initialized and bss data in the same object section (only in
case the section options contain the new option 'oso_sparse_data') in the
  internal object writer (needed for the huge memory model)

git-svn-id: trunk@31503 -
2015-09-04 13:16:45 +00:00
nickysn
2e6d462ff6 * omf segment class names moved to a const array in omfbase, so they can be used
(in the future) in the nasm asm writer as well

git-svn-id: trunk@31483 -
2015-09-02 14:37:20 +00:00
nickysn
919cc8377a + added class type property CObjSymbol to TExeOutput as well
git-svn-id: trunk@31426 -
2015-08-25 16:07:59 +00:00
nickysn
19aab3fd31 + i8086-msdos internal linker: write symbol addresses in segment:offset format in the linker map file
git-svn-id: trunk@31425 -
2015-08-25 14:48:08 +00:00
nickysn
046a4e4114 * allow using a TObjSymbol subclass via using a "class of" type
git-svn-id: trunk@31424 -
2015-08-25 14:32:08 +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
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
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
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
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
515d702408 - removed semicolon after 'begin'
git-svn-id: trunk@31314 -
2015-08-11 14:30:32 +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
0da38dbc79 + implemented support for the 'dgroup' (addr_dgroup) relocation type in the omf
internal object writer

git-svn-id: trunk@30800 -
2015-05-04 17:07:19 +00:00
nickysn
bde7d0aacb + added "code segment too large" and "data segment too large" error messages
git-svn-id: trunk@30687 -
2015-04-20 23:47:22 +00:00
nickysn
a7e059c875 + support segment relocations in the omf writer
git-svn-id: trunk@30600 -
2015-04-14 22:46:01 +00:00
nickysn
393b9b54a8 + handle aitconst_farptr in the internal asm writer as a new relocation type (RELOC_FARPTR)
git-svn-id: trunk@30456 -
2015-04-05 23:43:37 +00:00
Jeppe Johansen
52e505bff7 Fixed internal error in GOT related code for ARM internal assembler.
git-svn-id: trunk@30188 -
2015-03-14 16:03:16 +00:00
Jeppe Johansen
71cdedea82 Add missing NOP, and B instruction forms.
Move ThumbFunc flag from section to symbol.
Make .w forms optional the other way around. If .w is explicitly put on an instruction the assembler should always chose a wide form.

git-svn-id: branches/laksen/armiw@29341 -
2014-12-27 13:23:02 +00:00
Jeppe Johansen
de00a1d76d Implement simple support for .thumb_func in the ELF output.
git-svn-id: branches/laksen/armiw@29340 -
2014-12-27 11:02:38 +00:00
Jeppe Johansen
5c3093a937 Add most non-VFP Thumb-2 instruction entries for the ARM internal writer.
git-svn-id: branches/laksen/armiw@29329 -
2014-12-26 18:35:15 +00:00
Jeppe Johansen
9e5979e8be Implemented UAL syntax support in the ARM assembler reader. Can be toggled with a field for now, but not implemented yet. Still using pre-UAL syntax for now.
Switched codegeneration of VFPv2 and VFPv3 to use UAL mnemonics and syntax.
Updated VFP code in RTL to use UAL syntax too.
Added preliminary ELF support for ARM.
Added support for linking of WinCE COFF files. Should work for with a standard ARMv4-I target.

git-svn-id: branches/laksen/armiw@29247 -
2014-12-10 20:44:34 +00:00
sergei
a4053370fc * ELF linker: track relocation style (REL or RELA) of each input section and use it instead of global default on MIPS targets. This fixes internal linking of tests/test/units/system/tres*.pp.
git-svn-id: trunk@29070 -
2014-11-13 22:10:53 +00:00
nickysn
7cfd7a66cd + create a special 'heap' segment with reserved space equal to heapsize (i.e.
the value set by -Ch or the second parameter to the $M directive). This is
  equivalent to the heapmin value in Turbo Pascal 7 and ensures that the program
  has at least this amount of heap space available (otherwise DOS will show a
  'not enough memory' error and will refuse to load the program).

git-svn-id: trunk@28002 -
2014-06-19 14:14:01 +00:00
nickysn
3cc8ff11e3 + generate the stack segment for i8086 far data memory models from within fpc
itself (instead of having a fixed 16k stack in the startup code). This allows
  setting the stack size in these models with the -Cs option.

git-svn-id: trunk@27820 -
2014-05-27 23:29:50 +00:00
sergei
46f8e78d1f + Support GOT/gp-relative constants in GAS and internal assemblers, MIPS and i386.
* Change MIPS jump tables in PIC mode to use gp-relative constants, making them ABI-compliant and not requiring dynamic relocations.

git-svn-id: trunk@26886 -
2014-02-26 14:54:47 +00:00
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
sergei
1f8a67f552 + Property TObjSymbol.ObjData, allows to access owning TObjData for external/common symbols, i.e. ones with ObjSection=nil.
* For common symbols, report objdata of the original ObjSymbol, not of the resolving one, so the map file shows where it comes from.
+ TElfExeOutput.OrderOrphanSections method, handles object sections not mentioned in script similar to ld.
- t_linux.pas: removed sections that are not part of ld scripts, they are now handled by OrderOrphanSections.

git-svn-id: trunk@25184 -
2013-07-30 09:23:48 +00:00
sergei
5b6e50c9da * It is incorrect to use var_align() in linker code: it depends on current_settings.alignment, which is valid only while compiling, not while linking. Replaced with size_2_align().
git-svn-id: trunk@25182 -
2013-07-29 15:51:30 +00:00
sergei
1fea5a82c1 * Replaced oso_disabled flag by TExeSection.Disabled boolean property. Makes code a bit nicer to read.
git-svn-id: trunk@24361 -
2013-04-28 20:29:49 +00:00
sergei
b86372ccec + Internal linker: process unreferenced .pdata sections on x86_64-win64, restores the possibility to use GAS on win64 (which got broken by introducing SEH).
git-svn-id: trunk@24235 -
2013-04-13 18:52:50 +00:00
sergei
c3f8086598 + Internal linker: base support for sections that aren't referenced but must be linked if section referenced by them is linked (like win64 .pdata). Actual handling is still to be implemented in descendant classes.
git-svn-id: trunk@24224 -
2013-04-11 17:42:09 +00:00
sergei
999c3a0a02 * COFF linker: postpone import section generation until unreferenced sections (and imports) are removed, and put all remaining imports into a single section. This is much more efficient than generating multiple smart-linkable import sections and immediately discarding a good half of them.
git-svn-id: trunk@24123 -
2013-04-02 05:46:32 +00:00
sergei
cded05ccef + MIPS linker: support linking PIC object files with non-PIC ones, by routing absolute calls into PIC code through stubs that load R25.
git-svn-id: trunk@24098 -
2013-03-31 19:58:52 +00:00