1074 _elf_seterr(EREQ_RAND, 0);
1075 rc = 0;
1076 } else if (class == ELFCLASS32) {
1077 Elf32_Cap *c = &(((Elf32_Cap *)dst->d_buf)[ndx]);
1078
1079 c->c_tag = (Elf32_Word)src->c_tag;
1080 c->c_un.c_val = (Elf32_Word)src->c_un.c_val;
1081 } else
1082 ((Elf64_Cap *)dst->d_buf)[ndx] = *((Elf64_Cap *)src);
1083
1084 ELFUNLOCK(EDATA_ELF(dst));
1085 return (rc);
1086 }
1087
1088 /*
1089 * If the specified object has a dynamic section, and that section
1090 * contains a DT_FLAGS_1 entry, then return the value of that entry.
1091 * Otherwise, return 0.
1092 */
1093 GElf_Xword
1094 _gelf_getdyndtflags_1(Elf *elf)
1095 {
1096 Elf_Scn *scn = NULL;
1097 Elf_Data *data;
1098 GElf_Shdr shdr;
1099 GElf_Dyn dyn;
1100 int i, n;
1101
1102 while (scn = elf_nextscn(elf, scn)) {
1103 if (gelf_getshdr(scn, &shdr) == NULL)
1104 break;
1105 if (shdr.sh_type != SHT_DYNAMIC)
1106 continue;
1107 if (data = elf_getdata(scn, NULL)) {
1108 n = shdr.sh_size / shdr.sh_entsize;
1109 for (i = 0; i < n; i++) {
1110 (void) gelf_getdyn(data, i, &dyn);
1111 if (dyn.d_tag == DT_FLAGS_1) {
1112 return (dyn.d_un.d_val);
1113 }
1114 }
1115 }
1116 break;
1117 }
1118 return (0);
1119 }
|
1074 _elf_seterr(EREQ_RAND, 0);
1075 rc = 0;
1076 } else if (class == ELFCLASS32) {
1077 Elf32_Cap *c = &(((Elf32_Cap *)dst->d_buf)[ndx]);
1078
1079 c->c_tag = (Elf32_Word)src->c_tag;
1080 c->c_un.c_val = (Elf32_Word)src->c_un.c_val;
1081 } else
1082 ((Elf64_Cap *)dst->d_buf)[ndx] = *((Elf64_Cap *)src);
1083
1084 ELFUNLOCK(EDATA_ELF(dst));
1085 return (rc);
1086 }
1087
1088 /*
1089 * If the specified object has a dynamic section, and that section
1090 * contains a DT_FLAGS_1 entry, then return the value of that entry.
1091 * Otherwise, return 0.
1092 */
1093 GElf_Xword
1094 _gelf_getdynval(Elf *elf, GElf_Sxword tag)
1095 {
1096 Elf_Scn *scn = NULL;
1097 Elf_Data *data;
1098 GElf_Shdr shdr;
1099 GElf_Dyn dyn;
1100 int i, n;
1101
1102 while (scn = elf_nextscn(elf, scn)) {
1103 if (gelf_getshdr(scn, &shdr) == NULL)
1104 break;
1105 if (shdr.sh_type != SHT_DYNAMIC)
1106 continue;
1107 if (data = elf_getdata(scn, NULL)) {
1108 n = shdr.sh_size / shdr.sh_entsize;
1109 for (i = 0; i < n; i++) {
1110 (void) gelf_getdyn(data, i, &dyn);
1111 if (dyn.d_tag == tag) {
1112 return (dyn.d_un.d_val);
1113 }
1114 }
1115 }
1116 break;
1117 }
1118 return (0);
1119 }
1120
1121 GElf_Xword
1122 _gelf_getdyndtflags_1(Elf *elf)
1123 {
1124 return (_gelf_getdynval(elf, DT_FLAGS_1));
1125 }
|