Provide enums for DT_FLAGS and DT_FLAGS_1 (#200)
* Provide enums for DT_FLAGS and DT_FLAGS_1
This change adds two enums with the name to value mappings
for the two flags fields in the dynamic section. The values
and corresponding names are taken from the elf/elf.h file
in the most recent glibc version.
The enums are also used to print the names instead of the
raw hex values for DT_FLAGS and DT_FLAGS_1 in
scripts/readelf.py.
Fixes: #189
* Add test file for DT_FLAGS/DT_FLAGS_1 parsing
The test file has the DF_BIND_NOW and DF_ORIGIN flags set
in DT_FLAGS as well as DF_1_NOW, DF_1_GLOBAL, DF_1_NOOPEN
and DF_1_ORIGIN flags in DF_FLAGS_1.
This is the source code for the dt_flags.elf file:
#include <stdio.h>
int function(const char *arg){
printf("Hello, %s!", arg);
return 0;
}
and was compiled using the following command line:
$ gcc -shared -m32 \
-Wl,-rpath,'$ORIGIN/lib',-z,global,-z,origin,-z,nodlopen,-z,now \
-o testfiles_for_readelf/dt_flags.elf dt_flags.c