* 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 -
* Netware target may be broken by this change; at least it deserves a good cleanup because it contains a lot of code trying to solve similar task: to write exesections without alignment and deal with objsections that are nevertheless being aligned by TExeOutput.
git-svn-id: trunk@23291 -
* 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 -
* 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 -
* 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 -
* 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 -
* 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 -
- 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 -
* TExeOutput.WriteExeSectionContent: To write proper gap between exe sections, don't align writer position. The desired position is present in exesection.DataPos, so pad right up to it.
git-svn-id: trunk@22881 -
Therefore, added dedicated routines align_aword and align_qword that handle target platform size and 64-bit unsigned, respectively.
+ Also added TExeOutput.FixedSectionAlign boolean that, when set to False, ignores SectionDataAlign and SectionMemAlign and aligns every exe section to its own SecAlign value. This kind of alignment is used on ELF targets.
git-svn-id: trunk@22858 -
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 -
* TExeOutput.FixupSymbols:
+ Collect AT_GNU_IFUNC symbols in IndirectObjSymbols list for further processing by ELF back-end.
* Do not overwrite bind and size while fixing AB_COMMON symbols, this removes need in storing symbol size in every relocation and dedicated handling of oso_common section.
* Remove symbols with objsection<>nil from lists, so calling FixupSymbols several times skips already processed symbols.
git-svn-id: trunk@22393 -
+ 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 -
+ Allow unresolved external symbols in RemoveUnreferencedSections, such symbols are marked as 'dynamic' if referenced. This approach allows to collect unused sections early and generate import structures only for actually used symbols.
git-svn-id: trunk@22312 -
+ Support linker input source grouping functionality.
* Promote TStaticLibrary to something like generic linker input statement, it can now hold regular ObjData or a group of other TStaticLibrary objects in addition to tarobjectreader.
git-svn-id: trunk@22155 -
* Optimized COFF importing code using the new method.
- Don't create .text sections for imported variables.
- Don't create .idata$6 sections for imports by ordinal.
git-svn-id: trunk@22086 -
+ Two stubs (TExeOutput.Load_DynamicObject and TObjInput.CanReadObjData) to override in ELF linker.
+ Stop linking if errors were detected while loading object files.
* Changed TStaticLibrary to TObject. It is never looked up by name, so hashing is redundant; moreover its name has been changed to TCmdStr, which may be trimmed by TFPHashList.
git-svn-id: trunk@21968 -
* Changed type of symbols created by link script from AT_FUNCTION to AT_DATA. This isn't significant for COFF, but matters for ELF targets.
* Changed alignment of .gnu_debuglink section from 0 to 1, this matches behavior of ld.
git-svn-id: trunk@21741 -
* Also simplified COFF symbol loading, separate array of symbol sizes is not needed because these sizes never change during the load.
git-svn-id: trunk@21704 -
+ Store size of relocation and explicit addend in TObjRelocation (reusing 'orgsize' field for the latter). This removes need for reading addends back from section data, addends are stored in full 64 bits and therefore not truncated.
+ Relocation style is now controlled by relocs_use_addend variable instead of $ifdef's.
- Removed (never working) checks forbidding relocations of readonly sections. At the linking stage readonly sections *can* have relocations, executable stage is different matter to be handled elsewhere.
- removed ugly hack with mapping 32-bit absolute relocations to RELOC_RVA.
+ support 64-bit relative relocations.
* actualized list of x86_64 relocations.
git-svn-id: trunk@21662 -
* 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 -