[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[committed] Fix build on debian 7



Hi,

On debian 7, we run into:
...
dwz.c: In function ‘read_dwarf’:
dwz.c:10211:34: error: ‘SHF_COMPRESSED’ undeclared
...

Glibc defines SHF_COMPRESSED starting v2.22, and libelf has a fallback
definition starting v0.166, which are both not present here.

Fix this by adding a fallback definition in dwz.c.

Committed to trunk.

Thanks,
- Tom

Fix build on debian 7

2019-07-09  Tom de Vries  <tdevries@suse.de>

	* dwz.c (SHF_COMPRESSED): Define if not defined.

---
 dwz.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dwz.c b/dwz.c
index 98f6f53..13f67f2 100644
--- a/dwz.c
+++ b/dwz.c
@@ -40,6 +40,13 @@
 #include "hashtab.h"
 #include "sha1.h"
 
+#ifndef SHF_COMPRESSED
+ /* Glibc elf.h contains SHF_COMPRESSED starting v2.22.  Libelf libelf.h has
+    a fallback definition starting v0.166.  Define a fallback definition here
+    for the case of both pre-v2.22 glibc and pre-v0.166 libelf.  */
+# define SHF_COMPRESSED (1 << 11)  /* Section with compressed data.  */
+#endif
+
 /* Theory of operation:
    The DWZ tool can either optimize debug sections of a single
    executable or shared library at a time, or, when -m option