Hi Samuel,

On Mon, 2025-03-17 at 17:39 +1000, Samuel Zeter wrote:
> When printing section headers, also include a key to what each flag
> is at the end of the section header output.

Did you run make check after your patch? It seems various tests fail
because they aren't expecting the new flag info. I am getting:

FAIL: run-large-elf-file.sh
FAIL: run-strip-remove-keep.sh
FAIL: run-readelf-z.sh
FAIL: run-retain.sh
FAIL: run-backtrace-native-core-biarch.sh
FAIL: run-copyadd-sections.sh
FAIL: run-copymany-be32.sh
FAIL: run-copymany-le32.sh
FAIL: run-copymany-be64.sh
FAIL: run-copymany-le64.sh

# TOTAL: 286
# PASS:  275
# SKIP:  1
# XFAIL: 0
# FAIL:  10
# XPASS: 0
# ERROR: 0

> Signed-off-by: Samuel Zeter <samuelze...@gmail.com>
> ---
>  src/readelf.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/src/readelf.c b/src/readelf.c
> index 12d85472..f9c1c742 100644
> --- a/src/readelf.c
> +++ b/src/readelf.c
> @@ -341,6 +341,7 @@ static void print_strings (Ebl *ebl);
>  static void dump_archive_index (Elf *, const char *);
>  static void print_dwarf_addr (Dwfl_Module *dwflmod, int address_size,
>                             Dwarf_Addr address, Dwarf_Addr raw);
> +static void print_flag_info(void);
>  
>  enum dyn_idx
>  {
> @@ -1406,9 +1407,19 @@ There are %zd section headers, starting at offset %#" 
> PRIx64 ":\n\
>       }
>      }
>  
> +  print_flag_info();
>    fputc ('\n', stdout);
>  }
>  
> +/* Print flag information.  */
> +static void
> +print_flag_info (void)
> +{
> +     puts ("Key to Flags:");
> +     puts ("  W (write), A (alloc), X (execute), M (merge), S (strings), I 
> (info),");
> +     puts ("  L (link order), N (extra OS processing required), G (group), T 
> (TLS),");
> +     puts ("  C (compressed), O (ordered), R (GNU retain), E (exclude)");
> +}
>  
>  /* Print the program header.  */
>  static void

The patch itself does look correct. These are the flags that print_shdr
prints if the corresponding shdr->sh_flags are set.

Cheers,

Mark

Reply via email to