1 /* Intel 80386/80486 QNX specific support for 32-bit ELF
3 Free Software Foundation, Inc.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21 #define ELF32_I386_C_INCLUDED
22 #include "elf32-i386.c"
24 /* Returns the end address of the segment + 1. */
25 #define SEGMENT_END(segment, start) \
26 (start + (segment->p_memsz > segment->p_filesz \
27 ? segment->p_memsz : segment->p_filesz))
29 static boolean elf_i386qnx_copy_private_bfd_data_p
30 PARAMS ((bfd
*, asection
*, bfd
*, asection
*));
31 static boolean elf_i386qnx_is_contained_by_filepos
32 PARAMS ((asection
*, Elf_Internal_Phdr
*));
33 static void elf_i386qnx_set_nonloadable_filepos
34 PARAMS ((bfd
*, Elf_Internal_Phdr
*));
37 elf_i386qnx_copy_private_bfd_data_p (ibfd
, isec
, obfd
, osec
)
43 /* We don't use these parameters, but another target might. */
47 return isec
->next
== NULL
;
51 elf_i386qnx_is_contained_by_filepos (section
, segment
)
53 Elf_Internal_Phdr
*segment
;
55 return ((bfd_vma
) section
->filepos
>= segment
->p_offset
56 && ((bfd_vma
) section
->filepos
+ section
->_raw_size
57 <= SEGMENT_END (segment
, segment
->p_offset
)));
61 elf_i386qnx_set_nonloadable_filepos (abfd
, phdrs
)
63 Elf_Internal_Phdr
*phdrs
;
65 struct elf_segment_map
*m
;
69 for (m
= elf_tdata (abfd
)->segment_map
, p
= phdrs
;
76 for (i
= 0, secpp
= m
->sections
; i
< m
->count
; i
++, secpp
++)
82 if (p
->p_type
== PT_LOAD
)
89 p
->p_offset
= sec
->filepos
;
95 off
+= sec
->_raw_size
;
96 p
->p_filesz
+= sec
->_raw_size
;
104 #undef TARGET_LITTLE_SYM
105 #define TARGET_LITTLE_SYM bfd_elf32_i386qnx_vec
107 #define elf_backend_set_nonloadable_filepos elf_i386qnx_set_nonloadable_filepos
108 #define elf_backend_is_contained_by_filepos elf_i386qnx_is_contained_by_filepos
109 #define elf_backend_copy_private_bfd_data_p elf_i386qnx_copy_private_bfd_data_p
111 #include "elf32-target.h"