Commit Graph

165 Commits

Author SHA1 Message Date
sergei
53c943c5a1 + ELF linker: support writing DT_PREINIT_ARRAY/DT_INIT_ARRAY/DT_FINI_ARRAY dynamic tags. Still misses a lot of sanity checks, and does not sort entries.
git-svn-id: trunk@29561 -
2015-01-26 20:34:16 +00:00
marco
2578514853 * first dragonfly patch (existing most). Mantis #27091
git-svn-id: trunk@29213 -
2014-12-07 20:27:02 +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
e951887154 * Fixed linking of non-PIC code to indirect functions in shared objects.
git-svn-id: trunk@27496 -
2014-04-06 23:04:57 +00:00
sergei
3c5345cb4e + Write 'non-executable stack' marker to object files also on FreeBSD (verified for version 9.0 for i386).
+ Write correct ABI value into ELF header for FreeBSD.

git-svn-id: trunk@26745 -
2014-02-10 05:46:46 +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
Jonas Maebe
864a72ee69 * fixed (harmless) range errors
git-svn-id: trunk@26067 -
2013-11-12 16:11:17 +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
e7f6b06969 + MIPS internal linker: support TLS IE/LE and GPREL32 relocations, is now able to link tw14265.
git-svn-id: trunk@25181 -
2013-07-29 09:30:40 +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
e4949e3044 + ELF linker: finish support for imported symbol versions.
git-svn-id: trunk@24056 -
2013-03-29 15:17:48 +00:00
sergei
6245bfd74f + ELF linker: load e_ident and e_flags from ELF header into properties of TElfObjData, necessary for targets that must be able to link together object files of different flavors.
git-svn-id: trunk@23821 -
2013-03-14 08:34:17 +00:00
sergei
6fcd9979dd + MIPS: doing progress with linker, implemented processing of local symbols in PIC code and stuff needed to link shared libraries.
git-svn-id: trunk@23690 -
2013-03-04 20:48:33 +00:00
sergei
6484911f05 * TExeOutput.FixupRelocations method made virtual.
* TElfExeOutput.MemPos_Start split into four smaller methods.

git-svn-id: trunk@23684 -
2013-03-03 20:01:54 +00:00
yury
e88bc322bc + Merge the targetandroid branch. Support for arm and i386 android targets.
***************************************************************************

Revision: 23518
Author: yury
Date: 25 Jan 2013 0:14:31
Message:
* Build databases support for Android.
----
Modified : /branches/targetandroid/packages/dblib/fpmake.pp
Modified : /branches/targetandroid/packages/fcl-db/fpmake.pp

Revision: 23516
Author: yury
Date: 24 Jan 2013 23:08:12
Message:
* again made less complex for arm and sparc so it compiles there too without running out of registers.
----
Modified : /branches/targetandroid/tests/webtbs/tw2242.pp

Revision: 23515
Author: yury
Date: 24 Jan 2013 23:01:36
Message:
* Disabled the test for Android.
----
Modified : /branches/targetandroid/tests/webtbs/tw4038.pp

Revision: 23514
Author: yury
Date: 24 Jan 2013 22:32:39
Message:
* Disabled the test for Android.

----
Modified : /branches/targetandroid/tests/test/packages/webtbs/tw14265.pp

Revision: 23512
Author: yury
Date: 24 Jan 2013 12:30:07
Message:
* Allow passing of double quoted paths in TEST_OPT.
----
Modified : /branches/targetandroid/tests/Makefile
Modified : /branches/targetandroid/tests/Makefile.fpc

Revision: 23511
Author: yury
Date: 24 Jan 2013 12:29:01
Message:
* Fixed building of packages when cross-testing. Pass CROSSOPT to build packages in such case, otherwise options specified in TEST_OPT are used to build fpmake. The source compiler not always accepts target options. For example -Cfsoft option, often used for arm compiler, is not accepted by x86 compiler.
----
Modified : /branches/targetandroid/tests/tstunits/Makefile
Modified : /branches/targetandroid/tests/tstunits/Makefile.fpc

Revision: 23497
Author: yury
Date: 22 Jan 2013 19:10:54
Message:
* Reverted r23400 and r23401. Tomas has promised to commit more correct fix to trunk.
----
Modified : /branches/targetandroid/rtl/inc/fexpand.inc
Modified : /branches/targetandroid/tests/test/units/dos/tfexpand.pp

Revision: 23496
Author: yury
Date: 22 Jan 2013 19:05:51
Message:
* Disabled the test for Android.
----
Modified : /branches/targetandroid/tests/webtbs/tw0876.pp

Revision: 23495
Author: yury
Date: 22 Jan 2013 18:58:30
Message:
* Add %delfiles for proper clean-up.
----
Modified : /branches/targetandroid/tests/tbs/tb0582.pp
Modified : /branches/targetandroid/tests/test/tweaklib2.pp
Modified : /branches/targetandroid/tests/webtbs/tw12704b.pp
Modified : /branches/targetandroid/tests/webtbs/tw13628b.pp
Modified : /branches/targetandroid/tests/webtbs/tw14798.pp
Modified : /branches/targetandroid/tests/webtbs/tw16263b.pp
Modified : /branches/targetandroid/tests/webtbs/tw16949b.pp
Modified : /branches/targetandroid/tests/webtbs/tw2812.pp
Modified : /branches/targetandroid/tests/webtbs/tw3082.pp
Modified : /branches/targetandroid/tests/webtbs/tw3402.pp
Modified : /branches/targetandroid/tests/webtbs/tw6586b.pp
Modified : /branches/targetandroid/tests/webtbs/tw6822b.pp
Modified : /branches/targetandroid/tests/webtbs/tw7838b.pp
Modified : /branches/targetandroid/tests/webtbs/tw8730d.pp
Modified : /branches/targetandroid/tests/webtbs/tw9089c.pp

Revision: 23492
Author: yury
Date: 22 Jan 2013 16:43:42
Message:
* Turn off special handling of interrupt calling convention for i386-android.
----
Modified : /branches/targetandroid/compiler/i386/n386cal.pas
Modified : /branches/targetandroid/compiler/x86/cgx86.pas

Revision: 23491
Author: yury
Date: 22 Jan 2013 16:34:32
Message:
* Added %delfiles for proper clean-up.
----
Modified : /branches/targetandroid/tests/test/targ1b.pp
Modified : /branches/targetandroid/tests/test/tlib1b.pp
Modified : /branches/targetandroid/tests/test/tlib2b.pp
Modified : /branches/targetandroid/tests/test/tlibrary2.pp
Modified : /branches/targetandroid/tests/test/tlibrary3.pp
Modified : /branches/targetandroid/tests/test/units/sysutils/texec2.pp

Revision: 23490
Author: yury
Date: 22 Jan 2013 16:28:00
Message:
* These libs are for tests, that run only on windows. Mark libs for windows only as well.

----
Modified : /branches/targetandroid/tests/test/library/tlib3a.pp
Modified : /branches/targetandroid/tests/test/library/tlib3b.pp

Revision: 23489
Author: yury
Date: 22 Jan 2013 16:18:56
Message:
* Do not copy a library to a remote target if this library name is specified using %DELFILES directive.
----
Modified : /branches/targetandroid/tests/utils/dotest.pp

Revision: 23488
Author: yury
Date: 22 Jan 2013 15:47:52
Message:
* Implemented { %DELFILES file1 file2 ... } directive for tests. Primarily it is needed to delete shared libraries used by tests when TEST_DELTEMP=1. When testing on a real Android device, it is not good to run tests on flash memory partitions. Android devices have 1Mb RAM based tempfs partition for /tmp folder, which is ideal for running tests. Since 1Mb is very small size these days, it is needed to clean all test leftovers. Test shared libraries are the biggest leftovers and this new DELFILES directive will help to delete them.
* During remote execution, use && as a command separator after important commands such as CD to ensure that the command succeeded before running other commands. Group other commands using curly braces { }.
----
Modified : /branches/targetandroid/tests/readme.txt
Modified : /branches/targetandroid/tests/utils/dotest.pp
Modified : /branches/targetandroid/tests/utils/testu.pp

Revision: 23487
Author: yury
Date: 22 Jan 2013 13:16:22
Message:
* Define CExtended and clongdouble as double for Android.
----
Modified : /branches/targetandroid/compiler/psystem.pas
Modified : /branches/targetandroid/rtl/inc/ctypes.pp

Revision: 23486
Author: yury
Date: 22 Jan 2013 13:14:36
Message:
* Fixed compilation for case when extended <> cextended.
----
Modified : /branches/targetandroid/tests/test/cg/tcalext6.pp

Revision: 23485
Author: yury
Date: 22 Jan 2013 12:41:43
Message:
* More correct comparison of long double values for case when long double=double in C.
----
Modified : /branches/targetandroid/tests/test/cg/tcalext.pp

Revision: 23484
Author: yury
Date: 22 Jan 2013 11:53:41
Message:
* Do not pass -f switch for rm when testing via adb, since default android shell do not support -f switch.
----
Modified : /branches/targetandroid/tests/utils/dotest.pp

Revision: 23483
Author: yury
Date: 22 Jan 2013 11:47:31
Message:
* Added ICU version of Android 4.1.
* Increment by 2 when finding an unknown ICU version.
----
Modified : /branches/targetandroid/rtl/android/cwstring.pp

Revision: 23479
Author: yury
Date: 21 Jan 2013 14:29:40
Message:
* Add define for android.
----
Modified : /branches/targetandroid/tests/test/cg/tcalcst6.pp
Modified : /branches/targetandroid/tests/test/cg/tcalvar6.pp

Revision: 23478
Author: yury
Date: 21 Jan 2013 14:22:06
Message:
+ Added C object files for android-i386.
----
Added : /branches/targetandroid/tests/test/cg/obj/android/i386
Modified : /branches/targetandroid/tests/test/cg/obj/readme.txt

Revision: 23477
Author: yury
Date: 21 Jan 2013 14:08:25
Message:
* Add missing checks for android target.
----
Modified : /branches/targetandroid/compiler/aasmdata.pas
Modified : /branches/targetandroid/compiler/aggas.pas
Modified : /branches/targetandroid/compiler/expunix.pas
Modified : /branches/targetandroid/compiler/ncgld.pas
Modified : /branches/targetandroid/compiler/ogelf.pas
Modified : /branches/targetandroid/compiler/systems.pas
Modified : /branches/targetandroid/compiler/x86/agx86att.pas
Modified : /branches/targetandroid/compiler/x86/cgx86.pas
Modified : /branches/targetandroid/compiler/x86/rax86.pas

Revision: 23475
Author: yury
Date: 21 Jan 2013 13:51:09
Message:
* Set android-i368 stack alignment to 16.
----
Modified : /branches/targetandroid/compiler/systems/i_android.pas

Revision: 23474
Author: yury
Date: 21 Jan 2013 13:45:29
Message:
* Removed -z relro linker option, since it causes problems.
----
Modified : /branches/targetandroid/compiler/systems/t_android.pas

Revision: 23451
Author: yury
Date: 19 Jan 2013 1:32:26
Message:
* Pass some security switches to LD. They are passed by GCC.
* Removed unused function.
----
Modified : /branches/targetandroid/compiler/systems/t_android.pas

Revision: 23450
Author: yury
Date: 19 Jan 2013 1:27:45
Message:
* Fixed file description.
----
Modified : /branches/targetandroid/rtl/android/arm/dllprt0.as

Revision: 23449
Author: yury
Date: 19 Jan 2013 1:27:02
Message:
* Simplify arm startup code.
----
Modified : /branches/targetandroid/rtl/android/arm/prt0.as

Revision: 23448
Author: yury
Date: 19 Jan 2013 1:25:58
Message:
* Fixed file description.
----
Modified : /branches/targetandroid/rtl/android/i386/dllprt0.as
Modified : /branches/targetandroid/rtl/android/i386/prt0.as

Revision: 23447
Author: yury
Date: 19 Jan 2013 1:19:29
Message:
* Rewrite initialization code for i386-android. i386-android works.
----
Modified : /branches/targetandroid/rtl/android/i386/dllprt0.as
Modified : /branches/targetandroid/rtl/android/i386/prt0.as

Revision: 23441
Author: yury
Date: 18 Jan 2013 16:51:09
Message:
* Add android to supported targets for assemblers. It fixes assembling for i386-android.
----
Modified : /branches/targetandroid/compiler/arm/agarmgas.pas
Modified : /branches/targetandroid/compiler/i386/cpuelf.pas
Modified : /branches/targetandroid/compiler/x86/agx86att.pas

Revision: 23435
Author: yury
Date: 18 Jan 2013 0:46:23
Message:
* Enable safecall exception handling for arm-android.
----
Modified : /branches/targetandroid/compiler/systems/i_android.pas

Revision: 23434
Author: yury
Date: 18 Jan 2013 0:28:59
Message:
* Removed leftover from my experiments (calling directly pascal main).
----
Modified : /branches/targetandroid/rtl/android/arm/prt0.as

Revision: 23433
Author: yury
Date: 17 Jan 2013 23:43:09
Message:
* Uses SysUtils to make executable bigger. Otherwise string pointers for FindResource can be less than $10000. They are treated as IDs in such case and the test will fail.
----
Modified : /branches/targetandroid/tests/test/units/system/tres.pp

Revision: 23429
Author: yury
Date: 17 Jan 2013 18:49:23
Message:
* Thread safety.
----
Modified : /branches/targetandroid/rtl/android/cwstring.pp

Revision: 23427
Author: yury
Date: 17 Jan 2013 14:48:03
Message:
* Skip this test for android.
----
Modified : /branches/targetandroid/tests/test/textthr.pp

Revision: 23426
Author: yury
Date: 17 Jan 2013 14:21:51
Message:
* Fixed ifdefs linux to unix.
----
Modified : /branches/targetandroid/tests/test/tstring10.pp
Modified : /branches/targetandroid/tests/test/units/classes/tsetstream.pp
Modified : /branches/targetandroid/tests/test/units/dos/tdos.pp
Modified : /branches/targetandroid/tests/test/units/dos/tidos.pp

Revision: 23425
Author: yury
Date: 17 Jan 2013 14:20:56
Message:
* Enable more tests for android.
----
Modified : /branches/targetandroid/tests/test/packages/webtbs/tw14265.pp
Modified : /branches/targetandroid/tests/test/testfpuc.pp
Modified : /branches/targetandroid/tests/test/textthr.pp
Modified : /branches/targetandroid/tests/test/tlib2a.pp
Modified : /branches/targetandroid/tests/test/tlib2b.pp
Modified : /branches/targetandroid/tests/test/tpoll.pp
Modified : /branches/targetandroid/tests/test/tsafecall1.pp
Modified : /branches/targetandroid/tests/test/tsafecall2.pp
Modified : /branches/targetandroid/tests/test/tsafecall3.pp
Modified : /branches/targetandroid/tests/test/tsafecall4.pp
Modified : /branches/targetandroid/tests/test/units/system/tres.pp
Modified : /branches/targetandroid/tests/test/units/system/tres2.pp
Modified : /branches/targetandroid/tests/test/units/system/tres3.pp

Revision: 23424
Author: yury
Date: 17 Jan 2013 14:02:35
Message:
* Fixed AnsiStrLComp() and AnsiStrLIComp().
----
Modified : /branches/targetandroid/rtl/android/cwstring.pp

Revision: 23423
Author: yury
Date: 17 Jan 2013 13:49:55
Message:
* Fixed stupid copy-paste error.
----
Modified : /branches/targetandroid/rtl/android/cwstring.pp

Revision: 23409
Author: yury
Date: 16 Jan 2013 16:46:02
Message:
* Fixed conflict of native android and java android targets.
----
Modified : /branches/targetandroid/utils/fpcm/fpcmake.inc
Modified : /branches/targetandroid/utils/fpcm/fpcmake.ini

Revision: 23406
Author: yury
Date: 16 Jan 2013 15:33:50
Message:
* Set stackalign field.
----
Modified : /branches/targetandroid/compiler/systems/i_android.pas

Revision: 23404
Author: yury
Date: 16 Jan 2013 12:57:51
Message:
* Enable more tests for android.
----
Modified : /branches/targetandroid/tests/webtbs/tw0876.pp
Modified : /branches/targetandroid/tests/webtbs/tw12704a.pp
Modified : /branches/targetandroid/tests/webtbs/tw12704b.pp
Modified : /branches/targetandroid/tests/webtbs/tw16263a.pp
Modified : /branches/targetandroid/tests/webtbs/tw16263b.pp
Modified : /branches/targetandroid/tests/webtbs/tw16949a.pp
Modified : /branches/targetandroid/tests/webtbs/tw16949b.pp
Modified : /branches/targetandroid/tests/webtbs/tw6586a.pp
Modified : /branches/targetandroid/tests/webtbs/tw6586b.pp
Modified : /branches/targetandroid/tests/webtbs/tw6822c.pp
Modified : /branches/targetandroid/tests/webtbs/tw7838a.pp
Modified : /branches/targetandroid/tests/webtbs/tw7838b.pp
Modified : /branches/targetandroid/tests/webtbs/tw8730a.pp
Modified : /branches/targetandroid/tests/webtbs/tw8730b.pp
Modified : /branches/targetandroid/tests/webtbs/tw8730c.pp
Modified : /branches/targetandroid/tests/webtbs/tw8730d.pp
Modified : /branches/targetandroid/tests/webtbs/tw9089a.pp
Modified : /branches/targetandroid/tests/webtbs/tw9089b.pp
Modified : /branches/targetandroid/tests/webtbs/tw9089c.pp
Modified : /branches/targetandroid/tests/webtbs/tw9089d.pp
Modified : /branches/targetandroid/tests/webtbs/uw2364.pp

Revision: 23402
Author: yury
Date: 16 Jan 2013 12:50:52
Message:
* Use collation when comparing strings.
----
Modified : /branches/targetandroid/rtl/android/cwstring.pp

Revision: 23401
Author: yury
Date: 16 Jan 2013 12:41:32
Message:
* If there is no HOME directory, the current dir must be used.
----
Modified : /branches/targetandroid/tests/test/units/dos/tfexpand.pp

Revision: 23400
Author: yury
Date: 16 Jan 2013 12:40:25
Message:
* Fixed expanding ~ if there is no HOME env var set.
----
Modified : /branches/targetandroid/rtl/inc/fexpand.inc

Revision: 23391
Author: yury
Date: 15 Jan 2013 14:12:56
Message:
* Make sure that the thread has been started, before destroying the event.
----
Modified : /branches/targetandroid/tests/test/tbrtlevt.pp

Revision: 23390
Author: yury
Date: 15 Jan 2013 13:55:24
Message:
* Do not use DOS code pages for Android. Now all CP string tests pass on Android.
----
Modified : /branches/targetandroid/tests/test/tcpstr17.pp
Modified : /branches/targetandroid/tests/test/tcpstrconcat3.pp
Modified : /branches/targetandroid/tests/test/tcpstrconcatmulti.pp
Modified : /branches/targetandroid/tests/test/tcpstrconcatmulti2.pp

Revision: 23389
Author: yury
Date: 15 Jan 2013 13:53:50
Message:
* Use more common code pages 1251 and 1252 instead of old DOS code pages (not available on Android). There is Euro symbol character that has different code in 1251 and 1252 code pages. Use it for tests.
----
Modified : /branches/targetandroid/tests/test/tcpstr1.pp
Modified : /branches/targetandroid/tests/test/tcpstransistrcompare.pp
Modified : /branches/targetandroid/tests/test/tcpstransistrcompareequal.pp

Revision: 23386
Author: yury
Date: 15 Jan 2013 10:22:30
Message:
* Skip 2 tests for android, since they require local execution.
----
Modified : /branches/targetandroid/tests/test/tcpstr19.pp
Modified : /branches/targetandroid/tests/test/tcpstr9.pp

Revision: 23385
Author: yury
Date: 15 Jan 2013 10:20:43
Message:
* Fixed running library tests on android.
----
Modified : /branches/targetandroid/tests/utils/dotest.pp

Revision: 23382
Author: yury
Date: 14 Jan 2013 16:20:44
Message:
* Implemented Unicode string manager for Android. It uses ICU library libicuuc.so. Note: ICU on Android has limited number of code pages. So don't expect support for DOS code pages or other exotic code pages.
----
Modified : /branches/targetandroid/rtl/android/cwstring.pp

Revision: 23301
Author: yury
Date: 2 Jan 2013 20:47:09
Message:
* I've found that libc on Android does not implement widechar case functions such as towupper(). Such functions are just wrappers over regular char functions. Therefore the whole cwstring unit is useless for Android. For now I've added stub cwstring unit for Android and reverted all Android specific changes in unix/cwstring.pp. Later, Unicode manager for Androud should be implemented using libicuuc, which is default Android lib.
----
Added : /branches/targetandroid/rtl/android/cwstring.pp
Modified : /branches/targetandroid/rtl/unix/cwstring.pp

Revision: 23299
Author: yury
Date: 2 Jan 2013 19:38:08
Message:
* Android does not have libiconv, so don't use it in cwstring unit. For now support only UTF-8 code page in ansistrings. Later it is possible to use libicuuc for code page conversions on Android.
----
Modified : /branches/targetandroid/rtl/unix/cwstring.pp

Revision: 23298
Author: yury
Date: 2 Jan 2013 17:41:36
Message:
* Added uuchar unit to build for android.
----
Modified : /branches/targetandroid/rtl/android/Makefile
Modified : /branches/targetandroid/rtl/android/Makefile.fpc

Revision: 23289
Author: yury
Date: 2 Jan 2013 2:53:36
Message:
* Always specify dynamic linker name for executables.
----
Modified : /branches/targetandroid/compiler/systems/t_android.pas

Revision: 23288
Author: yury
Date: 2 Jan 2013 2:04:41
Message:
* Updated Makefile
----
Modified : /branches/targetandroid/rtl/android/Makefile

Revision: 23287
Author: yury
Date: 2 Jan 2013 2:03:42
Message:
* cprt0.as is not needed, since we link to libc always.
----
Modified : /branches/targetandroid/rtl/android/Makefile.fpc

Revision: 23286
Author: yury
Date: 2 Jan 2013 2:01:43
Message:
* cprt0.as is not needed, since we link to libc always.
----
Modified : /branches/targetandroid/rtl/android/Makefile.fpc
Deleted : /branches/targetandroid/rtl/android/arm/cprt0.as
Deleted : /branches/targetandroid/rtl/android/i386/cprt0.as

Revision: 23285
Author: yury
Date: 2 Jan 2013 1:59:48
Message:
* libctype is not needed, since only bionic is supported anyway.
----
Modified : /branches/targetandroid/compiler/systems/t_android.pas

Revision: 23284
Author: yury
Date: 2 Jan 2013 1:49:12
Message:
* Rework of Android startup code. It is needed to always link to libc on android to implement finalization and environment variables in shared libraries.
* Cleanup of Android linker.
* Use only INSERT command in the linker script to inject custom .fpc sections. Whole linker script duplication is nor needed anymore.
* Use BFD linker, since GOLD linker does not support INSERT command. Other incompatibilities may also exist.
* Enable tf_smartlink_sections for i386-android.
* i386-android is broken after this commit. Will be fixed later.
----
Modified : /branches/targetandroid/compiler/systems/i_android.pas
Modified : /branches/targetandroid/compiler/systems/t_android.pas
Modified : /branches/targetandroid/rtl/android/arm/dllprt0.as
Modified : /branches/targetandroid/rtl/android/arm/prt0.as

Revision: 23283
Author: yury
Date: 2 Jan 2013 1:48:07
Message:
* Enable weak externals for android.
----
Modified : /branches/targetandroid/compiler/systems.pas

Revision: 23236
Author: yury
Date: 28 Dec 2012 12:42:27
Message:
* Oops, wrong commit r23235. Reverted. Now correct: Fixed lineinfo for Android.
----
Modified : /branches/targetandroid/rtl/inc/exeinfo.pp
Modified : /branches/targetandroid/tests/test/units/sysutils/texec2.pp

Revision: 23235
Author: yury
Date: 28 Dec 2012 11:38:04
Message:
* Fixed lineinfo for Android.
----
Modified : /branches/targetandroid/tests/test/units/sysutils/texec2.pp

Revision: 23232
Author: yury
Date: 27 Dec 2012 22:52:26
Message:
* Fixed the test for android.
----
Modified : /branches/targetandroid/tests/test/units/dos/tdos2.pp

Revision: 23231
Author: yury
Date: 27 Dec 2012 22:51:32
Message:
+ Added C object files for arm-android.
----
Added : /branches/targetandroid/tests/test/cg/obj/android
Added : /branches/targetandroid/tests/test/cg/obj/android/arm
Added : /branches/targetandroid/tests/test/cg/obj/android/arm/cpptcl1.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm/cpptcl2.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm/ctest.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm/tcext3.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm/tcext4.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm/tcext5.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm/tcext6.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm-eabi
Added : /branches/targetandroid/tests/test/cg/obj/android/arm-eabi/cpptcl1.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm-eabi/cpptcl2.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm-eabi/ctest.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm-eabi/tcext3.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm-eabi/tcext4.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm-eabi/tcext5.o
Added : /branches/targetandroid/tests/test/cg/obj/android/arm-eabi/tcext6.o

Revision: 23226
Author: yury
Date: 27 Dec 2012 10:17:06
Message:
* Support for running tests on a remote Android device using ADB.
----
Modified : /branches/targetandroid/tests/Makefile
Modified : /branches/targetandroid/tests/Makefile.fpc
Modified : /branches/targetandroid/tests/readme.txt
Modified : /branches/targetandroid/tests/tstunits/Makefile
Modified : /branches/targetandroid/tests/utils/dotest.pp

Revision: 22048
Author: tom_at_work
Date: 9 Aug 2012 17:13:51
Message:
re-apply the changes of r22045 to correct files after recent revert
----
Modified : /branches/targetandroid/rtl/android/arm/cprt0.as
Added : /branches/targetandroid/rtl/android/i386
Added : /branches/targetandroid/rtl/android/i386/cprt0.as
Added : /branches/targetandroid/rtl/android/i386/dllprt0.as
Added : /branches/targetandroid/rtl/android/i386/prt0.as

Revision: 22047
Author: tom_at_work
Date: 9 Aug 2012 16:57:34
Message:
- revert r22045: applied changes to wrong files, i.e. linux system files, instead of android ones
----
Modified : /branches/targetandroid/rtl/android/arm/cprt0.as
Modified : /branches/targetandroid/rtl/linux/i386/cprt0.as
Added : /branches/targetandroid/rtl/linux/i386/cprt21.as
Added : /branches/targetandroid/rtl/linux/i386/gprt21.as

Revision: 22045
Author: tom_at_work
Date: 9 Aug 2012 11:05:38
Message:
Made cprt0 startup files to compile. Static executables using them likely do not work though.
Removed obsolete startup files (?prt21*).

----
Modified : /branches/targetandroid/rtl/android/arm/cprt0.as
Modified : /branches/targetandroid/rtl/linux/i386/cprt0.as
Deleted : /branches/targetandroid/rtl/linux/i386/cprt21.as
Deleted : /branches/targetandroid/rtl/linux/i386/gprt21.as

Revision: 22044
Author: tom_at_work
Date: 9 Aug 2012 11:00:16
Message:
Updated systems/t_android to only recognize the "bionic" libc as valid libc.
Fix uninitialized defdynlinker variable when compiling i386-android causing garbage in the linker script.

----
Modified : /branches/targetandroid/compiler/systems/t_android.pas

Revision: 21296
Author: tom_at_work
Date: 15 May 2012 0:14:12
Message:
* basic android/x86 support
----
Modified : /branches/targetandroid/Makefile
Modified : /branches/targetandroid/compiler/Makefile
Modified : /branches/targetandroid/compiler/i386/cputarg.pas
Modified : /branches/targetandroid/compiler/systems/i_android.pas
Modified : /branches/targetandroid/compiler/systems/t_android.pas
Modified : /branches/targetandroid/compiler/systems.inc
Modified : /branches/targetandroid/compiler/systems.pas
Modified : /branches/targetandroid/compiler/utils/Makefile
Modified : /branches/targetandroid/compiler/utils/ppudump.pp
Modified : /branches/targetandroid/ide/Makefile
Modified : /branches/targetandroid/ide/compiler/Makefile
Modified : /branches/targetandroid/installer/Makefile
Modified : /branches/targetandroid/packages/Makefile
Modified : /branches/targetandroid/packages/fpmkunit/Makefile
Modified : /branches/targetandroid/rtl/Makefile
Modified : /branches/targetandroid/rtl/aix/Makefile
Modified : /branches/targetandroid/rtl/amiga/Makefile
Modified : /branches/targetandroid/rtl/android/Makefile
Modified : /branches/targetandroid/rtl/android/Makefile.fpc
Modified : /branches/targetandroid/rtl/beos/Makefile
Modified : /branches/targetandroid/rtl/darwin/Makefile
Modified : /branches/targetandroid/rtl/embedded/Makefile
Modified : /branches/targetandroid/rtl/emx/Makefile
Modified : /branches/targetandroid/rtl/freebsd/Makefile
Modified : /branches/targetandroid/rtl/gba/Makefile
Modified : /branches/targetandroid/rtl/go32v2/Makefile
Modified : /branches/targetandroid/rtl/haiku/Makefile
Modified : /branches/targetandroid/rtl/linux/Makefile
Modified : /branches/targetandroid/rtl/macos/Makefile
Modified : /branches/targetandroid/rtl/morphos/Makefile
Modified : /branches/targetandroid/rtl/nativent/Makefile
Modified : /branches/targetandroid/rtl/nds/Makefile
Modified : /branches/targetandroid/rtl/netbsd/Makefile
Modified : /branches/targetandroid/rtl/netware/Makefile
Modified : /branches/targetandroid/rtl/netwlibc/Makefile
Modified : /branches/targetandroid/rtl/openbsd/Makefile
Modified : /branches/targetandroid/rtl/os2/Makefile
Modified : /branches/targetandroid/rtl/palmos/Makefile
Modified : /branches/targetandroid/rtl/solaris/Makefile
Modified : /branches/targetandroid/rtl/symbian/Makefile
Modified : /branches/targetandroid/rtl/unix/x86.pp
Modified : /branches/targetandroid/rtl/wii/Makefile
Modified : /branches/targetandroid/rtl/win32/Makefile
Modified : /branches/targetandroid/rtl/win64/Makefile
Modified : /branches/targetandroid/rtl/wince/Makefile
Modified : /branches/targetandroid/utils/Makefile
Modified : /branches/targetandroid/utils/dxegen/Makefile
Modified : /branches/targetandroid/utils/fpcm/Makefile
Modified : /branches/targetandroid/utils/fpcm/fpcmmain.pp
Modified : /branches/targetandroid/utils/fpcmkcfg/Makefile
Modified : /branches/targetandroid/utils/fpcres/Makefile
Modified : /branches/targetandroid/utils/fpcreslipo/Makefile
Modified : /branches/targetandroid/utils/fpdoc/Makefile
Modified : /branches/targetandroid/utils/fpmc/Makefile
Modified : /branches/targetandroid/utils/fppkg/Makefile
Modified : /branches/targetandroid/utils/fprcp/Makefile
Modified : /branches/targetandroid/utils/h2pas/Makefile
Modified : /branches/targetandroid/utils/importtl/Makefile
Modified : /branches/targetandroid/utils/instantfpc/Makefile
Modified : /branches/targetandroid/utils/rmwait/Makefile
Modified : /branches/targetandroid/utils/tply/Makefile

Revision: 21066
Author: tom_at_work
Date: 26 Apr 2012 22:05:06
Message:
fix pthreads use with Android: it does not provide some functions. This patch is partially based on the bug report 0021525. Further, fix use of sem_timedwait in cthreads.pp since Android supports it.
----
Modified : /branches/targetandroid/rtl/linux/pthread.inc
Modified : /branches/targetandroid/rtl/unix/cthreads.pp

Revision: 21065
Author: tom_at_work
Date: 26 Apr 2012 16:15:52
Message:
bugfixes:
- do not compile ipc unit for android, not supported
- fix geterrnolocation external name
- implement dummy getdomainname; does not exist in android
- remove wrong 'if defined(android)' clauses
----
Modified : /branches/targetandroid/rtl/android/Makefile
Modified : /branches/targetandroid/rtl/android/Makefile.fpc
Modified : /branches/targetandroid/rtl/fpmake.pp
Modified : /branches/targetandroid/rtl/unix/cwstring.pp
Modified : /branches/targetandroid/rtl/unix/initc.pp
Modified : /branches/targetandroid/rtl/unix/ipc.pp
Modified : /branches/targetandroid/rtl/unix/unix.pp

Revision: 21063
Author: tom_at_work
Date: 26 Apr 2012 12:53:37
Message:
- missing makefile
----
Added : /branches/targetandroid/rtl/android/Makefile

Revision: 21062
Author: tom_at_work
Date: 26 Apr 2012 12:41:13
Message:
- commit missing new files
----
Added : /branches/targetandroid/compiler/systems/i_android.pas
Added : /branches/targetandroid/compiler/systems/t_android.pas
Added : /branches/targetandroid/rtl/android
Added : /branches/targetandroid/rtl/android/Makefile.fpc
Added : /branches/targetandroid/rtl/android/arm
Added : /branches/targetandroid/rtl/android/arm/cprt0.as
Added : /branches/targetandroid/rtl/android/arm/dllprt0.as
Added : /branches/targetandroid/rtl/android/arm/prt0.as

Revision: 21061
Author: tom_at_work
Date: 26 Apr 2012 12:36:42
Message:
- initial support for the android/arm target in the compiler; resulting .so's can be used for Android/ARM app development.
- basic rtl support using system calls
- fp(c)make/fppkg/makefile support

todo:
- revisit systems/t_android.pas: mostly duplicate with t_linux.pas, containing
lots of unnecessary code
- revisit rtl changes
- android ndk header translation import
- better app build/packaging support
- android/x86 support

----
Modified : /branches/targetandroid/Makefile
Modified : /branches/targetandroid/compiler/Makefile
Modified : /branches/targetandroid/compiler/aggas.pas
Modified : /branches/targetandroid/compiler/arm/cputarg.pas
Modified : /branches/targetandroid/compiler/compiler.pas
Modified : /branches/targetandroid/compiler/systems.inc
Modified : /branches/targetandroid/compiler/systems.pas
Modified : /branches/targetandroid/compiler/utils/Makefile
Modified : /branches/targetandroid/compiler/utils/ppudump.pp
Modified : /branches/targetandroid/ide/Makefile
Modified : /branches/targetandroid/ide/compiler/Makefile
Modified : /branches/targetandroid/installer/Makefile
Modified : /branches/targetandroid/packages/Makefile
Modified : /branches/targetandroid/packages/fpmkunit/Makefile
Modified : /branches/targetandroid/packages/fpmkunit/Makefile.fpc
Modified : /branches/targetandroid/packages/fpmkunit/src/fpmkunit.pp
Modified : /branches/targetandroid/packages/fppkg/src/fpmkunitsrc.inc
Modified : /branches/targetandroid/packages/gnome1/fpmake.pp
Modified : /branches/targetandroid/packages/gtk1/fpmake.pp
Modified : /branches/targetandroid/packages/gtk2/fpmake.pp
Modified : /branches/targetandroid/packages/imlib/fpmake.pp
Modified : /branches/targetandroid/packages/opengl/fpmake.pp
Modified : /branches/targetandroid/packages/sdl/fpmake.pp
Modified : /branches/targetandroid/rtl/Makefile
Modified : /branches/targetandroid/rtl/Makefile.fpc
Modified : /branches/targetandroid/rtl/aix/Makefile
Modified : /branches/targetandroid/rtl/amiga/Makefile
Modified : /branches/targetandroid/rtl/beos/Makefile
Modified : /branches/targetandroid/rtl/darwin/Makefile
Modified : /branches/targetandroid/rtl/embedded/Makefile
Modified : /branches/targetandroid/rtl/emx/Makefile
Modified : /branches/targetandroid/rtl/freebsd/Makefile
Modified : /branches/targetandroid/rtl/gba/Makefile
Modified : /branches/targetandroid/rtl/go32v2/Makefile
Modified : /branches/targetandroid/rtl/haiku/Makefile
Modified : /branches/targetandroid/rtl/linux/Makefile
Modified : /branches/targetandroid/rtl/macos/Makefile
Modified : /branches/targetandroid/rtl/morphos/Makefile
Modified : /branches/targetandroid/rtl/nativent/Makefile
Modified : /branches/targetandroid/rtl/nds/Makefile
Modified : /branches/targetandroid/rtl/netbsd/Makefile
Modified : /branches/targetandroid/rtl/netware/Makefile
Modified : /branches/targetandroid/rtl/netwlibc/Makefile
Modified : /branches/targetandroid/rtl/openbsd/Makefile
Modified : /branches/targetandroid/rtl/os2/Makefile
Modified : /branches/targetandroid/rtl/palmos/Makefile
Modified : /branches/targetandroid/rtl/solaris/Makefile
Modified : /branches/targetandroid/rtl/symbian/Makefile
Modified : /branches/targetandroid/rtl/unix/cwstring.pp
Modified : /branches/targetandroid/rtl/unix/initc.pp
Modified : /branches/targetandroid/rtl/unix/ipc.pp
Modified : /branches/targetandroid/rtl/unix/unix.pp
Modified : /branches/targetandroid/rtl/wii/Makefile
Modified : /branches/targetandroid/rtl/win32/Makefile
Modified : /branches/targetandroid/rtl/win64/Makefile
Modified : /branches/targetandroid/rtl/wince/Makefile
Modified : /branches/targetandroid/utils/Makefile
Modified : /branches/targetandroid/utils/dxegen/Makefile
Modified : /branches/targetandroid/utils/fpcm/Makefile
Modified : /branches/targetandroid/utils/fpcm/fpcmake.inc
Modified : /branches/targetandroid/utils/fpcm/fpcmake.ini
Modified : /branches/targetandroid/utils/fpcm/fpcmmain.pp
Modified : /branches/targetandroid/utils/fpcmkcfg/Makefile
Modified : /branches/targetandroid/utils/fpcmkcfg/fppkg.inc
Modified : /branches/targetandroid/utils/fpcres/Makefile
Modified : /branches/targetandroid/utils/fpcreslipo/Makefile
Modified : /branches/targetandroid/utils/fpdoc/Makefile
Modified : /branches/targetandroid/utils/fpmc/Makefile
Modified : /branches/targetandroid/utils/fppkg/Makefile
Modified : /branches/targetandroid/utils/fppkg/fppkg.pp
Modified : /branches/targetandroid/utils/fprcp/Makefile
Modified : /branches/targetandroid/utils/h2pas/Makefile
Modified : /branches/targetandroid/utils/importtl/Makefile
Modified : /branches/targetandroid/utils/instantfpc/Makefile
Modified : /branches/targetandroid/utils/rmwait/Makefile
Modified : /branches/targetandroid/utils/tply/Makefile

git-svn-id: trunk@23604 -
2013-02-13 12:00:15 +00:00
sergei
cb51c39dd7 * Forgot to assign result of SwapEndian() into place.
git-svn-id: trunk@23534 -
2013-01-29 16:42:47 +00:00
yury
0960ee2034 * Add missing checks for android target.
git-svn-id: branches/targetandroid@23477 -
2013-01-21 12:08:25 +00:00
sergei
af4935e346 + Support dynamic copy relocations.
* For unresolved weak symbols, provide dynamic binding only if they are referenced via GOT or PLT (ld-compatible behavior).
* Made more TElfExeOutput properties/methods usable by descendant classes.
* x86_64/cpuelf.pas: some refactoring, handle DTPOFF relocations, prohibit TPOFF relocations in shared objects.
* i386/cpuelf.pas: set symref_from_text flags for copy relocations to work correctly.

git-svn-id: trunk@23375 -
2013-01-13 17:44:14 +00:00
sergei
4b925763c3 + Enable CPU-specific descendants to write specific dynamic tags.
+ Read version definitions from shared objects.

git-svn-id: trunk@23370 -
2013-01-13 06:36:39 +00:00
sergei
49d7448f44 * Made TElfExeOutput.CreatePLT method protected virtual, so CPU-specific handling can be provided by descendants.
* Handle SHT_GNU_ATTRIBUTES sections (ignore them for now).

git-svn-id: trunk@23339 -
2013-01-07 15:22:04 +00:00
sergei
35439c0e1d * Moved creation of GOT section into separate virtual method.
* TElfSymtab.WriteSymbol: write type of external symbols as STT_NOTYPE only in object files; external symbols in exe/so files must have type of their resolving symbol.
* TElfObjData.writeReloc_internal: RELOC_RELATIVE needs adjustment by size presumably on x86 only; ARM data relocations don't need it, other CPUs aren't checked yet.
* Use VER_xx and VERSYM_xx constants instead of literal values.

git-svn-id: trunk@23290 -
2013-01-02 08:11:49 +00:00
pierre
8b4603ed51 Set OSABI in elf header for openbsd OS, contributed by Pascal Stumpf
git-svn-id: trunk@23224 -
2012-12-26 15:01:38 +00:00
sergei
0196c62ee8 + Initial work to support versions of ELF dynamic symbols.
git-svn-id: trunk@23170 -
2012-12-18 08:25:57 +00:00
sergei
c73ec250a6 + Endian-swapping procedures for version (TElfverneed, etc.) records.
git-svn-id: trunk@23155 -
2012-12-16 09:43:48 +00:00
sergei
0aa7204707 + Added codes of dynamic relocations to TElfTarget; since most targets use similar dynamic relocation model differing only in code values, this will allow to do majority of handling in the base class.
git-svn-id: trunk@23154 -
2012-12-16 09:36:34 +00:00
sergei
00ca4a74a3 * Reworked/fixed TExeSymbol.State behavior:
* Added symstate_undefweak for undefined symbols having only weak references to them, this state is removed when a normal reference to symbol is seen.
  * Use a separate boolean property to determine if ExeSymbol is referenced.
  * Use a separate property TExeOutput.AllowUndefinedSymbols to suppress error messages when linking dynamic shared objects.
  * Don't issue InternalError when an undefined symbol is encountered during unused section removal.

git-svn-id: trunk@23127 -
2012-12-09 08:02:58 +00:00
sergei
a771d68685 * Fixed a bug introduced in r23077: relative_reloc_count must be increased only once per GOT entry, not every time a relocation to that entry is seen.
git-svn-id: trunk@23126 -
2012-12-09 06:39:43 +00:00
sergei
a7eab8ff67 * TElfObjInput: Factored section creation code into separate method which can be called by CPU-specific routines.
+ Load SHT_INIT_ARRAY,SHT_FINI_ARRAY,SHT_PREINIT_ARRAY section types.

git-svn-id: trunk@23124 -
2012-12-08 11:26:38 +00:00
sergei
36859068f5 * Propagate AS_NEEDED flag further into Load_DynamicObject and handle it properly: shared objects marked with AS_NEEDED are added to dependencies only if they actually resolve some symbol.
* Dropped TObjInput.newObjData method. Instead, TObjData instances are created directly in ReadObjData, this gives possibility to create a different type of TObjData based on file header.
- Dropped TObjInput destructor, it does nothing except calling inherited.

git-svn-id: trunk@23118 -
2012-12-06 18:19:19 +00:00
sergei
67a41e1e94 * Fixed 2 bugs introduced in r22951:
* Require symbol table presence only in dynamic objects; relocatable objects may not contain one (example is crtn.o).
  * Attempt to write relocations from dynreloclist regardless of relative_reloc_count, the latter is typically 0 in executables.

git-svn-id: trunk@23115 -
2012-12-05 15:49:45 +00:00
sergei
c4d8396158 * Function RelocName made a member of TElfTarget, so it can be used outside of TElfExeOutput class.
* Methods ReportNonDSOReloc and ReportRelocOverflow moved to TElfExeOutput, they are applicable to all target-specific descendants.

git-svn-id: trunk@23094 -
2012-12-02 13:05:53 +00:00
sergei
d79761c607 * Changed TElfTarget from class to record, so it can contain data members while remaining statically allocated.
* Moved target-dependent constants into ElfTarget records, eliminates a lot of $ifdef's in ogelf.pas.
+ Added TElfTarget.loadsection hook and pass unknown sections to it.

git-svn-id: trunk@23090 -
2012-12-02 11:15:35 +00:00
sergei
006d795797 * Moved TElfsechdr into interface and cleaned up some ugliness in TElfObjInput code caused by TElfsechdr being not publicly available. Providing target-specific section loading becomes easier now as well.
git-svn-id: trunk@23087 -
2012-12-02 10:02:21 +00:00
sergei
8688f5e7b9 * Moved ELF definitions into a separate unit, which can be reused by CPU back-end units.
git-svn-id: trunk@23086 -
2012-12-02 09:50:15 +00:00
sergei
129d737523 + Allow TObjRelocation to be created without a symbol, such relocations are being used to tag specific positions on non-x86 targets.
* Write relocation format dependent dynamic tags based on actual sh_type of dynamic relocation sections, instead of global relocs_use_addend flag.
* Don't write DT_REL[A]COUNT tag if .rel[a].dyn section is not present.

git-svn-id: trunk@23083 -
2012-12-01 13:38:28 +00:00
sergei
a730830c19 * Factored code for allocating GOT slots into TElfExeOutput.AllocGOTSlot.
* Changed signature of GOTRelocPass1 to pass relocation index instead of relocation itself, because sometimes (e.g. when doing TLS relaxation) we need to process several subsequent relocations at once.

git-svn-id: trunk@23077 -
2012-11-29 06:37:28 +00:00
sergei
a7e7d97da6 * ELF linker: fixed written values of STT_TLS symbols, they must be relative to PT_TLS segment address.
* Made name of dynamic interpreter variable, it is now set correctly for each target.
- Removed setting header flags for ARM. This functionality belongs to CPU-specific unit anyway, and probably must be implemented using object attributes in modern ABIs.

git-svn-id: trunk@23032 -
2012-11-19 09:07:45 +00:00
sergei
0369a30f49 * Internal linker: made sec_rodata_norel read-only.
* For Win32 and Win64 targets made sec_rodata read-only, too (for these targets it doesn't matter if read-only section contains relocations).

git-svn-id: trunk@23025 -
2012-11-18 17:40:17 +00:00
sergei
2c011312db * Changed TElf32Header and TElf64Header definitions, making them look closer to canonical ones (first 16 bytes are a single array field, addressable via EI_xx indices).
git-svn-id: trunk@22999 -
2012-11-16 17:05:06 +00:00
sergei
1aea22a6ca + Internal linker: generic and ELF-specific support for grouped sections, allow same symbol to be defined in several COMDAT groups.
* ELF linker: don't make unresolved weak symbols dynamic if linking statically (-Xt in command line).
* Now internal linker produces working executable for tw14265 also on i386-linux when compiling manually (still unable to locate required libraries when run from test suite).

git-svn-id: trunk@22987 -
2012-11-15 13:41:25 +00:00
sergei
277200e7ae + ELF linker: Support writing RELATIVE dynamic relocations ahead of the rest, and their number in DT_REL[A]COUNT dynamic tag (still needs changes in CPU-specific code to function properly).
* TElfObjInput.LoadSymbols: ignore STT_SECTION symbols for sections that were ignored in LoadSections().
* TElfObjInput: changed symtabndx (index of .symtab/.dynsym section) into field and its type to unsigned.

git-svn-id: trunk@22951 -
2012-11-08 11:10:01 +00:00
sergei
d019670495 - Removed generic implementation of TObjData.sectionname, its existence is useless because it is completely overridden by all TObjData descendants.
- Removed separate ELF section names for PIC. The only difference was .data named .data.rel; however .rel suffix has nothing to do with PIC. It only signifies that the section has relocations so such sections can be grouped together in output file and reduce number of pages for dynamic linker to visit  while resolving the relocations at load time. At the same time, no existing link scripts distinguish between .rel and any other suffix (except .rel.ro, but it's a different story), meaning that long section names will break .rel grouping.
While support for .data.rel can be added similar to existing rodata handling (separate sec_data and sec_data_norel sections), this doesn't seem worth the trouble.

git-svn-id: trunk@22915 -
2012-11-02 08:03:54 +00:00
sergei
4410fe86d2 * ELF linker: moved some code (which must be executed only once when linking with separate debug file) from MemPos_Start into AfterUnusedSectionRemoval, this removes some checks and simplifies things.
* Simplified .shstrtab handling between passes by using oso_debug_copy attribute on it.
- Don't recreate segment mapping: only debug sections are removed between passes, and they are never part of any segment.

git-svn-id: trunk@22914 -
2012-11-02 06:41:03 +00:00
sergei
6023f73e2a * ELF linker: improved dynamic symbol handling.
+ Read .gnu.version sections and ignore local symbols and symbols with non-current version.
  + Check that external symbols are actually present in dynamic objects.

git-svn-id: trunk@22832 -
2012-10-23 15:16:10 +00:00
sergei
6d70009f06 + ELF linker. Works on x86_64-linux and i386-linux good enough to pass the testsuite, but still requires a lot of work in nearly all aspects. In particular, no attempt to resolve symbols from shared libs is done, everything is just treated as imports. Symbol versioning isn't supported either.
x86_64 is the most elaborated, has some degree of indirect function (GNU_IFUNC) and TLS support, so it is even able to link with static libc/pthreads code (tw14265) and produce an executable that can launch (but still fails due to invalid DWARF unwind info).

i386 produces working shared libraries if they are compiled with -Cg, without one your mileage may vary. tw14265 does not link yet due to missing COMDAT group support.

git-svn-id: trunk@22775 -
2012-10-19 17:21:08 +00:00
sergei
339d06aa58 * When writing section names of .o files, let sh_name of sections with relocations point into names of corresponding relocation sections past the .rel/.rela prefix. In case of smartlinked sections this saves almost half of .shstrtab section size.
* Fixed writing of weak defined symbols, TLS and GNU_IFUNC symbols.

git-svn-id: trunk@22665 -
2012-10-16 10:21:21 +00:00
sergei
c41b407119 * Changed TObjSection.WriteStr method to write a zero byte after the string.
+ Added TObjSection.WriteBytes method that writes just a string (without zero byte).
* ogelf.pas: Fixed st_value of COMMON symbols, it must contain required symbol alignment.
+ ogelf.pas: Some more definitions.

git-svn-id: trunk@22332 -
2012-09-06 06:06:04 +00:00