Browse Source

* Always generate CFI-information. During linking it can be omitted when
no debug-information is requested. On Linux this needed a change in the
linker-script. On Windows it already works as desired. Other targets
may need some adjustments as well.

Joost van der Sluis 3 years ago
parent
commit
3385ce92a2
2 changed files with 7 additions and 3 deletions
  1. 5 3
      compiler/cfidwarf.pas
  2. 2 0
      compiler/systems/t_linux.pas

+ 5 - 3
compiler/cfidwarf.pas

@@ -238,10 +238,12 @@ implementation
         inherited;
         if tf_use_psabieh in target_info.flags then
           datatype:=dt_eh_frame
-        else if cs_debuginfo in current_settings.moduleswitches then
-          datatype:=dt_debug
         else
-          datatype:=dt_none;
+          { The CFI-information is always generated, regardless of the debug
+            settings. This way the CFI-information for units is always available
+            and during linking it can be omitted or not, based on the debug
+            settings. }
+          datatype:=dt_debug;
       end;
 
 {****************************************************************************

+ 2 - 0
compiler/systems/t_linux.pas

@@ -715,6 +715,8 @@ begin
       add('  {');
       add('    KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
       add('  }');
+      if not ((cs_debuginfo in current_settings.moduleswitches)) then
+        add('  /DISCARD/ : {*(.debug_frame)}');
       add('  .threadvar : { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }');
       add('}');
       { this "INSERT" means "merge into the original linker script, even if