[PATCH] D66886: [yaml2obj][obj2yaml] - Use a single "Other" field instead of "Other", "Visibility" and "StOther".

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 08:13:02 PDT 2019


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: seiya, rupprecht, atanasyan, jakehehrlich, arichardson, sdardis, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.

Currenly we can encode the 'st_other' field of symbol using 3 fields.
'Visibility' is used to encode STV_* values.
'Other' is used to encode everything except the visibility, but it can't handle arbitrary values.
'StOther' is used to encode arbitrary values when 'Visibility'/'Other' are not helpfull enough.

'st_other' field is used to encode symbol visibility and platform-dependent
flags and values. Problem to encode it is that it consists of Visibility part (STV_* values)
which are enumeration values and the Other part, which is different and inconsistent.

For MIPS the Other part contains flags for all STO_MIPS_* values except STO_MIPS_MIPS16.
(Like comment in ELFDumper says: "Someones in their infinite wisdom decided to make
STO_MIPS_MIPS16 flag overlapped with other ST_MIPS_xxx flags."...)

And for PPC64 the Other part might actually encode any value.

This patch implements custom logic for handling the st_other and removes
'Visibility' and 'StOther' fields.

Here is an example of a new YAML style this patch allows:

  - Name:  foo
    Other: [ 0x4 ]
  - Name:  bar
    Other: [ STV_PROTECTED, 4 ]
  - Name:  zed
    Other: [ STV_PROTECTED, STO_MIPS_OPTIONAL, 0xf8 ]




https://reviews.llvm.org/D66886

Files:
  include/llvm/ObjectYAML/ELFYAML.h
  include/llvm/Support/YAMLTraits.h
  lib/ObjectYAML/ELFEmitter.cpp
  lib/ObjectYAML/ELFYAML.cpp
  lib/Support/YAMLTraits.cpp
  test/tools/llvm-objcopy/ELF/localize-hidden.test
  test/tools/llvm-objcopy/ELF/symbol-copy.test
  test/tools/llvm-objdump/elf-symbol-visibility.test
  test/tools/llvm-readobj/elf-symbol-visibility.test
  test/tools/obj2yaml/elf-symbol-visibility.yaml
  test/tools/yaml2obj/elf-symbol-stother.yaml
  test/tools/yaml2obj/elf-symbol-visibility.yaml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66886.217655.patch
Type: text/x-patch
Size: 20569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190828/3a7be66b/attachment.bin>


More information about the llvm-commits mailing list