Re-introduce '_start' labels and add alignment in dw2-dir-file-name test case.
authorAndreas Arnez <arnez@linux.vnet.ibm.com>
Wed, 22 Jan 2014 15:33:00 +0000 (15:33 +0000)
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>
Wed, 22 Jan 2014 16:02:13 +0000 (17:02 +0100)
On ppc64-linux a function symbol does not point to code, but to the
function descriptor.  Thus the previous change for this test case
broke it:

      https://sourceware.org/ml/gdb-patches/2014-01/msg00275.html

This patch reverts to the original method, re-introducing '_start'
symbols.  In addition, it adds sufficient alignment before the label,
such that the label never points into an alignment gap.

gdb/testsuite/ChangeLog:
* gdb.dwarf2/dw2-dir-file-name.c (FUNC): Insert alignment and
define "*_start" label.  Make "name" static.
* gdb.dwarf2/dw2-dir-file-name.exp: Replace references to
${name} by references to ${name}_start.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c
gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp

index 16d7616e6c12681c3925a7b1007fd8be6c331e62..5e02b7ac820e4e7b0c51d2315884f91269c1c859 100644 (file)
@@ -1,3 +1,10 @@
+2014-01-22  Andreas Arnez  <arnez@vnet.linux.ibm.com>
+
+       * gdb.dwarf2/dw2-dir-file-name.c (FUNC): Insert alignment and
+       define "*_start" label.  Make "name" static.
+       * gdb.dwarf2/dw2-dir-file-name.exp: Replace references to
+       ${name} by references to ${name}_start.
+
 2014-01-22  Andreas Arnez  <arnez@vnet.linux.ibm.com>
 
        * gdb.base/info-macros.exp: Remove "debug" from the compile
index 2b9cc6a85780628761b4f9d55a1383c7fb835285..517df9001fd6031a2d2fef5351df0281ed188708 100644 (file)
@@ -63,8 +63,16 @@ FUNC (compdir_absolute_ldir_absolute_file_relative_different)        \
 FUNC (compdir_absolute_ldir_absolute_file_absolute_same)       \
 FUNC (compdir_absolute_ldir_absolute_file_absolute_different)
 
+/* Notes: (1) The '*_start' label below is needed because 'name' may
+   point to a function descriptor instead of to the actual code.  (2)
+   The '.balign' should specify the highest possible function
+   alignment across all supported architectures, such that the label
+   never points into the alignment gap.  */
+
 #define FUNC(name)                                     \
-  void                                                 \
+  asm (".balign 8");                                   \
+  asm (#name "_start: .globl " #name "_start\n");      \
+  static void                                          \
   name (void)                                          \
   {                                                    \
     v++;                                               \
index e523e89a163cfbd7368d9fe23ac5f2368c8a7934..7f29581dcd757d1ccd940315178845bcd13aa12f 100644 (file)
@@ -54,7 +54,7 @@ proc out_cu { name cu_dir cu_name line_dir line_name } {
        .ascii  \"GNU C\\0\"                    /* DW_AT_producer */
        .byte   2                               /* DW_AT_language (DW_LANG_C) */
        .4byte  .Lline_${name}_begin            /* DW_AT_stmt_list */
-       .4byte  ${name}                 /* DW_AT_low_pc */
+       .4byte  ${name}_start                   /* DW_AT_low_pc */
        .4byte  ${name}_end                     /* DW_AT_high_pc */
 "
     if { $cu_dir != "" } {
@@ -65,7 +65,7 @@ proc out_cu { name cu_dir cu_name line_dir line_name } {
 
        .uleb128        3                       /* Abbrev: DW_TAG_subprogram */
        .asciz          \"${name}\"             /* DW_AT_name */
-       .4byte          ${name}         /* DW_AT_low_pc */
+       .4byte          ${name}_start           /* DW_AT_low_pc */
        .4byte          ${name}_end             /* DW_AT_high_pc */
 
        .byte           0                       /* End of children of CU */
@@ -122,7 +122,7 @@ proc out_line { name cu_dir cu_name line_dir line_name } {
        .byte           0       /* DW_LNE_set_address */
        .uleb128        5
        .byte           2
-       .4byte          ${name}
+       .4byte          ${name}_start
        .byte           1       /* DW_LNS_copy */
        .byte           3       /* DW_LNS_advance_line */
        .sleb128        1       /* ... to 1000 */