Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static bool
- elf_i386_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
- Elf_Internal_Shdr *hdr,
- asection *sec)
- {
- const char *name;
- name = bfd_section_name (sec);
- /* This is an ugly, but unfortunately necessary hack that is
- needed when producing EFI binaries on x86. It tells
- elf.c:elf_fake_sections() not to consider ".reloc" as a section
- containing ELF relocation info. We need this hack in order to
- be able to generate ELF binaries that can be translated into
- EFI applications (which are essentially COFF objects). Those
- files contain a COFF ".reloc" section inside an ELFNN object,
- which would normally cause BFD to segfault because it would
- attempt to interpret this section as containing relocation
- entries for section "oc". With this hack enabled, ".reloc"
- will be treated as a normal data section, which will avoid the
- segfault. However, you won't be able to create an ELFNN binary
- with a section named "oc" that needs relocations, but that's
- the kind of ugly side-effects you get when detecting section
- types based on their names... In practice, this limitation is
- unlikely to bite. */
- if (strcmp (name, ".reloc") == 0)
- hdr->sh_type = SHT_PROGBITS;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement