Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdlib.h>
- #undef FALSE
- #undef TRUE
- #define FALSE 0
- #define TRUE 1
- #define BFD_HOST_U_64_BIT unsigned long
- typedef BFD_HOST_U_64_BIT bfd_vma;
- typedef int bfd_boolean;
- typedef unsigned int flagword; /* 32 bits of flags */
- struct bfd {};
- typedef struct bfd bfd;
- struct elf_internal_sym {
- unsigned int st_shndx; /* Associated section index */
- };
- typedef struct elf_internal_sym Elf_Internal_Sym;
- typedef struct
- {
- /* ELF symbol information. */
- Elf_Internal_Sym internal_elf_sym;
- } elf_symbol_type;
- typedef struct bfd_section
- {
- /* If this section is going to be output, then this value is the
- offset in *bytes* into the output section of the first byte in the
- input section (byte ==> smallest addressable unit on the
- target). In most cases, if this was going to start at the
- 100th octet (8-bit quantity) in the output section, this value
- would be 100. However, if the target byte size is 16 bits
- (bfd_octets_per_byte is "2"), this value would be 50. */
- bfd_vma output_offset;
- /* The output section through which to map on output. */
- struct bfd_section *output_section;
- /* The BFD which owns the section. */
- bfd *owner;
- } asection;
- typedef struct bfd_symbol
- {
- /* This symbol was created to point to a section, e.g. ELF's
- STT_SECTION symbols. */
- #define BSF_SECTION_SYM (1 << 8)
- struct bfd_section *section;
- flagword flags;
- }
- asymbol;
- extern asection _bfd_std_section[4];
- #define bfd_abs_section_ptr (&_bfd_std_section[2])
- static inline bfd_boolean
- bfd_is_abs_section (const asection *sec)
- {
- return sec == bfd_abs_section_ptr;
- }
- static bfd_boolean
- ignore_section_sym (bfd *abfd, asymbol *sym)
- {
- elf_symbol_type *type_ptr;
- // this is part of fix
- if (sym == NULL)
- return FALSE;
- if ((sym->flags & BSF_SECTION_SYM) == 0)
- return FALSE;
- // this is part of fix
- if (sym->section == NULL)
- return TRUE;
- // replace actual function call with malloc for testing purpose
- type_ptr = malloc(sizeof(elf_symbol_type));
- return ((type_ptr != NULL
- && type_ptr->internal_elf_sym.st_shndx != 0
- && bfd_is_abs_section (sym->section))
- || !(sym->section->owner == abfd
- // this is part of fix
- || (sym->section->output_section != NULL
- && sym->section->output_section->owner == abfd
- && sym->section->output_offset == 0)
- || bfd_is_abs_section (sym->section)));
- }
- int main(){}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement