[Bug libelf/27134] New: elfutils-git fails tests against binutils-git (GNU_RETAIN section type)

2020-12-31 Thread slyfox at inbox dot ru via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27134

Bug ID: 27134
   Summary: elfutils-git fails tests against binutils-git
(GNU_RETAIN section type)
   Product: elfutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: libelf
  Assignee: unassigned at sourceware dot org
  Reporter: slyfox at inbox dot ru
CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Example test failures (had to add GNU_RETAIN printer):

FAIL: run-strip-strmerge.sh

elflint /home/slyfox/dev/git/elfutils/tests/elfstrmerge
section [19] '.init_array' has wrong flags: expected WRITE|ALLOC, is
WRITE|ALLOC|GNU_RETAIN
section [20] '.fini_array' has wrong flags: expected WRITE|ALLOC, is
WRITE|ALLOC|GNU_RETAIN
FAIL run-strip-strmerge.sh (exit status: 1)

FAIL: run-elflint-self.sh
FAIL: run-reverse-sections-self.sh

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[PATCH] src/elflint.c: add debug print for GNU_RETAIN and others

2020-12-31 Thread Sergei Trofimovich via Elfutils-devel
---
 src/elflint.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/elflint.c b/src/elflint.c
index b3cbaade..7b7f7937 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -2789,7 +2789,10 @@ section_flags_string (GElf_Word flags, char *buf, size_t 
len)
   NEWFLAG (OS_NONCONFORMING),
   NEWFLAG (GROUP),
   NEWFLAG (TLS),
-  NEWFLAG (COMPRESSED)
+  NEWFLAG (COMPRESSED),
+  NEWFLAG (GNU_RETAIN),
+  NEWFLAG (ORDERED),
+  NEWFLAG (EXCLUDE)
 };
 #undef NEWFLAG
   const size_t nknown_flags = sizeof (known_flags) / sizeof (known_flags[0]);
-- 
2.30.0



[PATCH] src/elflint.c: fix printing of unknown flags

2020-12-31 Thread Sergei Trofimovich via Elfutils-devel
before the change section_flags_string() ignored unknown section
flags: snprintf() did write numeric value int obuffer, but
"*cp = '\0'" hegated the effect.

The change advances the 'cp' pointer'.

While at it add a '|' separator between known and unknown flags.

Signed-off-by: Sergei Trofimovich 
---
 src/elflint.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/elflint.c b/src/elflint.c
index 7b7f7937..8f5227b3 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -2815,9 +2815,11 @@ section_flags_string (GElf_Word flags, char *buf, size_t 
len)
flags ^= known_flags[cnt].flag;
   }
 
-  if (flags != 0 || cp == buf)
-snprintf (cp, len - 1, "%" PRIx64, (uint64_t) flags);
-
+  if (flags != 0 || cp == buf) {
+int r = snprintf (cp, len - 1, "%s%" PRIx64, (cp == buf) ? "" : "|", 
(uint64_t) flags);
+if (r > 0)
+  cp += r;
+  }
   *cp = '\0';
 
   return buf;
-- 
2.30.0



[Bug libelf/27134] elfutils-git fails tests against gcc-git (GNU_RETAIN section type)

2020-12-31 Thread slyfox at inbox dot ru via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27134

Sergei Trofimovich  changed:

   What|Removed |Added

Summary|elfutils-git fails tests|elfutils-git fails tests
   |against binutils-git|against gcc-git (GNU_RETAIN
   |(GNU_RETAIN section type)   |section type)

--- Comment #1 from Sergei Trofimovich  ---
I mis-interpreter the change that caused test failures. elfutils built with
gcc-10.2.0 still passes the tests.

gcc-11 does not pass tests, probably after https://gcc.gnu.org/PR98146

-- 
You are receiving this mail because:
You are on the CC list for the bug.