]> git.pld-linux.org Git - packages/debugedit.git/blob - 0001-tests-Handle-zero-directory-entry-in-.debug_line-DWA.patch
- new
[packages/debugedit.git] / 0001-tests-Handle-zero-directory-entry-in-.debug_line-DWA.patch
1 From ae27211cbbfb63a0ad3c141cd1310d7f583ec40e Mon Sep 17 00:00:00 2001
2 From: Mark Wielaard <mark@klomp.org>
3 Date: Fri, 30 Jul 2021 18:09:46 +0200
4 Subject: [PATCH] tests: Handle zero directory entry in .debug_line DWARF5
5  debugedit.at
6
7 We were skipping the zero directory entry, because it was always
8 the same as the directory entry at position one. But that isn't
9 true anymore with gcc 11.2.1. There the zero dir entry is unique.
10 Fix the debugedit.at .debug_line testcases using DWARF5 to also
11 include dir entry zero.
12
13 Signed-off-by: Mark Wielaard <mark@klomp.org>
14 ---
15  configure.ac       | 14 ++++++++++++++
16  tests/atlocal.in   |  1 +
17  tests/debugedit.at | 18 ++++++++++++------
18  3 files changed, 27 insertions(+), 6 deletions(-)
19
20 diff --git a/configure.ac b/configure.ac
21 index e5c9230..6a53365 100644
22 --- a/configure.ac
23 +++ b/configure.ac
24 @@ -87,6 +87,20 @@ CFLAGS="$save_CFLAGS"
25  GDWARF_5_FLAG=$ac_cv_gdwarf_5
26  AC_SUBST([GDWARF_5_FLAG])
27  
28 +AC_CACHE_CHECK([whether -gdwarf-5 produced DWARF5 .debug_line], ac_cv_dwarf_5_debugline, [dnl
29 +save_CFLAGS="$CFLAGS"
30 +CFLAGS="-gdwarf-5"
31 +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i=0;]],[[/* empty main */]])],
32 +  [if readelf --debug-dump=line conftest.o 2>&1 | \
33 +   grep "DWARF Version:" 2>&1 | grep "5" > /dev/null 2>&1; \
34 +     then ac_cv_dwarf_5_debugline=yes; \
35 +     else ac_cv_dwarf_5_debugline=no; fi],
36 +  ac_cv_dwarf_5_debugline=no)
37 +CFLAGS="$save_CFLAGS"
38 +])
39 +DWARF_5_DEBUGLINE=$ac_cv_dwarf_5_debugline
40 +AC_SUBST([DWARF_5_DEBUGLINE])
41 +
42  AC_CACHE_CHECK([whether gcc supports -gz=none], ac_cv_gz_none, [dnl
43  save_CFLAGS="$CFLAGS"
44  CFLAGS="-gz=none"
45 diff --git a/tests/atlocal.in b/tests/atlocal.in
46 index 8399f8d..d916301 100644
47 --- a/tests/atlocal.in
48 +++ b/tests/atlocal.in
49 @@ -13,3 +13,4 @@ READELF="@READELF@"
50  
51  GDWARF_5_FLAG=@GDWARF_5_FLAG@
52  GZ_NONE_FLAG=@GZ_NONE_FLAG@
53 +DWARF_5_DEBUGLINE=@DWARF_5_DEBUGLINE@
54 diff --git a/tests/debugedit.at b/tests/debugedit.at
55 index 0311d26..725e68e 100644
56 --- a/tests/debugedit.at
57 +++ b/tests/debugedit.at
58 @@ -488,10 +488,12 @@ AT_CLEANUP
59  AT_SETUP([debugedit .debug_line objects DWARF5])
60  AT_KEYWORDS([debuginfo] [debugedit])
61  AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"])
62 +AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"])
63  DEBUGEDIT_SETUP([-gdwarf-5])
64  
65  AT_DATA([expout],
66  [foo/bar/baz
67 +foo/bar/baz/subdir_bar
68  foo/bar/baz/subdir_headers
69  ])
70  
71 @@ -500,8 +502,8 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]])
72  AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]])
73  AT_CHECK([[
74  readelf --debug-dump=line foo.o subdir_bar/bar.o baz.o \
75 -        | grep -A5 "The Directory Table" | grep "^  [123]" \
76 -       | cut -f2- -d/ | grep ^foo/ | sort
77 +       | grep -A5 "The Directory Table" | grep "^  [0123]" \
78 +       | cut -f2- -d/ | grep ^foo/ | sort -u
79  ]],[0],[expout])
80  
81  AT_CLEANUP
82 @@ -535,18 +537,20 @@ AT_CLEANUP
83  AT_SETUP([debugedit .debug_line partial DWARF5])
84  AT_KEYWORDS([debuginfo] [debugedit])
85  AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"])
86 +AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"])
87  DEBUGEDIT_SETUP([-gdwarf-5])
88  
89  AT_DATA([expout],
90  [foo/bar/baz
91 +foo/bar/baz/subdir_bar
92  foo/bar/baz/subdir_headers
93  ])
94  
95  AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
96  AT_CHECK([[
97  readelf --debug-dump=line ./foobarbaz.part.o \
98 -        | grep -A5 "The Directory Table" | grep "^  [123]" \
99 -       | cut -f2- -d/ | grep ^foo/ | sort
100 +       | grep -A5 "The Directory Table" | grep "^  [0123]" \
101 +       | cut -f2- -d/ | grep ^foo/ | sort -u
102  ]],[0],[expout])
103  
104  AT_CLEANUP
105 @@ -580,18 +584,20 @@ AT_CLEANUP
106  AT_SETUP([debugedit .debug_line exe DWARF5])
107  AT_KEYWORDS([debuginfo] [debugedit])
108  AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"])
109 +AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"])
110  DEBUGEDIT_SETUP([-gdwarf-5])
111  
112  AT_DATA([expout],
113  [foo/bar/baz
114 +foo/bar/baz/subdir_bar
115  foo/bar/baz/subdir_headers
116  ])
117  
118  AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
119  AT_CHECK([[
120  readelf --debug-dump=line ./foobarbaz.exe \
121 -        | grep -A5 "The Directory Table" | grep "^  [123]" \
122 -       | cut -f2- -d/ | grep ^foo/ | sort
123 +       | grep -A5 "The Directory Table" | grep "^  [0123]" \
124 +       | cut -f2- -d/ | grep ^foo/ | sort -u
125  ]],[0],[expout])
126  
127  AT_CLEANUP
128 -- 
129 2.27.0
130
This page took 0.112566 seconds and 3 git commands to generate.