llvm.org GIT mirror llvm / 5563be0
Add accessor to get 'visibility' part of st_other field This new `getVisibility()` function will also be used in the LLD code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221392 91177308-0d34-0410-b5e6-96231b3b80d8 Simon Atanasyan 6 years ago
2 changed file(s) with 5 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
175175 template
176176 struct Elf_Sym_Impl : Elf_Sym_Base {
177177 using Elf_Sym_Base::st_info;
178 using Elf_Sym_Base::st_other;
178179
179180 // These accessors and mutators correspond to the ELF32_ST_BIND,
180181 // ELF32_ST_TYPE, and ELF32_ST_INFO macros defined in the ELF specification:
185186 void setBindingAndType(unsigned char b, unsigned char t) {
186187 st_info = (b << 4) + (t & 0x0f);
187188 }
189
190 /// Access to the STV_xxx flag stored in the first two bits of st_other.
191 unsigned char getVisibility() const { return st_other & 0x3; }
188192 };
189193
190194 /// Elf_Versym: This is the structure of entries in the SHT_GNU_versym section
132132 S.Type = Sym->getType();
133133 S.Value = Sym->st_value;
134134 S.Size = Sym->st_size;
135 S.Visibility = Sym->st_other & 0x3;
135 S.Visibility = Sym->getVisibility();
136136
137137 ErrorOr NameOrErr = Obj.getSymbolName(Sym);
138138 if (std::error_code EC = NameOrErr.getError())