1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/tools/yaml2obj
Simon Atanasyan 808d7bc7a0 [yaml2obj][ELF] Add an optional Size field to the YAML section declaration.
Now the only method to configure ELF section's content and size is to assign
a hexadecimal string to the `Content` field. Unfortunately this way is
completely useless when you need to declare a really large section.

To solve this problem this patch adds one more optional field `Size`
to the `RawContentSection` structure. When yaml2obj generates an ELF file
it uses the following algorithm:
1. If both `Content` and `Size` fields are missed create an empty section.
2. If only `Content` field is missed take section length from the `Size`
   field and fill the section by zero.
3. If only `Size` field is missed create a section using data from
   the `Content` field.
4. If both `Content` and `Size` fields are provided validate that the `Size`
   value is not less than size of `Content` data. Than take section length
   from the `Size`, fill beginning of the section by `Content` and the rest
   by zero.

Examples
--------
* Create a section 0x10000 bytes long filled by zero
  Name: .data
  Type: SHT_PROGBITS
  Flags: [ SHF_ALLOC ]
  Size: 0x10000

* Create a section 0x10000 bytes long starting from 'CA' 'FE' 'BA' 'BE'
  Name: .data
  Type: SHT_PROGBITS
  Flags: [ SHF_ALLOC ]
  Content: CAFEBABE
  Size: 0x10000

The patch reviewed by Michael Spencer.

llvm-svn: 208995
2014-05-16 16:01:00 +00:00
..
CMakeLists.txt llvm/tools: Prune redundant target_link_libraries. 2014-01-31 17:40:06 +00:00
Makefile Fix the configure build. 2013-05-17 23:20:58 +00:00
yaml2coff.cpp Object: Provide a richer means of describing auxiliary symbols 2014-03-19 04:47:47 +00:00
yaml2elf.cpp [yaml2obj][ELF] Add an optional Size field to the YAML section declaration. 2014-05-16 16:01:00 +00:00
yaml2obj.cpp [yaml2obj] Add "-o" command line option to specify an output file name. 2014-05-15 16:14:02 +00:00
yaml2obj.h [yaml2obj] Initial ELF support. 2013-06-10 23:44:15 +00:00