|
|
50ee54 |
From ae27211cbbfb63a0ad3c141cd1310d7f583ec40e Mon Sep 17 00:00:00 2001
|
|
|
50ee54 |
From: Mark Wielaard <mark@klomp.org>
|
|
|
50ee54 |
Date: Fri, 30 Jul 2021 18:09:46 +0200
|
|
|
50ee54 |
Subject: [PATCH] tests: Handle zero directory entry in .debug_line DWARF5
|
|
|
50ee54 |
debugedit.at
|
|
|
50ee54 |
|
|
|
50ee54 |
We were skipping the zero directory entry, because it was always
|
|
|
50ee54 |
the same as the directory entry at position one. But that isn't
|
|
|
50ee54 |
true anymore with gcc 11.2.1. There the zero dir entry is unique.
|
|
|
50ee54 |
Fix the debugedit.at .debug_line testcases using DWARF5 to also
|
|
|
50ee54 |
include dir entry zero.
|
|
|
50ee54 |
|
|
|
50ee54 |
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
50ee54 |
---
|
|
|
50ee54 |
configure.ac | 14 ++++++++++++++
|
|
|
50ee54 |
tests/atlocal.in | 1 +
|
|
|
50ee54 |
tests/debugedit.at | 18 ++++++++++++------
|
|
|
50ee54 |
3 files changed, 27 insertions(+), 6 deletions(-)
|
|
|
50ee54 |
|
|
|
50ee54 |
diff --git a/configure.ac b/configure.ac
|
|
|
50ee54 |
index e5c9230..6a53365 100644
|
|
|
50ee54 |
--- a/configure.ac
|
|
|
50ee54 |
+++ b/configure.ac
|
|
|
50ee54 |
@@ -87,6 +87,20 @@ CFLAGS="$save_CFLAGS"
|
|
|
50ee54 |
GDWARF_5_FLAG=$ac_cv_gdwarf_5
|
|
|
50ee54 |
AC_SUBST([GDWARF_5_FLAG])
|
|
|
50ee54 |
|
|
|
50ee54 |
+AC_CACHE_CHECK([whether -gdwarf-5 produced DWARF5 .debug_line], ac_cv_dwarf_5_debugline, [dnl
|
|
|
50ee54 |
+save_CFLAGS="$CFLAGS"
|
|
|
50ee54 |
+CFLAGS="-gdwarf-5"
|
|
|
50ee54 |
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i=0;]],[[/* empty main */]])],
|
|
|
50ee54 |
+ [if readelf --debug-dump=line conftest.o 2>&1 | \
|
|
|
50ee54 |
+ grep "DWARF Version:" 2>&1 | grep "5" > /dev/null 2>&1; \
|
|
|
50ee54 |
+ then ac_cv_dwarf_5_debugline=yes; \
|
|
|
50ee54 |
+ else ac_cv_dwarf_5_debugline=no; fi],
|
|
|
50ee54 |
+ ac_cv_dwarf_5_debugline=no)
|
|
|
50ee54 |
+CFLAGS="$save_CFLAGS"
|
|
|
50ee54 |
+])
|
|
|
50ee54 |
+DWARF_5_DEBUGLINE=$ac_cv_dwarf_5_debugline
|
|
|
50ee54 |
+AC_SUBST([DWARF_5_DEBUGLINE])
|
|
|
50ee54 |
+
|
|
|
50ee54 |
AC_CACHE_CHECK([whether gcc supports -gz=none], ac_cv_gz_none, [dnl
|
|
|
50ee54 |
save_CFLAGS="$CFLAGS"
|
|
|
50ee54 |
CFLAGS="-gz=none"
|
|
|
50ee54 |
diff --git a/tests/atlocal.in b/tests/atlocal.in
|
|
|
50ee54 |
index 8399f8d..d916301 100644
|
|
|
50ee54 |
--- a/tests/atlocal.in
|
|
|
50ee54 |
+++ b/tests/atlocal.in
|
|
|
50ee54 |
@@ -13,3 +13,4 @@ READELF="@READELF@"
|
|
|
50ee54 |
|
|
|
50ee54 |
GDWARF_5_FLAG=@GDWARF_5_FLAG@
|
|
|
50ee54 |
GZ_NONE_FLAG=@GZ_NONE_FLAG@
|
|
|
50ee54 |
+DWARF_5_DEBUGLINE=@DWARF_5_DEBUGLINE@
|
|
|
50ee54 |
diff --git a/tests/debugedit.at b/tests/debugedit.at
|
|
|
50ee54 |
index 0311d26..725e68e 100644
|
|
|
50ee54 |
--- a/tests/debugedit.at
|
|
|
50ee54 |
+++ b/tests/debugedit.at
|
|
|
50ee54 |
@@ -488,10 +488,12 @@ AT_CLEANUP
|
|
|
50ee54 |
AT_SETUP([debugedit .debug_line objects DWARF5])
|
|
|
50ee54 |
AT_KEYWORDS([debuginfo] [debugedit])
|
|
|
50ee54 |
AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"])
|
|
|
50ee54 |
+AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"])
|
|
|
50ee54 |
DEBUGEDIT_SETUP([-gdwarf-5])
|
|
|
50ee54 |
|
|
|
50ee54 |
AT_DATA([expout],
|
|
|
50ee54 |
[foo/bar/baz
|
|
|
50ee54 |
+foo/bar/baz/subdir_bar
|
|
|
50ee54 |
foo/bar/baz/subdir_headers
|
|
|
50ee54 |
])
|
|
|
50ee54 |
|
|
|
50ee54 |
@@ -500,8 +502,8 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]])
|
|
|
50ee54 |
AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]])
|
|
|
50ee54 |
AT_CHECK([[
|
|
|
50ee54 |
readelf --debug-dump=line foo.o subdir_bar/bar.o baz.o \
|
|
|
50ee54 |
- | grep -A5 "The Directory Table" | grep "^ [123]" \
|
|
|
50ee54 |
- | cut -f2- -d/ | grep ^foo/ | sort
|
|
|
50ee54 |
+ | grep -A5 "The Directory Table" | grep "^ [0123]" \
|
|
|
50ee54 |
+ | cut -f2- -d/ | grep ^foo/ | sort -u
|
|
|
50ee54 |
]],[0],[expout])
|
|
|
50ee54 |
|
|
|
50ee54 |
AT_CLEANUP
|
|
|
50ee54 |
@@ -535,18 +537,20 @@ AT_CLEANUP
|
|
|
50ee54 |
AT_SETUP([debugedit .debug_line partial DWARF5])
|
|
|
50ee54 |
AT_KEYWORDS([debuginfo] [debugedit])
|
|
|
50ee54 |
AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"])
|
|
|
50ee54 |
+AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"])
|
|
|
50ee54 |
DEBUGEDIT_SETUP([-gdwarf-5])
|
|
|
50ee54 |
|
|
|
50ee54 |
AT_DATA([expout],
|
|
|
50ee54 |
[foo/bar/baz
|
|
|
50ee54 |
+foo/bar/baz/subdir_bar
|
|
|
50ee54 |
foo/bar/baz/subdir_headers
|
|
|
50ee54 |
])
|
|
|
50ee54 |
|
|
|
50ee54 |
AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
|
|
|
50ee54 |
AT_CHECK([[
|
|
|
50ee54 |
readelf --debug-dump=line ./foobarbaz.part.o \
|
|
|
50ee54 |
- | grep -A5 "The Directory Table" | grep "^ [123]" \
|
|
|
50ee54 |
- | cut -f2- -d/ | grep ^foo/ | sort
|
|
|
50ee54 |
+ | grep -A5 "The Directory Table" | grep "^ [0123]" \
|
|
|
50ee54 |
+ | cut -f2- -d/ | grep ^foo/ | sort -u
|
|
|
50ee54 |
]],[0],[expout])
|
|
|
50ee54 |
|
|
|
50ee54 |
AT_CLEANUP
|
|
|
50ee54 |
@@ -580,18 +584,20 @@ AT_CLEANUP
|
|
|
50ee54 |
AT_SETUP([debugedit .debug_line exe DWARF5])
|
|
|
50ee54 |
AT_KEYWORDS([debuginfo] [debugedit])
|
|
|
50ee54 |
AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"])
|
|
|
50ee54 |
+AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"])
|
|
|
50ee54 |
DEBUGEDIT_SETUP([-gdwarf-5])
|
|
|
50ee54 |
|
|
|
50ee54 |
AT_DATA([expout],
|
|
|
50ee54 |
[foo/bar/baz
|
|
|
50ee54 |
+foo/bar/baz/subdir_bar
|
|
|
50ee54 |
foo/bar/baz/subdir_headers
|
|
|
50ee54 |
])
|
|
|
50ee54 |
|
|
|
50ee54 |
AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
|
|
|
50ee54 |
AT_CHECK([[
|
|
|
50ee54 |
readelf --debug-dump=line ./foobarbaz.exe \
|
|
|
50ee54 |
- | grep -A5 "The Directory Table" | grep "^ [123]" \
|
|
|
50ee54 |
- | cut -f2- -d/ | grep ^foo/ | sort
|
|
|
50ee54 |
+ | grep -A5 "The Directory Table" | grep "^ [0123]" \
|
|
|
50ee54 |
+ | cut -f2- -d/ | grep ^foo/ | sort -u
|
|
|
50ee54 |
]],[0],[expout])
|
|
|
50ee54 |
|
|
|
50ee54 |
AT_CLEANUP
|
|
|
50ee54 |
--
|
|
|
50ee54 |
2.27.0
|
|
|
50ee54 |
|