Browse Source

* split off tf_dwarf_only_local_labels from tf_dwarf_relative_addresses

git-svn-id: trunk@6573 -
Jonas Maebe 18 năm trước cách đây
mục cha
commit
badf5c70a0

+ 9 - 10
compiler/dbgdwarf.pas

@@ -641,7 +641,7 @@ implementation
         { Need a new label? }
         { Need a new label? }
         if not assigned(def.dwarf_lab) then
         if not assigned(def.dwarf_lab) then
           begin
           begin
-            if not(tf_dwarf_relative_addresses in target_info.flags) then
+            if not(tf_dwarf_only_local_labels in target_info.flags) then
               begin
               begin
                 if (ds_dwarf_dbg_info_written in def.defstates) then
                 if (ds_dwarf_dbg_info_written in def.defstates) then
                   begin
                   begin
@@ -936,7 +936,7 @@ implementation
     procedure TDebugInfoDwarf.append_labelentry_ref(attr : tdwarf_attribute;sym : tasmsymbol);
     procedure TDebugInfoDwarf.append_labelentry_ref(attr : tdwarf_attribute;sym : tasmsymbol);
       begin
       begin
         current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(attr)));
         current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(attr)));
-        if not(tf_dwarf_relative_addresses in target_info.flags) then
+        if not(tf_dwarf_only_local_labels in target_info.flags) then
           begin
           begin
             current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_ref_addr)));
             current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_ref_addr)));
             current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_sym(sym))
             current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_sym(sym))
@@ -1334,7 +1334,7 @@ implementation
                 slen:=255;
                 slen:=255;
 
 
               { create a structure with two elements }
               { create a structure with two elements }
-              if not(tf_dwarf_relative_addresses in target_info.flags) then
+              if not(tf_dwarf_only_local_labels in target_info.flags) then
                 current_asmdata.getdatalabel(arr)
                 current_asmdata.getdatalabel(arr)
               else
               else
                 current_asmdata.getaddrlabel(arr);
                 current_asmdata.getaddrlabel(arr);
@@ -1448,7 +1448,7 @@ implementation
         if def.is_methodpointer then
         if def.is_methodpointer then
           begin
           begin
             { create a structure with two elements }
             { create a structure with two elements }
-            if not(tf_dwarf_relative_addresses in target_info.flags) then
+            if not(tf_dwarf_only_local_labels in target_info.flags) then
               current_asmdata.getdatalabel(proc)
               current_asmdata.getdatalabel(proc)
             else
             else
               current_asmdata.getaddrlabel(proc);
               current_asmdata.getaddrlabel(proc);
@@ -2711,7 +2711,7 @@ implementation
               append_labelentry_ref(DW_AT_type,def_dwarf_class_struct_lab(def));
               append_labelentry_ref(DW_AT_type,def_dwarf_class_struct_lab(def));
               finish_entry;
               finish_entry;
 
 
-              if not(tf_dwarf_relative_addresses in target_info.flags) then
+              if not(tf_dwarf_only_local_labels in target_info.flags) then
                 current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create_global(def_dwarf_class_struct_lab(def),0))
                 current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create_global(def_dwarf_class_struct_lab(def),0))
               else
               else
                 current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(def_dwarf_class_struct_lab(def),0));
                 current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(def_dwarf_class_struct_lab(def),0));
@@ -2728,16 +2728,15 @@ implementation
           http://sources.redhat.com/ml/gdb-patches/2005-05/msg00278.html (FK) }
           http://sources.redhat.com/ml/gdb-patches/2005-05/msg00278.html (FK) }
 
 
         if assigned(def.typesym) then
         if assigned(def.typesym) then
-          append_entry(DW_TAG_base_type,false,[
+          append_entry(DW_TAG_set_type,false,[
             DW_AT_name,DW_FORM_string,symname(def.typesym)+#0,
             DW_AT_name,DW_FORM_string,symname(def.typesym)+#0,
-            DW_AT_encoding,DW_FORM_data1,DW_ATE_unsigned,
             DW_AT_byte_size,DW_FORM_data2,def.size
             DW_AT_byte_size,DW_FORM_data2,def.size
             ])
             ])
         else
         else
-          append_entry(DW_TAG_base_type,false,[
-            DW_AT_encoding,DW_FORM_data1,DW_ATE_unsigned,
+          append_entry(DW_TAG_set_type,false,[
             DW_AT_byte_size,DW_FORM_data2,def.size
             DW_AT_byte_size,DW_FORM_data2,def.size
             ]);
             ]);
+        append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.elementdef));
         finish_entry;
         finish_entry;
       end;
       end;
 
 
@@ -2812,7 +2811,7 @@ implementation
         var
         var
           obj : tasmlabel;
           obj : tasmlabel;
         begin
         begin
-          if not(tf_dwarf_relative_addresses in target_info.flags) then
+          if not(tf_dwarf_only_local_labels in target_info.flags) then
             current_asmdata.getdatalabel(obj)
             current_asmdata.getdatalabel(obj)
           else
           else
             current_asmdata.getaddrlabel(obj);
             current_asmdata.getaddrlabel(obj);

+ 2 - 1
compiler/systems.pas

@@ -298,7 +298,8 @@ interface
             tf_has_dllscanner,
             tf_has_dllscanner,
             tf_use_function_relative_addresses,
             tf_use_function_relative_addresses,
             tf_winlikewidestring,
             tf_winlikewidestring,
-            tf_dwarf_relative_addresses
+            tf_dwarf_relative_addresses,         // use offsets where the Dwarf spec requires this instead of absolute addresses (the latter is needed by Linux binutils)
+            tf_dwarf_only_local_labels           // only use local labels inside the Dwarf debug_info section (needed for e.g. Darwin)
        );
        );
 
 
        psysteminfo = ^tsysteminfo;
        psysteminfo = ^tsysteminfo;

+ 2 - 2
compiler/systems/i_bsd.pas

@@ -397,7 +397,7 @@ unit i_bsd;
             system       : system_powerpc_darwin;
             system       : system_powerpc_darwin;
             name         : 'Darwin for PowerPC';
             name         : 'Darwin for PowerPC';
             shortname    : 'Darwin';
             shortname    : 'Darwin';
-            flags        : [tf_p_ext_support,tf_files_case_sensitive,tf_smartlink_sections,tf_dwarf_relative_addresses];
+            flags        : [tf_p_ext_support,tf_files_case_sensitive,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels];
             cpu          : cpu_powerpc;
             cpu          : cpu_powerpc;
             unit_env     : 'BSDUNITS';
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -458,7 +458,7 @@ unit i_bsd;
             system       : system_i386_darwin;
             system       : system_i386_darwin;
             name         : 'Darwin for i386';
             name         : 'Darwin for i386';
             shortname    : 'Darwin';
             shortname    : 'Darwin';
-            flags        : [tf_p_ext_support,tf_files_case_sensitive,tf_smartlink_sections,tf_dwarf_relative_addresses];
+            flags        : [tf_p_ext_support,tf_files_case_sensitive,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'BSDUNITS';
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
             extradefines : 'UNIX;BSD;HASUNIX';