View Issue Details

IDProjectCategoryView StatusLast Update
0027994FPCCompilerpublic2015-04-29 22:09
ReporterStéphane AuleryAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product VersionProduct Build 
Target VersionFixed in Version 
Summary0027994: [patch] Fix duplicated command SIZEOF_HEADERS in Linking emitter
DescriptionFollowing discussion and testing with HJ on a bug report (# 18344) of ld, it seems that what is explained in the FAQ about the linking and the -T option is not everything true.

The code ". = 0 + SIZEOF_HEADERS;", issued for the Linux version is too much if
"PROVIDE (__executable_start = 0x0400000); . = 0x0400000 + SIZEOF_HEADERS;"
is present.

Removing ". = 0 + SIZEOF_HEADERS;" the linkage works always and more it becomes possible to call ld with the -T option.

I tested with the compilation of the msg2inc utility, it works. I wanted to test with compiling the compiler, it gets complicated.

Who can help me please?
Additional InformationPatch made against trunk
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files
  • fix_duplicated_SIZEOF_HEADERS_command.patch (566 bytes)
    Index: compiler/systems/t_linux.pas
    ===================================================================
    --- compiler/systems/t_linux.pas	(révision 30742)
    +++ compiler/systems/t_linux.pas	(copie de travail)
    @@ -598,7 +598,6 @@
             add('  . = 0 +  SIZEOF_HEADERS;')
           else
             add('  PROVIDE (__executable_start = 0x0400000); . = 0x0400000 +  SIZEOF_HEADERS;');
    -      add('  . = 0 +  SIZEOF_HEADERS;');
           add('  .interp         : { *(.interp) }');
           add('  .hash           : { *(.hash) }');
           add('  .dynsym         : { *(.dynsym) }');
    

Activities

Stéphane Aulery

2015-04-28 23:34

reporter  

fix_duplicated_SIZEOF_HEADERS_command.patch (566 bytes)
Index: compiler/systems/t_linux.pas
===================================================================
--- compiler/systems/t_linux.pas	(révision 30742)
+++ compiler/systems/t_linux.pas	(copie de travail)
@@ -598,7 +598,6 @@
         add('  . = 0 +  SIZEOF_HEADERS;')
       else
         add('  PROVIDE (__executable_start = 0x0400000); . = 0x0400000 +  SIZEOF_HEADERS;');
-      add('  . = 0 +  SIZEOF_HEADERS;');
       add('  .interp         : { *(.interp) }');
       add('  .hash           : { *(.hash) }');
       add('  .dynsym         : { *(.dynsym) }');

Stéphane Aulery

2015-04-28 23:36

reporter   ~0083309

URL of Ld bug report is https://sourceware.org/bugzilla/show_bug.cgi?id=18344

Jonas Maebe

2015-04-28 23:39

manager   ~0083310

The problem is that some people want to add support for an internal linker on Linux to FPC, in which case that command will be necessary again (unless it gets hardcoded inside the internal linker itself, but that would not be very clean).

It's not just a matter of removing things from the FPC linker scripts, otherwise I would have done it a long time ago already.

Stéphane Aulery

2015-04-28 23:51

reporter   ~0083311

Well, it remains to wait're then move on. Thank you for the information. The roadmap ist much more evasive (Linking with C++ code // Better support for dynamic linking and packages).

Florian

2015-04-29 19:47

administrator   ~0083341

> The problem is that some people want to add support for an internal linker on Linux to FPC, in which case that command will be necessary again (unless it gets hardcoded inside the internal linker itself, but that would not be very clean).

At least the internal coff linker for windows uses its own linker script. See fpc/compiler/systems/t_win.pas:940+

Stéphane Aulery

2015-04-29 20:42

reporter   ~0083344

Can you clarify Florian?

Jonas Maebe

2015-04-29 22:09

manager   ~0083345

He means that the internal and external linker can use a different linker script, so removing that line for the external linker should be possible.

Issue History

Date Modified Username Field Change
2015-04-28 23:34 Stéphane Aulery New Issue
2015-04-28 23:34 Stéphane Aulery File Added: fix_duplicated_SIZEOF_HEADERS_command.patch
2015-04-28 23:36 Stéphane Aulery Note Added: 0083309
2015-04-28 23:39 Jonas Maebe Note Added: 0083310
2015-04-28 23:51 Stéphane Aulery Note Added: 0083311
2015-04-29 19:47 Florian Note Added: 0083341
2015-04-29 20:42 Stéphane Aulery Note Added: 0083344
2015-04-29 22:09 Jonas Maebe Note Added: 0083345