[PATCH] [yaml2obj] ELF Relocations Support
Simon Atanasyan
simon at atanasyan.com
Thu Apr 10 07:04:06 PDT 2014
I still think that a user should specify a section type explicitly. One more argument is an error diagnostics. If a user explicitly defines a section type but forget some mandatory fields we can show a clear error message. If we need to deduce a section type and a user missed some fields, we have to show unclear "Unknown section type" error message. Try to quickly find why the section `.stub` has unknown type in the example below:
```
Sections:
- Name: .text
Type: SHT_PROGBITS
Content: "0000000000000000"
AddressAlign: 16
Flags: [SHF_ALLOC]
- Name: .stub
Type: SHT_PROGBITS
AddressAlign: 16
Flags: [SHF_ALLOC]
- Name: .eh_frame
Type: SHT_PROGBITS
Content: "0000000000000000"
AddressAlign: 16
Flags: [SHF_ALLOC]
```
So I suggest one more solution. Let's recognize a type of section using `Type` field. A section with `SHT_REL` or `SHT_RELA` type is a relocation section, otherwise it is a raw content section. If or when we have more section types we will be able to invent another solution. The only shortcoming of such approach is impossibility to define a relocation section with arbitrary (for example invalid) content but I think it is a minor problem.
Hi silvas, Bigcheese, shankarke,
http://reviews.llvm.org/D3302
CHANGE SINCE LAST DIFF
http://reviews.llvm.org/D3302?vs=8440&id=8461#toc
Files:
include/llvm/Object/ELFYAML.h
lib/Object/ELFYAML.cpp
test/Object/yaml2obj-elf-rel.yaml
tools/yaml2obj/yaml2elf.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3302.4.patch
Type: text/x-patch
Size: 21730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140410/308a05e2/attachment.bin>
More information about the llvm-commits
mailing list