elfxx-mips.c (179405) | elfxx-mips.c (208737) |
---|---|
1/* MIPS-specific support for ELF 2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | 1/* MIPS-specific support for ELF 2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
3 2003 Free Software Foundation, Inc. | 3 2003, 2004, 2005, 2006 Free Software Foundation, Inc. |
4 5 Most of the information added by Ian Lance Taylor, Cygnus Support, 6 <ian@cygnus.com>. 7 N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC. 8 <mark@codesourcery.com> 9 Traditional MIPS targets support added by Koundinya.K, Dansk Data 10 Elektronik & Operations Research Group. <kk@ddeorg.soft.net> 11 --- 6 unchanged lines hidden (view full) --- 18 19 This program is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 GNU General Public License for more details. 23 24 You should have received a copy of the GNU General Public License 25 along with this program; if not, write to the Free Software | 4 5 Most of the information added by Ian Lance Taylor, Cygnus Support, 6 <ian@cygnus.com>. 7 N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC. 8 <mark@codesourcery.com> 9 Traditional MIPS targets support added by Koundinya.K, Dansk Data 10 Elektronik & Operations Research Group. <kk@ddeorg.soft.net> 11 --- 6 unchanged lines hidden (view full) --- 18 19 This program is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 GNU General Public License for more details. 23 24 You should have received a copy of the GNU General Public License 25 along with this program; if not, write to the Free Software |
26 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 26 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ |
27 28/* This file handles functionality common to the different MIPS ABI's. */ 29 30#include "bfd.h" 31#include "sysdep.h" 32#include "libbfd.h" 33#include "libiberty.h" 34#include "elf-bfd.h" --- 4048 unchanged lines hidden (view full) --- 4083 return bfd_mach_mips4650; 4084 4085 case E_MIPS_MACH_5400: 4086 return bfd_mach_mips5400; 4087 4088 case E_MIPS_MACH_5500: 4089 return bfd_mach_mips5500; 4090 | 27 28/* This file handles functionality common to the different MIPS ABI's. */ 29 30#include "bfd.h" 31#include "sysdep.h" 32#include "libbfd.h" 33#include "libiberty.h" 34#include "elf-bfd.h" --- 4048 unchanged lines hidden (view full) --- 4083 return bfd_mach_mips4650; 4084 4085 case E_MIPS_MACH_5400: 4086 return bfd_mach_mips5400; 4087 4088 case E_MIPS_MACH_5500: 4089 return bfd_mach_mips5500; 4090 |
4091 case E_MIPS_MACH_9000: 4092 return bfd_mach_mips9000; 4093 4094 case E_MIPS_MACH_OCTEON: 4095 return bfd_mach_mips_octeon; 4096 |
|
4091 case E_MIPS_MACH_SB1: 4092 return bfd_mach_mips_sb1; 4093 4094 default: 4095 switch (flags & EF_MIPS_ARCH) 4096 { 4097 default: 4098 case E_MIPS_ARCH_1: --- 3038 unchanged lines hidden (view full) --- 7137 case bfd_mach_mips5400: 7138 val = E_MIPS_ARCH_4 | E_MIPS_MACH_5400; 7139 break; 7140 7141 case bfd_mach_mips5500: 7142 val = E_MIPS_ARCH_4 | E_MIPS_MACH_5500; 7143 break; 7144 | 4097 case E_MIPS_MACH_SB1: 4098 return bfd_mach_mips_sb1; 4099 4100 default: 4101 switch (flags & EF_MIPS_ARCH) 4102 { 4103 default: 4104 case E_MIPS_ARCH_1: --- 3038 unchanged lines hidden (view full) --- 7143 case bfd_mach_mips5400: 7144 val = E_MIPS_ARCH_4 | E_MIPS_MACH_5400; 7145 break; 7146 7147 case bfd_mach_mips5500: 7148 val = E_MIPS_ARCH_4 | E_MIPS_MACH_5500; 7149 break; 7150 |
7151 case bfd_mach_mips9000: 7152 val = E_MIPS_ARCH_4 | E_MIPS_MACH_9000; 7153 break; 7154 |
|
7145 case bfd_mach_mips5000: 7146 case bfd_mach_mips7000: 7147 case bfd_mach_mips8000: 7148 case bfd_mach_mips10000: 7149 case bfd_mach_mips12000: 7150 val = E_MIPS_ARCH_4; 7151 break; 7152 7153 case bfd_mach_mips5: 7154 val = E_MIPS_ARCH_5; 7155 break; 7156 | 7155 case bfd_mach_mips5000: 7156 case bfd_mach_mips7000: 7157 case bfd_mach_mips8000: 7158 case bfd_mach_mips10000: 7159 case bfd_mach_mips12000: 7160 val = E_MIPS_ARCH_4; 7161 break; 7162 7163 case bfd_mach_mips5: 7164 val = E_MIPS_ARCH_5; 7165 break; 7166 |
7167 case bfd_mach_mips_octeon: 7168 val = E_MIPS_ARCH_64R2 | E_MIPS_MACH_OCTEON; 7169 break; 7170 |
|
7157 case bfd_mach_mips_sb1: 7158 val = E_MIPS_ARCH_64 | E_MIPS_MACH_SB1; 7159 break; 7160 7161 case bfd_mach_mipsisa32: 7162 val = E_MIPS_ARCH_32; 7163 break; 7164 --- 1686 unchanged lines hidden (view full) --- 8851 unsigned long extension, base; 8852}; 8853 8854 8855/* An array describing how BFD machines relate to one another. The entries 8856 are ordered topologically with MIPS I extensions listed last. */ 8857 8858static const struct mips_mach_extension mips_mach_extensions[] = { | 7171 case bfd_mach_mips_sb1: 7172 val = E_MIPS_ARCH_64 | E_MIPS_MACH_SB1; 7173 break; 7174 7175 case bfd_mach_mipsisa32: 7176 val = E_MIPS_ARCH_32; 7177 break; 7178 --- 1686 unchanged lines hidden (view full) --- 8865 unsigned long extension, base; 8866}; 8867 8868 8869/* An array describing how BFD machines relate to one another. The entries 8870 are ordered topologically with MIPS I extensions listed last. */ 8871 8872static const struct mips_mach_extension mips_mach_extensions[] = { |
8873 /* MIPS64r2 extensions. */ 8874 { bfd_mach_mips_octeon, bfd_mach_mipsisa64r2 }, 8875 |
|
8859 /* MIPS64 extensions. */ 8860 { bfd_mach_mipsisa64r2, bfd_mach_mipsisa64 }, 8861 { bfd_mach_mips_sb1, bfd_mach_mipsisa64 }, 8862 8863 /* MIPS V extensions. */ 8864 { bfd_mach_mipsisa64, bfd_mach_mips5 }, 8865 8866 /* R10000 extensions. */ --- 7 unchanged lines hidden (view full) --- 8874 { bfd_mach_mips5500, bfd_mach_mips5400 }, 8875 { bfd_mach_mips5400, bfd_mach_mips5000 }, 8876 8877 /* MIPS IV extensions. */ 8878 { bfd_mach_mips5, bfd_mach_mips8000 }, 8879 { bfd_mach_mips10000, bfd_mach_mips8000 }, 8880 { bfd_mach_mips5000, bfd_mach_mips8000 }, 8881 { bfd_mach_mips7000, bfd_mach_mips8000 }, | 8876 /* MIPS64 extensions. */ 8877 { bfd_mach_mipsisa64r2, bfd_mach_mipsisa64 }, 8878 { bfd_mach_mips_sb1, bfd_mach_mipsisa64 }, 8879 8880 /* MIPS V extensions. */ 8881 { bfd_mach_mipsisa64, bfd_mach_mips5 }, 8882 8883 /* R10000 extensions. */ --- 7 unchanged lines hidden (view full) --- 8891 { bfd_mach_mips5500, bfd_mach_mips5400 }, 8892 { bfd_mach_mips5400, bfd_mach_mips5000 }, 8893 8894 /* MIPS IV extensions. */ 8895 { bfd_mach_mips5, bfd_mach_mips8000 }, 8896 { bfd_mach_mips10000, bfd_mach_mips8000 }, 8897 { bfd_mach_mips5000, bfd_mach_mips8000 }, 8898 { bfd_mach_mips7000, bfd_mach_mips8000 }, |
8899 { bfd_mach_mips9000, bfd_mach_mips8000 }, |
|
8882 8883 /* VR4100 extensions. */ 8884 { bfd_mach_mips4120, bfd_mach_mips4100 }, 8885 { bfd_mach_mips4111, bfd_mach_mips4100 }, 8886 8887 /* MIPS III extensions. */ 8888 { bfd_mach_mips8000, bfd_mach_mips4000 }, 8889 { bfd_mach_mips4650, bfd_mach_mips4000 }, --- 18 unchanged lines hidden (view full) --- 8908 8909/* Return true if bfd machine EXTENSION is an extension of machine BASE. */ 8910 8911static bfd_boolean 8912mips_mach_extends_p (unsigned long base, unsigned long extension) 8913{ 8914 size_t i; 8915 | 8900 8901 /* VR4100 extensions. */ 8902 { bfd_mach_mips4120, bfd_mach_mips4100 }, 8903 { bfd_mach_mips4111, bfd_mach_mips4100 }, 8904 8905 /* MIPS III extensions. */ 8906 { bfd_mach_mips8000, bfd_mach_mips4000 }, 8907 { bfd_mach_mips4650, bfd_mach_mips4000 }, --- 18 unchanged lines hidden (view full) --- 8926 8927/* Return true if bfd machine EXTENSION is an extension of machine BASE. */ 8928 8929static bfd_boolean 8930mips_mach_extends_p (unsigned long base, unsigned long extension) 8931{ 8932 size_t i; 8933 |
8916 for (i = 0; extension != base && i < ARRAY_SIZE (mips_mach_extensions); i++) | 8934 if (extension == base) 8935 return TRUE; 8936 8937 if (base == bfd_mach_mipsisa32 8938 && mips_mach_extends_p (bfd_mach_mipsisa64, extension)) 8939 return TRUE; 8940 8941 if (base == bfd_mach_mipsisa32r2 8942 && mips_mach_extends_p (bfd_mach_mipsisa64r2, extension)) 8943 return TRUE; 8944 8945 for (i = 0; i < ARRAY_SIZE (mips_mach_extensions); i++) |
8917 if (extension == mips_mach_extensions[i].extension) | 8946 if (extension == mips_mach_extensions[i].extension) |
8918 extension = mips_mach_extensions[i].base; | 8947 { 8948 extension = mips_mach_extensions[i].base; 8949 if (extension == base) 8950 return TRUE; 8951 } |
8919 | 8952 |
8920 return extension == base; | 8953 return FALSE; |
8921} 8922 8923 8924/* Return true if the given ELF header flags describe a 32-bit binary. */ 8925 8926static bfd_boolean 8927mips_32bit_flags_p (flagword flags) 8928{ --- 306 unchanged lines hidden --- | 8954} 8955 8956 8957/* Return true if the given ELF header flags describe a 32-bit binary. */ 8958 8959static bfd_boolean 8960mips_32bit_flags_p (flagword flags) 8961{ --- 306 unchanged lines hidden --- |