浏览代码

Prevent usage of internal linker in cross-endian configuration.

Add LinkInternSetExplicitly field to TOption class.
Set this field to true if '-Xe-' or '-Xi' option is used.
Check at exit if in cross-endian configuration:
 if LinkInternSetExplicitly is set, issue error message,
else add cs_link_extern to init_settings.globalswitches.
Pierre Muller 1 年之前
父节点
当前提交
2cbaa24f76
共有 4 个文件被更改,包括 317 次插入298 次删除
  1. 3 1
      compiler/msg/errore.msg
  2. 3 2
      compiler/msgidx.inc
  3. 295 293
      compiler/msgtxt.inc
  4. 16 2
      compiler/options.pas

+ 3 - 1
compiler/msg/errore.msg

@@ -3185,7 +3185,7 @@ execinfo_x_stackcommit=09134_X_Stack space committed: $1 bytes
 #
 # Internal linker messages
 #
-# 09222 is the last used one
+# 09223 is the last used one
 #
 # BeginOfTeX
 % \section{Linker messages}
@@ -3250,6 +3250,8 @@ link_e_undefined_symbol_in_obj=09221_E_Undefined symbol: $1 (first seen in $2)
 % The specified symbol is used, but not defined and was first seen in the specified object file.
 link_e_undefined_symbol=09222_E_Undefined symbol: $1
 % The specified symbol is used, but not defined.
+link_e_unsupported_cross_endian_internal_linker=09223_E_Using internal linker in cross-endian configuration is not supported
+% The internal linker does not correctly handle endianess conversion.
 % \end{description}
 # EndOfTeX
 

+ 3 - 2
compiler/msgidx.inc

@@ -985,6 +985,7 @@ const
   link_e_comdat_selection_differs=09220;
   link_e_undefined_symbol_in_obj=09221;
   link_e_undefined_symbol=09222;
+  link_e_unsupported_cross_endian_internal_linker=09223;
   unit_t_unitsearch=10000;
   unit_t_ppu_loading=10001;
   unit_u_ppu_name=10002;
@@ -1170,9 +1171,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 92222;
+  MsgTxtSize = 92299;
 
   MsgIdxMax : array[1..20] of longint=(
-    29,109,371,134,102,63,148,38,223,71,
+    29,109,371,134,102,63,148,38,224,71,
     68,20,30,1,1,1,1,1,1,1
   );

文件差异内容过多而无法显示
+ 295 - 293
compiler/msgtxt.inc


+ 16 - 2
compiler/options.pas

@@ -38,6 +38,7 @@ Type
     LogoWritten,
     ABISetExplicitly,
     FPUSetExplicitly,
+    LinkInternSetExplicitly,
     CPUSetExplicitly,
     OptCPUSetExplicitly: boolean;
     FileLevel : longint;
@@ -4179,7 +4180,10 @@ begin
        'e' :
          begin
            If UnsetBool(More, j, opt, false) then
-             exclude(init_settings.globalswitches,cs_link_extern)
+             begin
+               exclude(init_settings.globalswitches,cs_link_extern);
+               LinkInternSetExplicitly:=true;
+             end
            else
              include(init_settings.globalswitches,cs_link_extern);
          end;
@@ -4197,7 +4201,10 @@ begin
            If UnsetBool(More, j, opt, false) then
              include(init_settings.globalswitches,cs_link_extern)
            else
-             exclude(init_settings.globalswitches,cs_link_extern);
+             begin
+               exclude(init_settings.globalswitches,cs_link_extern);
+               LinkInternSetExplicitly:=true;
+             end;
          end;
        'n' :
          begin
@@ -5692,6 +5699,13 @@ begin
 
   if not option.LinkTypeSetExplicitly then
     set_default_link_type;
+  if source_info.endian<>target_info.endian then
+    begin
+      if option.LinkInternSetExplicitly then
+        Message(link_e_unsupported_cross_endian_internal_linker)
+      else
+        include(init_settings.globalswitches,cs_link_extern);
+    end;
 
   { Default alignment settings,
     1. load the defaults for the target

部分文件因为文件数量过多而无法显示