1 diff -Nrup a/extra/Configs/Config.avr32 b/extra/Configs/Config.avr32
2 --- a/extra/Configs/Config.avr32 1969-12-31 19:00:00.000000000 -0500
3 +++ b/extra/Configs/Config.avr32 2008-02-28 19:02:10.000000000 -0500
6 +# For a description of the syntax of this configuration file,
7 +# see extra/config/Kconfig-language.txt
26 +config ARCH_SUPPORTS_BIG_ENDIAN
30 +config UCLIBC_COMPLETELY_PIC
31 + select FORCE_SHAREABLE_TEXT_SEGMENTS
36 + prompt "Target CPU Type"
37 + default CONFIG_AP7000
45 + bool "Enable linker optimizations"
47 diff -Nrup a/extra/Configs/Config.in b/extra/Configs/Config.in
48 --- a/extra/Configs/Config.in 2007-01-25 19:01:55.000000000 -0500
49 +++ b/extra/Configs/Config.in 2008-02-28 19:02:10.000000000 -0500
50 @@ -16,6 +16,9 @@ config TARGET_alpha
60 @@ -83,6 +86,10 @@ if TARGET_arm
61 source "extra/Configs/Config.arm"
65 +source "extra/Configs/Config.avr32"
69 source "extra/Configs/Config.bfin"
71 diff -Nrup a/include/elf.h b/include/elf.h
72 --- a/include/elf.h 2007-01-25 19:22:03.000000000 -0500
73 +++ b/include/elf.h 2008-02-28 19:02:10.000000000 -0500
74 @@ -305,6 +305,8 @@ typedef struct
75 /* D30V backend magic number. Written in the absence of an ABI. */
76 #define EM_CYGNUS_D30V 0x7676
78 +#define EM_AVR32 0x18ad
80 /* V850 backend magic number. Written in the absense of an ABI. */
81 #define EM_CYGNUS_V850 0x9080
83 @@ -2751,6 +2753,55 @@ typedef Elf32_Addr Elf32_Conflict;
84 /* Keep this the last entry. */
87 +/* Atmel AVR32 relocations. */
88 +#define R_AVR32_NONE 0
92 +#define R_AVR32_32_PCREL 4
93 +#define R_AVR32_16_PCREL 5
94 +#define R_AVR32_8_PCREL 6
95 +#define R_AVR32_DIFF32 7
96 +#define R_AVR32_DIFF16 8
97 +#define R_AVR32_DIFF8 9
98 +#define R_AVR32_GOT32 10
99 +#define R_AVR32_GOT16 11
100 +#define R_AVR32_GOT8 12
101 +#define R_AVR32_21S 13
102 +#define R_AVR32_16U 14
103 +#define R_AVR32_16S 15
104 +#define R_AVR32_8S 16
105 +#define R_AVR32_8S_EXT 17
106 +#define R_AVR32_22H_PCREL 18
107 +#define R_AVR32_18W_PCREL 19
108 +#define R_AVR32_16B_PCREL 20
109 +#define R_AVR32_16N_PCREL 21
110 +#define R_AVR32_14UW_PCREL 22
111 +#define R_AVR32_11H_PCREL 23
112 +#define R_AVR32_10UW_PCREL 24
113 +#define R_AVR32_9H_PCREL 25
114 +#define R_AVR32_9UW_PCREL 26
115 +#define R_AVR32_HI16 27
116 +#define R_AVR32_LO16 28
117 +#define R_AVR32_GOTPC 29
118 +#define R_AVR32_GOTCALL 30
119 +#define R_AVR32_LDA_GOT 31
120 +#define R_AVR32_GOT21S 32
121 +#define R_AVR32_GOT18SW 33
122 +#define R_AVR32_GOT16S 34
123 +#define R_AVR32_GOT7UW 35
124 +#define R_AVR32_32_CPENT 36
125 +#define R_AVR32_CPCALL 37
126 +#define R_AVR32_16_CP 38
127 +#define R_AVR32_9W_CP 39
128 +#define R_AVR32_RELATIVE 40
129 +#define R_AVR32_GLOB_DAT 41
130 +#define R_AVR32_JMP_SLOT 42
131 +#define R_AVR32_ALIGN 43
132 +#define R_AVR32_NUM 44
134 +/* AVR32 dynamic tags */
135 +#define DT_AVR32_GOTSZ 0x70000001 /* Total size of GOT in bytes */
137 /* v850 relocations. */
138 #define R_V850_NONE 0
139 diff -Nrup a/include/elf.h.orig b/include/elf.h.orig
140 --- a/include/elf.h.orig 1969-12-31 19:00:00.000000000 -0500
141 +++ b/include/elf.h.orig 2007-01-25 19:22:03.000000000 -0500
143 +/* This file defines standard ELF types, structures, and macros.
144 + Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc.
145 + This file is part of the GNU C Library.
147 + The GNU C Library is free software; you can redistribute it and/or
148 + modify it under the terms of the GNU Lesser General Public
149 + License as published by the Free Software Foundation; either
150 + version 2.1 of the License, or (at your option) any later version.
152 + The GNU C Library is distributed in the hope that it will be useful,
153 + but WITHOUT ANY WARRANTY; without even the implied warranty of
154 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
155 + Lesser General Public License for more details.
157 + You should have received a copy of the GNU Lesser General Public
158 + License along with the GNU C Library; if not, write to the Free
159 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
165 +#include <features.h>
169 +/* Standard ELF types. */
173 +/* Type for a 16-bit quantity. */
174 +typedef uint16_t Elf32_Half;
175 +typedef uint16_t Elf64_Half;
177 +/* Types for signed and unsigned 32-bit quantities. */
178 +typedef uint32_t Elf32_Word;
179 +typedef int32_t Elf32_Sword;
180 +typedef uint32_t Elf64_Word;
181 +typedef int32_t Elf64_Sword;
183 +/* Types for signed and unsigned 64-bit quantities. */
184 +typedef uint64_t Elf32_Xword;
185 +typedef int64_t Elf32_Sxword;
186 +typedef uint64_t Elf64_Xword;
187 +typedef int64_t Elf64_Sxword;
189 +/* Type of addresses. */
190 +typedef uint32_t Elf32_Addr;
191 +typedef uint64_t Elf64_Addr;
193 +/* Type of file offsets. */
194 +typedef uint32_t Elf32_Off;
195 +typedef uint64_t Elf64_Off;
197 +/* Type for section indices, which are 16-bit quantities. */
198 +typedef uint16_t Elf32_Section;
199 +typedef uint16_t Elf64_Section;
201 +/* Type for version symbol information. */
202 +typedef Elf32_Half Elf32_Versym;
203 +typedef Elf64_Half Elf64_Versym;
206 +/* The ELF file header. This appears at the start of every ELF file. */
208 +#define EI_NIDENT (16)
212 + unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
213 + Elf32_Half e_type; /* Object file type */
214 + Elf32_Half e_machine; /* Architecture */
215 + Elf32_Word e_version; /* Object file version */
216 + Elf32_Addr e_entry; /* Entry point virtual address */
217 + Elf32_Off e_phoff; /* Program header table file offset */
218 + Elf32_Off e_shoff; /* Section header table file offset */
219 + Elf32_Word e_flags; /* Processor-specific flags */
220 + Elf32_Half e_ehsize; /* ELF header size in bytes */
221 + Elf32_Half e_phentsize; /* Program header table entry size */
222 + Elf32_Half e_phnum; /* Program header table entry count */
223 + Elf32_Half e_shentsize; /* Section header table entry size */
224 + Elf32_Half e_shnum; /* Section header table entry count */
225 + Elf32_Half e_shstrndx; /* Section header string table index */
230 + unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
231 + Elf64_Half e_type; /* Object file type */
232 + Elf64_Half e_machine; /* Architecture */
233 + Elf64_Word e_version; /* Object file version */
234 + Elf64_Addr e_entry; /* Entry point virtual address */
235 + Elf64_Off e_phoff; /* Program header table file offset */
236 + Elf64_Off e_shoff; /* Section header table file offset */
237 + Elf64_Word e_flags; /* Processor-specific flags */
238 + Elf64_Half e_ehsize; /* ELF header size in bytes */
239 + Elf64_Half e_phentsize; /* Program header table entry size */
240 + Elf64_Half e_phnum; /* Program header table entry count */
241 + Elf64_Half e_shentsize; /* Section header table entry size */
242 + Elf64_Half e_shnum; /* Section header table entry count */
243 + Elf64_Half e_shstrndx; /* Section header string table index */
246 +/* Fields in the e_ident array. The EI_* macros are indices into the
247 + array. The macros under each EI_* macro are the values the byte
250 +#define EI_MAG0 0 /* File identification byte 0 index */
251 +#define ELFMAG0 0x7f /* Magic number byte 0 */
253 +#define EI_MAG1 1 /* File identification byte 1 index */
254 +#define ELFMAG1 'E' /* Magic number byte 1 */
256 +#define EI_MAG2 2 /* File identification byte 2 index */
257 +#define ELFMAG2 'L' /* Magic number byte 2 */
259 +#define EI_MAG3 3 /* File identification byte 3 index */
260 +#define ELFMAG3 'F' /* Magic number byte 3 */
262 +/* Conglomeration of the identification bytes, for easy testing as a word. */
263 +#define ELFMAG "\177ELF"
266 +#define EI_CLASS 4 /* File class byte index */
267 +#define ELFCLASSNONE 0 /* Invalid class */
268 +#define ELFCLASS32 1 /* 32-bit objects */
269 +#define ELFCLASS64 2 /* 64-bit objects */
270 +#define ELFCLASSNUM 3
272 +#define EI_DATA 5 /* Data encoding byte index */
273 +#define ELFDATANONE 0 /* Invalid data encoding */
274 +#define ELFDATA2LSB 1 /* 2's complement, little endian */
275 +#define ELFDATA2MSB 2 /* 2's complement, big endian */
276 +#define ELFDATANUM 3
278 +#define EI_VERSION 6 /* File version byte index */
279 + /* Value must be EV_CURRENT */
281 +#define EI_OSABI 7 /* OS ABI identification */
282 +#define ELFOSABI_NONE 0 /* UNIX System V ABI */
283 +#define ELFOSABI_SYSV 0 /* Alias. */
284 +#define ELFOSABI_HPUX 1 /* HP-UX */
285 +#define ELFOSABI_NETBSD 2 /* NetBSD. */
286 +#define ELFOSABI_LINUX 3 /* Linux. */
287 +#define ELFOSABI_HURD 4 /* GNU/Hurd */
288 +#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */
289 +#define ELFOSABI_AIX 7 /* IBM AIX. */
290 +#define ELFOSABI_IRIX 8 /* SGI Irix. */
291 +#define ELFOSABI_FREEBSD 9 /* FreeBSD. */
292 +#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */
293 +#define ELFOSABI_MODESTO 11 /* Novell Modesto. */
294 +#define ELFOSABI_OPENBSD 12 /* OpenBSD. */
295 +#define ELFOSABI_OPENVMS 13 /* OpenVMS */
296 +#define ELFOSABI_NSK 14 /* Hewlett-Packard Non-Stop Kernel */
297 +#define ELFOSABI_AROS 15 /* Amiga Research OS */
298 +#define ELFOSABI_ARM 97 /* ARM */
299 +#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
301 +#define EI_ABIVERSION 8 /* ABI version */
303 +#define EI_PAD 9 /* Byte index of padding bytes */
305 +/* Legal values for e_type (object file type). */
307 +#define ET_NONE 0 /* No file type */
308 +#define ET_REL 1 /* Relocatable file */
309 +#define ET_EXEC 2 /* Executable file */
310 +#define ET_DYN 3 /* Shared object file */
311 +#define ET_CORE 4 /* Core file */
312 +#define ET_NUM 5 /* Number of defined types */
313 +#define ET_LOOS 0xfe00 /* OS-specific range start */
314 +#define ET_HIOS 0xfeff /* OS-specific range end */
315 +#define ET_LOPROC 0xff00 /* Processor-specific range start */
316 +#define ET_HIPROC 0xffff /* Processor-specific range end */
318 +/* Legal values for e_machine (architecture). */
320 +#define EM_NONE 0 /* No machine */
321 +#define EM_M32 1 /* AT&T WE 32100 */
322 +#define EM_SPARC 2 /* SUN SPARC */
323 +#define EM_386 3 /* Intel 80386 */
324 +#define EM_68K 4 /* Motorola m68k family */
325 +#define EM_88K 5 /* Motorola m88k family */
326 +#define EM_486 6 /* Intel 80486 *//* Reserved for future use */
327 +#define EM_860 7 /* Intel 80860 */
328 +#define EM_MIPS 8 /* MIPS R3000 big-endian */
329 +#define EM_S370 9 /* IBM System/370 */
330 +#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
332 +#define EM_PARISC 15 /* HPPA */
333 +#define EM_VPP500 17 /* Fujitsu VPP500 */
334 +#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
335 +#define EM_960 19 /* Intel 80960 */
336 +#define EM_PPC 20 /* PowerPC */
337 +#define EM_PPC64 21 /* PowerPC 64-bit */
338 +#define EM_S390 22 /* IBM S390 */
340 +#define EM_V800 36 /* NEC V800 series */
341 +#define EM_FR20 37 /* Fujitsu FR20 */
342 +#define EM_RH32 38 /* TRW RH-32 */
343 +#define EM_MCORE 39 /* Motorola M*Core */ /* May also be taken by Fujitsu MMA */
344 +#define EM_RCE 39 /* Old name for MCore */
345 +#define EM_ARM 40 /* ARM */
346 +#define EM_FAKE_ALPHA 41 /* Digital Alpha */
347 +#define EM_SH 42 /* Renesas SH */
348 +#define EM_SPARCV9 43 /* SPARC v9 64-bit */
349 +#define EM_TRICORE 44 /* Siemens Tricore */
350 +#define EM_ARC 45 /* Argonaut RISC Core */
351 +#define EM_H8_300 46 /* Renesas H8/300 */
352 +#define EM_H8_300H 47 /* Renesas H8/300H */
353 +#define EM_H8S 48 /* Renesas H8S */
354 +#define EM_H8_500 49 /* Renesas H8/500 */
355 +#define EM_IA_64 50 /* Intel Merced */
356 +#define EM_MIPS_X 51 /* Stanford MIPS-X */
357 +#define EM_COLDFIRE 52 /* Motorola Coldfire */
358 +#define EM_68HC12 53 /* Motorola M68HC12 */
359 +#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/
360 +#define EM_PCP 55 /* Siemens PCP */
361 +#define EM_NCPU 56 /* Sony nCPU embeeded RISC */
362 +#define EM_NDR1 57 /* Denso NDR1 microprocessor */
363 +#define EM_STARCORE 58 /* Motorola Start*Core processor */
364 +#define EM_ME16 59 /* Toyota ME16 processor */
365 +#define EM_ST100 60 /* STMicroelectronic ST100 processor */
366 +#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/
367 +#define EM_X86_64 62 /* AMD x86-64 architecture */
368 +#define EM_PDSP 63 /* Sony DSP Processor */
370 +#define EM_FX66 66 /* Siemens FX66 microcontroller */
371 +#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */
372 +#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */
373 +#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */
374 +#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */
375 +#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */
376 +#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */
377 +#define EM_SVX 73 /* Silicon Graphics SVx */
378 +#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */
379 +#define EM_VAX 75 /* Digital VAX */
380 +#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
381 +#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */
382 +#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */
383 +#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */
384 +#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */
385 +#define EM_HUANY 81 /* Harvard University machine-independent object files */
386 +#define EM_PRISM 82 /* SiTera Prism */
387 +#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
388 +#define EM_FR30 84 /* Fujitsu FR30 */
389 +#define EM_D10V 85 /* Mitsubishi D10V */
390 +#define EM_D30V 86 /* Mitsubishi D30V */
391 +#define EM_V850 87 /* NEC v850 */
392 +#define EM_M32R 88 /* Renesas M32R */
393 +#define EM_MN10300 89 /* Matsushita MN10300 */
394 +#define EM_MN10200 90 /* Matsushita MN10200 */
395 +#define EM_PJ 91 /* picoJava */
396 +#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
397 +#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
398 +#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
399 +#define EM_IP2K 101 /* Ubicom IP2022 micro controller */
400 +#define EM_CR 103 /* National Semiconductor CompactRISC */
401 +#define EM_MSP430 105 /* TI msp430 micro controller */
402 +#define EM_BLACKFIN 106 /* Analog Devices Blackfin */
403 +#define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */
404 +#define EM_CRX 114 /* National Semiconductor CRX */
407 +/* If it is necessary to assign new unofficial EM_* values, please pick large
408 + random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
409 + with official or non-GNU unofficial values.
411 + NOTE: Do not just increment the most recent number by one.
412 + Somebody else somewhere will do exactly the same thing, and you
413 + will have a collision. Instead, pick a random number.
415 + Normally, each entity or maintainer responsible for a machine with an
416 + unofficial e_machine number should eventually ask registry@caldera.com for
417 + an officially blessed number to be added to the list above. */
420 +#define EM_PJ_OLD 99
422 +/* Cygnus PowerPC ELF backend. Written in the absence of an ABI. */
423 +#define EM_CYGNUS_POWERPC 0x9025
425 +/* Old version of Sparc v9, from before the ABI; this should be
426 + removed shortly. */
427 +#define EM_OLD_SPARCV9 11
429 +/* Old version of PowerPC, this should be removed shortly. */
430 +#define EM_PPC_OLD 17
432 +/* (Deprecated) Temporary number for the OpenRISC processor. */
433 +#define EM_OR32 0x8472
435 +/* Renesas M32C and M16C. */
436 +#define EM_M32C 0xFEB0
438 +/* Cygnus M32R ELF backend. Written in the absence of an ABI. */
439 +#define EM_CYGNUS_M32R 0x9041
441 +/* old S/390 backend magic number. Written in the absence of an ABI. */
442 +#define EM_S390_OLD 0xa390
444 +/* D10V backend magic number. Written in the absence of an ABI. */
445 +#define EM_CYGNUS_D10V 0x7650
447 +/* D30V backend magic number. Written in the absence of an ABI. */
448 +#define EM_CYGNUS_D30V 0x7676
450 +/* V850 backend magic number. Written in the absense of an ABI. */
451 +#define EM_CYGNUS_V850 0x9080
453 +/* mn10200 and mn10300 backend magic numbers.
454 + Written in the absense of an ABI. */
455 +#define EM_CYGNUS_MN10200 0xdead
456 +#define EM_CYGNUS_MN10300 0xbeef
458 +/* FR30 magic number - no EABI available. */
459 +#define EM_CYGNUS_FR30 0x3330
462 + Written in the absense of an ABI. */
463 +#define EM_AVR_OLD 0x1057
465 +/* OpenRISC magic number
466 + Written in the absense of an ABI. */
467 +#define EM_OPENRISC_OLD 0x3426
470 + Written in the absense of an ABI. */
471 +#define EM_DLX 0x5aa5
473 +#define EM_XSTORMY16 0xad45
475 +/* FRV magic number - no EABI available??. */
476 +#define EM_CYGNUS_FRV 0x5441
478 +/* Ubicom IP2xxx; no ABI */
479 +#define EM_IP2K_OLD 0x8217
481 +#define EM_MT 0x2530 /* Morpho MT; no ABI */
483 +/* MSP430 magic number
484 + Written in the absense everything. */
485 +#define EM_MSP430_OLD 0x1059
487 +/* Vitesse IQ2000. */
488 +#define EM_IQ2000 0xFEBA
490 +/* Old, unofficial value for Xtensa. */
491 +#define EM_XTENSA_OLD 0xabc7
493 +/* Alpha backend magic number. Written in the absence of an ABI. */
494 +#define EM_ALPHA 0x9026
496 +/* NIOS magic number - no EABI available. */
497 +#define EM_NIOS32 0xFEBB
499 +/* V850 backend magic number. Written in the absense of an ABI. */
500 +#define EM_CYGNUS_V850 0x9080
502 +/* Legal values for e_version (version). */
504 +#define EV_NONE 0 /* Invalid ELF version */
505 +#define EV_CURRENT 1 /* Current version */
508 +/* Section header. */
512 + Elf32_Word sh_name; /* Section name (string tbl index) */
513 + Elf32_Word sh_type; /* Section type */
514 + Elf32_Word sh_flags; /* Section flags */
515 + Elf32_Addr sh_addr; /* Section virtual addr at execution */
516 + Elf32_Off sh_offset; /* Section file offset */
517 + Elf32_Word sh_size; /* Section size in bytes */
518 + Elf32_Word sh_link; /* Link to another section */
519 + Elf32_Word sh_info; /* Additional section information */
520 + Elf32_Word sh_addralign; /* Section alignment */
521 + Elf32_Word sh_entsize; /* Entry size if section holds table */
526 + Elf64_Word sh_name; /* Section name (string tbl index) */
527 + Elf64_Word sh_type; /* Section type */
528 + Elf64_Xword sh_flags; /* Section flags */
529 + Elf64_Addr sh_addr; /* Section virtual addr at execution */
530 + Elf64_Off sh_offset; /* Section file offset */
531 + Elf64_Xword sh_size; /* Section size in bytes */
532 + Elf64_Word sh_link; /* Link to another section */
533 + Elf64_Word sh_info; /* Additional section information */
534 + Elf64_Xword sh_addralign; /* Section alignment */
535 + Elf64_Xword sh_entsize; /* Entry size if section holds table */
538 +/* Special section indices. */
540 +#define SHN_UNDEF 0 /* Undefined section */
541 +#define SHN_LORESERVE 0xff00 /* Start of reserved indices */
542 +#define SHN_LOPROC 0xff00 /* Start of processor-specific */
543 +#define SHN_BEFORE 0xff00 /* Order section before all others
545 +#define SHN_AFTER 0xff01 /* Order section after all others
547 +#define SHN_HIPROC 0xff1f /* End of processor-specific */
548 +#define SHN_LOOS 0xff20 /* Start of OS-specific */
549 +#define SHN_HIOS 0xff3f /* End of OS-specific */
550 +#define SHN_ABS 0xfff1 /* Associated symbol is absolute */
551 +#define SHN_COMMON 0xfff2 /* Associated symbol is common */
552 +#define SHN_XINDEX 0xffff /* Index is in extra table. */
553 +#define SHN_HIRESERVE 0xffff /* End of reserved indices */
555 +/* Legal values for sh_type (section type). */
557 +#define SHT_NULL 0 /* Section header table entry unused */
558 +#define SHT_PROGBITS 1 /* Program data */
559 +#define SHT_SYMTAB 2 /* Symbol table */
560 +#define SHT_STRTAB 3 /* String table */
561 +#define SHT_RELA 4 /* Relocation entries with addends */
562 +#define SHT_HASH 5 /* Symbol hash table */
563 +#define SHT_DYNAMIC 6 /* Dynamic linking information */
564 +#define SHT_NOTE 7 /* Notes */
565 +#define SHT_NOBITS 8 /* Program space with no data (bss) */
566 +#define SHT_REL 9 /* Relocation entries, no addends */
567 +#define SHT_SHLIB 10 /* Reserved */
568 +#define SHT_DYNSYM 11 /* Dynamic linker symbol table */
569 +#define SHT_INIT_ARRAY 14 /* Array of constructors */
570 +#define SHT_FINI_ARRAY 15 /* Array of destructors */
571 +#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
572 +#define SHT_GROUP 17 /* Section group */
573 +#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */
574 +#define SHT_NUM 19 /* Number of defined types. */
575 +#define SHT_LOOS 0x60000000 /* Start OS-specific */
576 +#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */
577 +#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */
578 +#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */
579 +#define SHT_SUNW_move 0x6ffffffa
580 +#define SHT_SUNW_COMDAT 0x6ffffffb
581 +#define SHT_SUNW_syminfo 0x6ffffffc
582 +#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */
583 +#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */
584 +#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */
585 +#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */
586 +#define SHT_HIOS 0x6fffffff /* End OS-specific type */
587 +#define SHT_LOPROC 0x70000000 /* Start of processor-specific */
588 +#define SHT_HIPROC 0x7fffffff /* End of processor-specific */
589 +#define SHT_LOUSER 0x80000000 /* Start of application-specific */
590 +#define SHT_HIUSER 0x8fffffff /* End of application-specific */
592 +/* Legal values for sh_flags (section flags). */
594 +#define SHF_WRITE (1 << 0) /* Writable */
595 +#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
596 +#define SHF_EXECINSTR (1 << 2) /* Executable */
597 +#define SHF_MERGE (1 << 4) /* Might be merged */
598 +#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */
599 +#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */
600 +#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */
601 +#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling
603 +#define SHF_GROUP (1 << 9) /* Section is member of a group. */
604 +#define SHF_TLS (1 << 10) /* Section hold thread-local data. */
605 +#define SHF_MASKOS 0x0ff00000 /* OS-specific. */
606 +#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
607 +#define SHF_ORDERED (1 << 30) /* Special ordering requirement
609 +#define SHF_EXCLUDE (1 << 31) /* Section is excluded unless
610 + referenced or allocated (Solaris).*/
612 +/* Section group handling. */
613 +#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */
615 +/* Symbol table entry. */
619 + Elf32_Word st_name; /* Symbol name (string tbl index) */
620 + Elf32_Addr st_value; /* Symbol value */
621 + Elf32_Word st_size; /* Symbol size */
622 + unsigned char st_info; /* Symbol type and binding */
623 + unsigned char st_other; /* Symbol visibility */
624 + Elf32_Section st_shndx; /* Section index */
629 + Elf64_Word st_name; /* Symbol name (string tbl index) */
630 + unsigned char st_info; /* Symbol type and binding */
631 + unsigned char st_other; /* Symbol visibility */
632 + Elf64_Section st_shndx; /* Section index */
633 + Elf64_Addr st_value; /* Symbol value */
634 + Elf64_Xword st_size; /* Symbol size */
637 +/* The syminfo section if available contains additional information about
638 + every dynamic symbol. */
642 + Elf32_Half si_boundto; /* Direct bindings, symbol bound to */
643 + Elf32_Half si_flags; /* Per symbol flags */
648 + Elf64_Half si_boundto; /* Direct bindings, symbol bound to */
649 + Elf64_Half si_flags; /* Per symbol flags */
652 +/* Possible values for si_boundto. */
653 +#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */
654 +#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */
655 +#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */
657 +/* Possible bitmasks for si_flags. */
658 +#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */
659 +#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */
660 +#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */
661 +#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy
663 +/* Syminfo version values. */
664 +#define SYMINFO_NONE 0
665 +#define SYMINFO_CURRENT 1
666 +#define SYMINFO_NUM 2
669 +/* How to extract and insert information held in the st_info field. */
671 +#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
672 +#define ELF32_ST_TYPE(val) ((val) & 0xf)
673 +#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
675 +/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
676 +#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
677 +#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
678 +#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
680 +/* Legal values for ST_BIND subfield of st_info (symbol binding). */
682 +#define STB_LOCAL 0 /* Local symbol */
683 +#define STB_GLOBAL 1 /* Global symbol */
684 +#define STB_WEAK 2 /* Weak symbol */
685 +#define STB_NUM 3 /* Number of defined types. */
686 +#define STB_LOOS 10 /* Start of OS-specific */
687 +#define STB_HIOS 12 /* End of OS-specific */
688 +#define STB_LOPROC 13 /* Start of processor-specific */
689 +#define STB_HIPROC 15 /* End of processor-specific */
691 +/* Legal values for ST_TYPE subfield of st_info (symbol type). */
693 +#define STT_NOTYPE 0 /* Symbol type is unspecified */
694 +#define STT_OBJECT 1 /* Symbol is a data object */
695 +#define STT_FUNC 2 /* Symbol is a code object */
696 +#define STT_SECTION 3 /* Symbol associated with a section */
697 +#define STT_FILE 4 /* Symbol's name is file name */
698 +#define STT_COMMON 5 /* Symbol is a common data object */
699 +#define STT_TLS 6 /* Symbol is thread-local data object*/
700 +#define STT_NUM 7 /* Number of defined types. */
701 +#define STT_LOOS 10 /* Start of OS-specific */
702 +#define STT_HIOS 12 /* End of OS-specific */
703 +#define STT_LOPROC 13 /* Start of processor-specific */
704 +#define STT_HIPROC 15 /* End of processor-specific */
707 +/* Symbol table indices are found in the hash buckets and chain table
708 + of a symbol hash table section. This special index value indicates
709 + the end of a chain, meaning no further symbols are found in that bucket. */
711 +#define STN_UNDEF 0 /* End of a chain. */
714 +/* How to extract and insert information held in the st_other field. */
716 +#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
718 +/* For ELF64 the definitions are the same. */
719 +#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
721 +/* Symbol visibility specification encoded in the st_other field. */
722 +#define STV_DEFAULT 0 /* Default symbol visibility rules */
723 +#define STV_INTERNAL 1 /* Processor specific hidden class */
724 +#define STV_HIDDEN 2 /* Sym unavailable in other modules */
725 +#define STV_PROTECTED 3 /* Not preemptible, not exported */
728 +/* Relocation table entry without addend (in section of type SHT_REL). */
732 + Elf32_Addr r_offset; /* Address */
733 + Elf32_Word r_info; /* Relocation type and symbol index */
736 +/* I have seen two different definitions of the Elf64_Rel and
737 + Elf64_Rela structures, so we'll leave them out until Novell (or
738 + whoever) gets their act together. */
739 +/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */
743 + Elf64_Addr r_offset; /* Address */
744 + Elf64_Xword r_info; /* Relocation type and symbol index */
747 +/* Relocation table entry with addend (in section of type SHT_RELA). */
751 + Elf32_Addr r_offset; /* Address */
752 + Elf32_Word r_info; /* Relocation type and symbol index */
753 + Elf32_Sword r_addend; /* Addend */
758 + Elf64_Addr r_offset; /* Address */
759 + Elf64_Xword r_info; /* Relocation type and symbol index */
760 + Elf64_Sxword r_addend; /* Addend */
763 +/* How to extract and insert information held in the r_info field. */
765 +#define ELF32_R_SYM(val) ((val) >> 8)
766 +#define ELF32_R_TYPE(val) ((val) & 0xff)
767 +#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
769 +#define ELF64_R_SYM(i) ((i) >> 32)
770 +#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
771 +#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type))
773 +/* Program segment header. */
777 + Elf32_Word p_type; /* Segment type */
778 + Elf32_Off p_offset; /* Segment file offset */
779 + Elf32_Addr p_vaddr; /* Segment virtual address */
780 + Elf32_Addr p_paddr; /* Segment physical address */
781 + Elf32_Word p_filesz; /* Segment size in file */
782 + Elf32_Word p_memsz; /* Segment size in memory */
783 + Elf32_Word p_flags; /* Segment flags */
784 + Elf32_Word p_align; /* Segment alignment */
789 + Elf64_Word p_type; /* Segment type */
790 + Elf64_Word p_flags; /* Segment flags */
791 + Elf64_Off p_offset; /* Segment file offset */
792 + Elf64_Addr p_vaddr; /* Segment virtual address */
793 + Elf64_Addr p_paddr; /* Segment physical address */
794 + Elf64_Xword p_filesz; /* Segment size in file */
795 + Elf64_Xword p_memsz; /* Segment size in memory */
796 + Elf64_Xword p_align; /* Segment alignment */
799 +/* Legal values for p_type (segment type). */
801 +#define PT_NULL 0 /* Program header table entry unused */
802 +#define PT_LOAD 1 /* Loadable program segment */
803 +#define PT_DYNAMIC 2 /* Dynamic linking information */
804 +#define PT_INTERP 3 /* Program interpreter */
805 +#define PT_NOTE 4 /* Auxiliary information */
806 +#define PT_SHLIB 5 /* Reserved */
807 +#define PT_PHDR 6 /* Entry for header table itself */
808 +#define PT_TLS 7 /* Thread-local storage segment */
809 +#define PT_NUM 8 /* Number of defined types */
810 +#define PT_LOOS 0x60000000 /* Start of OS-specific */
811 +#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
812 +#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
813 +#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
814 +#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */
815 +#define PT_LOSUNW 0x6ffffffa
816 +#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
817 +#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
818 +#define PT_HISUNW 0x6fffffff
819 +#define PT_HIOS 0x6fffffff /* End of OS-specific */
820 +#define PT_LOPROC 0x70000000 /* Start of processor-specific */
821 +#define PT_HIPROC 0x7fffffff /* End of processor-specific */
823 +/* Legal values for p_flags (segment flags). */
825 +#define PF_X (1 << 0) /* Segment is executable */
826 +#define PF_W (1 << 1) /* Segment is writable */
827 +#define PF_R (1 << 2) /* Segment is readable */
828 +#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
829 +#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
830 +#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
831 +#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
832 +#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
833 +#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
834 +#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
835 +#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
836 +#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
837 +#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
838 +#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
839 +#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
840 +#define PF_MASKOS 0x0ff00000 /* OS-specific */
841 +#define PF_MASKPROC 0xf0000000 /* Processor-specific */
843 +/* Legal values for note segment descriptor types for core files. */
845 +#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
846 +#define NT_FPREGSET 2 /* Contains copy of fpregset struct */
847 +#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
848 +#define NT_PRXREG 4 /* Contains copy of prxregset struct */
849 +#define NT_TASKSTRUCT 4 /* Contains copy of task structure */
850 +#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */
851 +#define NT_AUXV 6 /* Contains copy of auxv array */
852 +#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */
853 +#define NT_ASRS 8 /* Contains copy of asrset struct */
854 +#define NT_PSTATUS 10 /* Contains copy of pstatus struct */
855 +#define NT_PSINFO 13 /* Contains copy of psinfo struct */
856 +#define NT_PRCRED 14 /* Contains copy of prcred struct */
857 +#define NT_UTSNAME 15 /* Contains copy of utsname struct */
858 +#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */
859 +#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */
860 +#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct*/
862 +/* Legal values for the note segment descriptor types for object files. */
864 +#define NT_VERSION 1 /* Contains a version string. */
867 +/* Dynamic section entry. */
871 + Elf32_Sword d_tag; /* Dynamic entry type */
874 + Elf32_Word d_val; /* Integer value */
875 + Elf32_Addr d_ptr; /* Address value */
881 + Elf64_Sxword d_tag; /* Dynamic entry type */
884 + Elf64_Xword d_val; /* Integer value */
885 + Elf64_Addr d_ptr; /* Address value */
889 +/* Legal values for d_tag (dynamic entry type). */
891 +#define DT_NULL 0 /* Marks end of dynamic section */
892 +#define DT_NEEDED 1 /* Name of needed library */
893 +#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */
894 +#define DT_PLTGOT 3 /* Processor defined value */
895 +#define DT_HASH 4 /* Address of symbol hash table */
896 +#define DT_STRTAB 5 /* Address of string table */
897 +#define DT_SYMTAB 6 /* Address of symbol table */
898 +#define DT_RELA 7 /* Address of Rela relocs */
899 +#define DT_RELASZ 8 /* Total size of Rela relocs */
900 +#define DT_RELAENT 9 /* Size of one Rela reloc */
901 +#define DT_STRSZ 10 /* Size of string table */
902 +#define DT_SYMENT 11 /* Size of one symbol table entry */
903 +#define DT_INIT 12 /* Address of init function */
904 +#define DT_FINI 13 /* Address of termination function */
905 +#define DT_SONAME 14 /* Name of shared object */
906 +#define DT_RPATH 15 /* Library search path (deprecated) */
907 +#define DT_SYMBOLIC 16 /* Start symbol search here */
908 +#define DT_REL 17 /* Address of Rel relocs */
909 +#define DT_RELSZ 18 /* Total size of Rel relocs */
910 +#define DT_RELENT 19 /* Size of one Rel reloc */
911 +#define DT_PLTREL 20 /* Type of reloc in PLT */
912 +#define DT_DEBUG 21 /* For debugging; unspecified */
913 +#define DT_TEXTREL 22 /* Reloc might modify .text */
914 +#define DT_JMPREL 23 /* Address of PLT relocs */
915 +#define DT_BIND_NOW 24 /* Process relocations of object */
916 +#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */
917 +#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */
918 +#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */
919 +#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */
920 +#define DT_RUNPATH 29 /* Library search path */
921 +#define DT_FLAGS 30 /* Flags for the object being loaded */
922 +#define DT_ENCODING 32 /* Start of encoded range */
923 +#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
924 +#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
925 +#define DT_NUM 34 /* Number used */
926 +#define DT_LOOS 0x6000000d /* Start of OS-specific */
927 +#define DT_HIOS 0x6ffff000 /* End of OS-specific */
928 +#define DT_LOPROC 0x70000000 /* Start of processor-specific */
929 +#define DT_HIPROC 0x7fffffff /* End of processor-specific */
930 +#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */
932 +/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
933 + Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's
935 +#define DT_VALRNGLO 0x6ffffd00
936 +#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */
937 +#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */
938 +#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */
939 +#define DT_CHECKSUM 0x6ffffdf8
940 +#define DT_PLTPADSZ 0x6ffffdf9
941 +#define DT_MOVEENT 0x6ffffdfa
942 +#define DT_MOVESZ 0x6ffffdfb
943 +#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */
944 +#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting
945 + the following DT_* entry. */
946 +#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */
947 +#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */
948 +#define DT_VALRNGHI 0x6ffffdff
949 +#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */
950 +#define DT_VALNUM 12
952 +/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
953 + Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
955 + If any adjustment is made to the ELF object after it has been
956 + built these entries will need to be adjusted. */
957 +#define DT_ADDRRNGLO 0x6ffffe00
958 +#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */
959 +#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */
960 +#define DT_CONFIG 0x6ffffefa /* Configuration information. */
961 +#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */
962 +#define DT_AUDIT 0x6ffffefc /* Object auditing. */
963 +#define DT_PLTPAD 0x6ffffefd /* PLT padding. */
964 +#define DT_MOVETAB 0x6ffffefe /* Move table. */
965 +#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */
966 +#define DT_ADDRRNGHI 0x6ffffeff
967 +#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */
968 +#define DT_ADDRNUM 10
970 +/* The versioning entry types. The next are defined as part of the
972 +#define DT_VERSYM 0x6ffffff0
974 +#define DT_RELACOUNT 0x6ffffff9
975 +#define DT_RELCOUNT 0x6ffffffa
977 +/* These were chosen by Sun. */
978 +#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */
979 +#define DT_VERDEF 0x6ffffffc /* Address of version definition
981 +#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */
982 +#define DT_VERNEED 0x6ffffffe /* Address of table with needed
984 +#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */
985 +#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
986 +#define DT_VERSIONTAGNUM 16
988 +/* Sun added these machine-independent extensions in the "processor-specific"
989 + range. Be compatible. */
990 +#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */
991 +#define DT_FILTER 0x7fffffff /* Shared object to get values from */
992 +#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
993 +#define DT_EXTRANUM 3
995 +/* Values of `d_un.d_val' in the DT_FLAGS entry. */
996 +#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */
997 +#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */
998 +#define DF_TEXTREL 0x00000004 /* Object contains text relocations */
999 +#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */
1000 +#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */
1002 +/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
1003 + entry in the dynamic section. */
1004 +#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */
1005 +#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */
1006 +#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */
1007 +#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/
1008 +#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/
1009 +#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/
1010 +#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */
1011 +#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */
1012 +#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */
1013 +#define DF_1_TRANS 0x00000200
1014 +#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */
1015 +#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */
1016 +#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */
1017 +#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/
1018 +#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */
1019 +#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */
1020 +#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */
1022 +/* Flags for the feature selection in DT_FEATURE_1. */
1023 +#define DTF_1_PARINIT 0x00000001
1024 +#define DTF_1_CONFEXP 0x00000002
1026 +/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */
1027 +#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */
1028 +#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not
1029 + generally available. */
1031 +/* Version definition sections. */
1035 + Elf32_Half vd_version; /* Version revision */
1036 + Elf32_Half vd_flags; /* Version information */
1037 + Elf32_Half vd_ndx; /* Version Index */
1038 + Elf32_Half vd_cnt; /* Number of associated aux entries */
1039 + Elf32_Word vd_hash; /* Version name hash value */
1040 + Elf32_Word vd_aux; /* Offset in bytes to verdaux array */
1041 + Elf32_Word vd_next; /* Offset in bytes to next verdef
1047 + Elf64_Half vd_version; /* Version revision */
1048 + Elf64_Half vd_flags; /* Version information */
1049 + Elf64_Half vd_ndx; /* Version Index */
1050 + Elf64_Half vd_cnt; /* Number of associated aux entries */
1051 + Elf64_Word vd_hash; /* Version name hash value */
1052 + Elf64_Word vd_aux; /* Offset in bytes to verdaux array */
1053 + Elf64_Word vd_next; /* Offset in bytes to next verdef
1058 +/* Legal values for vd_version (version revision). */
1059 +#define VER_DEF_NONE 0 /* No version */
1060 +#define VER_DEF_CURRENT 1 /* Current version */
1061 +#define VER_DEF_NUM 2 /* Given version number */
1063 +/* Legal values for vd_flags (version information flags). */
1064 +#define VER_FLG_BASE 0x1 /* Version definition of file itself */
1065 +#define VER_FLG_WEAK 0x2 /* Weak version identifier */
1067 +/* Versym symbol index values. */
1068 +#define VER_NDX_LOCAL 0 /* Symbol is local. */
1069 +#define VER_NDX_GLOBAL 1 /* Symbol is global. */
1070 +#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */
1071 +#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */
1073 +/* Auxialiary version information. */
1077 + Elf32_Word vda_name; /* Version or dependency names */
1078 + Elf32_Word vda_next; /* Offset in bytes to next verdaux
1084 + Elf64_Word vda_name; /* Version or dependency names */
1085 + Elf64_Word vda_next; /* Offset in bytes to next verdaux
1090 +/* Version dependency section. */
1094 + Elf32_Half vn_version; /* Version of structure */
1095 + Elf32_Half vn_cnt; /* Number of associated aux entries */
1096 + Elf32_Word vn_file; /* Offset of filename for this
1098 + Elf32_Word vn_aux; /* Offset in bytes to vernaux array */
1099 + Elf32_Word vn_next; /* Offset in bytes to next verneed
1105 + Elf64_Half vn_version; /* Version of structure */
1106 + Elf64_Half vn_cnt; /* Number of associated aux entries */
1107 + Elf64_Word vn_file; /* Offset of filename for this
1109 + Elf64_Word vn_aux; /* Offset in bytes to vernaux array */
1110 + Elf64_Word vn_next; /* Offset in bytes to next verneed
1115 +/* Legal values for vn_version (version revision). */
1116 +#define VER_NEED_NONE 0 /* No version */
1117 +#define VER_NEED_CURRENT 1 /* Current version */
1118 +#define VER_NEED_NUM 2 /* Given version number */
1120 +/* Auxiliary needed version information. */
1124 + Elf32_Word vna_hash; /* Hash value of dependency name */
1125 + Elf32_Half vna_flags; /* Dependency specific information */
1126 + Elf32_Half vna_other; /* Unused */
1127 + Elf32_Word vna_name; /* Dependency name string offset */
1128 + Elf32_Word vna_next; /* Offset in bytes to next vernaux
1134 + Elf64_Word vna_hash; /* Hash value of dependency name */
1135 + Elf64_Half vna_flags; /* Dependency specific information */
1136 + Elf64_Half vna_other; /* Unused */
1137 + Elf64_Word vna_name; /* Dependency name string offset */
1138 + Elf64_Word vna_next; /* Offset in bytes to next vernaux
1143 +/* Legal values for vna_flags. */
1144 +#define VER_FLG_WEAK 0x2 /* Weak version identifier */
1147 +/* Auxiliary vector. */
1149 +/* This vector is normally only used by the program interpreter. The
1150 + usual definition in an ABI supplement uses the name auxv_t. The
1151 + vector is not usually defined in a standard <elf.h> file, but it
1152 + can't hurt. We rename it to avoid conflicts. The sizes of these
1153 + types are an arrangement between the exec server and the program
1154 + interpreter, so we don't fully specify them here. */
1158 + uint32_t a_type; /* Entry type */
1161 + uint32_t a_val; /* Integer value */
1162 + /* We use to have pointer elements added here. We cannot do that,
1163 + though, since it does not work when using 32-bit definitions
1164 + on 64-bit platforms and vice versa. */
1170 + uint64_t a_type; /* Entry type */
1173 + uint64_t a_val; /* Integer value */
1174 + /* We use to have pointer elements added here. We cannot do that,
1175 + though, since it does not work when using 32-bit definitions
1176 + on 64-bit platforms and vice versa. */
1180 +/* Legal values for a_type (entry type). */
1182 +#define AT_NULL 0 /* End of vector */
1183 +#define AT_IGNORE 1 /* Entry should be ignored */
1184 +#define AT_EXECFD 2 /* File descriptor of program */
1185 +#define AT_PHDR 3 /* Program headers for program */
1186 +#define AT_PHENT 4 /* Size of program header entry */
1187 +#define AT_PHNUM 5 /* Number of program headers */
1188 +#define AT_PAGESZ 6 /* System page size */
1189 +#define AT_BASE 7 /* Base address of interpreter */
1190 +#define AT_FLAGS 8 /* Flags */
1191 +#define AT_ENTRY 9 /* Entry point of program */
1192 +#define AT_NOTELF 10 /* Program is not ELF */
1193 +#define AT_UID 11 /* Real uid */
1194 +#define AT_EUID 12 /* Effective uid */
1195 +#define AT_GID 13 /* Real gid */
1196 +#define AT_EGID 14 /* Effective gid */
1197 +#define AT_CLKTCK 17 /* Frequency of times() */
1199 +/* Some more special a_type values describing the hardware. */
1200 +#define AT_PLATFORM 15 /* String identifying platform. */
1201 +#define AT_HWCAP 16 /* Machine dependent hints about
1202 + processor capabilities. */
1204 +/* This entry gives some information about the FPU initialization
1205 + performed by the kernel. */
1206 +#define AT_FPUCW 18 /* Used FPU control word. */
1208 +/* Cache block sizes. */
1209 +#define AT_DCACHEBSIZE 19 /* Data cache block size. */
1210 +#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */
1211 +#define AT_UCACHEBSIZE 21 /* Unified cache block size. */
1213 +/* A special ignored value for PPC, used by the kernel to control the
1214 + interpretation of the AUXV. Must be > 16. */
1215 +#define AT_IGNOREPPC 22 /* Entry should be ignored. */
1217 +#define AT_SECURE 23 /* Boolean, was exec setuid-like? */
1219 +/* Pointer to the global system page used for system calls and other
1221 +#define AT_SYSINFO 32
1222 +#define AT_SYSINFO_EHDR 33
1224 +/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains
1225 + log2 of line size; mask those to get cache size. */
1226 +#define AT_L1I_CACHESHAPE 34
1227 +#define AT_L1D_CACHESHAPE 35
1228 +#define AT_L2_CACHESHAPE 36
1229 +#define AT_L3_CACHESHAPE 37
1231 +/* Note section contents. Each entry in the note section begins with
1232 + a header of a fixed form. */
1236 + Elf32_Word n_namesz; /* Length of the note's name. */
1237 + Elf32_Word n_descsz; /* Length of the note's descriptor. */
1238 + Elf32_Word n_type; /* Type of the note. */
1243 + Elf64_Word n_namesz; /* Length of the note's name. */
1244 + Elf64_Word n_descsz; /* Length of the note's descriptor. */
1245 + Elf64_Word n_type; /* Type of the note. */
1248 +/* Known names of notes. */
1250 +/* Solaris entries in the note section have this name. */
1251 +#define ELF_NOTE_SOLARIS "SUNW Solaris"
1253 +/* Note entries for GNU systems have this name. */
1254 +#define ELF_NOTE_GNU "GNU"
1257 +/* Defined types of notes for Solaris. */
1259 +/* Value of descriptor (one word) is desired pagesize for the binary. */
1260 +#define ELF_NOTE_PAGESIZE_HINT 1
1263 +/* Defined note types for GNU systems. */
1265 +/* ABI information. The descriptor consists of words:
1266 + word 0: OS descriptor
1267 + word 1: major version of the ABI
1268 + word 2: minor version of the ABI
1269 + word 3: subminor version of the ABI
1271 +#define ELF_NOTE_ABI 1
1273 +/* Known OSes. These value can appear in word 0 of an ELF_NOTE_ABI
1274 + note section entry. */
1275 +#define ELF_NOTE_OS_LINUX 0
1276 +#define ELF_NOTE_OS_GNU 1
1277 +#define ELF_NOTE_OS_SOLARIS2 2
1278 +#define ELF_NOTE_OS_FREEBSD 3
1281 +/* Move records. */
1284 + Elf32_Xword m_value; /* Symbol value. */
1285 + Elf32_Word m_info; /* Size and index. */
1286 + Elf32_Word m_poffset; /* Symbol offset. */
1287 + Elf32_Half m_repeat; /* Repeat count. */
1288 + Elf32_Half m_stride; /* Stride info. */
1293 + Elf64_Xword m_value; /* Symbol value. */
1294 + Elf64_Xword m_info; /* Size and index. */
1295 + Elf64_Xword m_poffset; /* Symbol offset. */
1296 + Elf64_Half m_repeat; /* Repeat count. */
1297 + Elf64_Half m_stride; /* Stride info. */
1300 +/* Macro to construct move records. */
1301 +#define ELF32_M_SYM(info) ((info) >> 8)
1302 +#define ELF32_M_SIZE(info) ((unsigned char) (info))
1303 +#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size))
1305 +#define ELF64_M_SYM(info) ELF32_M_SYM (info)
1306 +#define ELF64_M_SIZE(info) ELF32_M_SIZE (info)
1307 +#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size)
1310 +/* Motorola 68k specific definitions. */
1312 +/* Values for Elf32_Ehdr.e_flags. */
1313 +#define EF_CPU32 0x00810000
1317 +#define R_68K_NONE 0 /* No reloc */
1318 +#define R_68K_32 1 /* Direct 32 bit */
1319 +#define R_68K_16 2 /* Direct 16 bit */
1320 +#define R_68K_8 3 /* Direct 8 bit */
1321 +#define R_68K_PC32 4 /* PC relative 32 bit */
1322 +#define R_68K_PC16 5 /* PC relative 16 bit */
1323 +#define R_68K_PC8 6 /* PC relative 8 bit */
1324 +#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */
1325 +#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */
1326 +#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */
1327 +#define R_68K_GOT32O 10 /* 32 bit GOT offset */
1328 +#define R_68K_GOT16O 11 /* 16 bit GOT offset */
1329 +#define R_68K_GOT8O 12 /* 8 bit GOT offset */
1330 +#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */
1331 +#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */
1332 +#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */
1333 +#define R_68K_PLT32O 16 /* 32 bit PLT offset */
1334 +#define R_68K_PLT16O 17 /* 16 bit PLT offset */
1335 +#define R_68K_PLT8O 18 /* 8 bit PLT offset */
1336 +#define R_68K_COPY 19 /* Copy symbol at runtime */
1337 +#define R_68K_GLOB_DAT 20 /* Create GOT entry */
1338 +#define R_68K_JMP_SLOT 21 /* Create PLT entry */
1339 +#define R_68K_RELATIVE 22 /* Adjust by program base */
1340 +/* Keep this the last entry. */
1341 +#define R_68K_NUM 23
1343 +/* Intel 80386 specific definitions. */
1347 +#define R_386_NONE 0 /* No reloc */
1348 +#define R_386_32 1 /* Direct 32 bit */
1349 +#define R_386_PC32 2 /* PC relative 32 bit */
1350 +#define R_386_GOT32 3 /* 32 bit GOT entry */
1351 +#define R_386_PLT32 4 /* 32 bit PLT address */
1352 +#define R_386_COPY 5 /* Copy symbol at runtime */
1353 +#define R_386_GLOB_DAT 6 /* Create GOT entry */
1354 +#define R_386_JMP_SLOT 7 /* Create PLT entry */
1355 +#define R_386_RELATIVE 8 /* Adjust by program base */
1356 +#define R_386_GOTOFF 9 /* 32 bit offset to GOT */
1357 +#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */
1358 +#define R_386_32PLT 11
1359 +#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */
1360 +#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS
1362 +#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block
1364 +#define R_386_TLS_LE 17 /* Offset relative to static TLS
1366 +#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of
1367 + general dynamic thread local data */
1368 +#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of
1369 + local dynamic thread local data
1371 +#define R_386_16 20
1372 +#define R_386_PC16 21
1374 +#define R_386_PC8 23
1375 +#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic
1376 + thread local data */
1377 +#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */
1378 +#define R_386_TLS_GD_CALL 26 /* Relocation for call to
1379 + __tls_get_addr() */
1380 +#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */
1381 +#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic
1382 + thread local data in LE code */
1383 +#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */
1384 +#define R_386_TLS_LDM_CALL 30 /* Relocation for call to
1385 + __tls_get_addr() in LDM code */
1386 +#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */
1387 +#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */
1388 +#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS
1390 +#define R_386_TLS_LE_32 34 /* Negated offset relative to static
1392 +#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */
1393 +#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */
1394 +#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */
1395 +/* Keep this the last entry. */
1396 +#define R_386_NUM 38
1398 +/* FR-V specific definitions. */
1399 +#define R_FRV_NONE 0 /* No reloc. */
1400 +#define R_FRV_32 1 /* Direct 32 bit. */
1401 +/* Canonical function descriptor address. */
1402 +#define R_FRV_FUNCDESC 14
1403 +/* Private function descriptor initialization. */
1404 +#define R_FRV_FUNCDESC_VALUE 18
1407 +#define EF_FRV_GPR_MASK 0x00000003 /* mask for # of gprs */
1408 +#define EF_FRV_GPR_32 0x00000001 /* -mgpr-32 */
1409 +#define EF_FRV_GPR_64 0x00000002 /* -mgpr-64 */
1412 +#define EF_FRV_FPR_MASK 0x0000000c /* mask for # of fprs */
1413 +#define EF_FRV_FPR_32 0x00000004 /* -mfpr-32 */
1414 +#define EF_FRV_FPR_64 0x00000008 /* -mfpr-64 */
1415 +#define EF_FRV_FPR_NONE 0x0000000c /* -msoft-float */
1417 +#define EF_FRV_PIC 0x00000100
1418 +#define EF_FRV_FDPIC 0x00008000
1420 +/* SUN SPARC specific definitions. */
1422 +/* Legal values for ST_TYPE subfield of st_info (symbol type). */
1424 +#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */
1426 +/* Values for Elf64_Ehdr.e_flags. */
1428 +#define EF_SPARCV9_MM 3
1429 +#define EF_SPARCV9_TSO 0
1430 +#define EF_SPARCV9_PSO 1
1431 +#define EF_SPARCV9_RMO 2
1432 +#define EF_SPARC_LEDATA 0x800000 /* little endian data */
1433 +#define EF_SPARC_EXT_MASK 0xFFFF00
1434 +#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */
1435 +#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */
1436 +#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */
1437 +#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */
1439 +/* SPARC relocs. */
1441 +#define R_SPARC_NONE 0 /* No reloc */
1442 +#define R_SPARC_8 1 /* Direct 8 bit */
1443 +#define R_SPARC_16 2 /* Direct 16 bit */
1444 +#define R_SPARC_32 3 /* Direct 32 bit */
1445 +#define R_SPARC_DISP8 4 /* PC relative 8 bit */
1446 +#define R_SPARC_DISP16 5 /* PC relative 16 bit */
1447 +#define R_SPARC_DISP32 6 /* PC relative 32 bit */
1448 +#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */
1449 +#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */
1450 +#define R_SPARC_HI22 9 /* High 22 bit */
1451 +#define R_SPARC_22 10 /* Direct 22 bit */
1452 +#define R_SPARC_13 11 /* Direct 13 bit */
1453 +#define R_SPARC_LO10 12 /* Truncated 10 bit */
1454 +#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */
1455 +#define R_SPARC_GOT13 14 /* 13 bit GOT entry */
1456 +#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */
1457 +#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */
1458 +#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */
1459 +#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */
1460 +#define R_SPARC_COPY 19 /* Copy symbol at runtime */
1461 +#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */
1462 +#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */
1463 +#define R_SPARC_RELATIVE 22 /* Adjust by program base */
1464 +#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */
1466 +/* Additional Sparc64 relocs. */
1468 +#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */
1469 +#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */
1470 +#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */
1471 +#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */
1472 +#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */
1473 +#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */
1474 +#define R_SPARC_10 30 /* Direct 10 bit */
1475 +#define R_SPARC_11 31 /* Direct 11 bit */
1476 +#define R_SPARC_64 32 /* Direct 64 bit */
1477 +#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */
1478 +#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */
1479 +#define R_SPARC_HM10 35 /* High middle 10 bits of ... */
1480 +#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */
1481 +#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */
1482 +#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */
1483 +#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */
1484 +#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */
1485 +#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */
1486 +#define R_SPARC_7 43 /* Direct 7 bit */
1487 +#define R_SPARC_5 44 /* Direct 5 bit */
1488 +#define R_SPARC_6 45 /* Direct 6 bit */
1489 +#define R_SPARC_DISP64 46 /* PC relative 64 bit */
1490 +#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */
1491 +#define R_SPARC_HIX22 48 /* High 22 bit complemented */
1492 +#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */
1493 +#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */
1494 +#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */
1495 +#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */
1496 +#define R_SPARC_REGISTER 53 /* Global register usage */
1497 +#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */
1498 +#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */
1499 +#define R_SPARC_TLS_GD_HI22 56
1500 +#define R_SPARC_TLS_GD_LO10 57
1501 +#define R_SPARC_TLS_GD_ADD 58
1502 +#define R_SPARC_TLS_GD_CALL 59
1503 +#define R_SPARC_TLS_LDM_HI22 60
1504 +#define R_SPARC_TLS_LDM_LO10 61
1505 +#define R_SPARC_TLS_LDM_ADD 62
1506 +#define R_SPARC_TLS_LDM_CALL 63
1507 +#define R_SPARC_TLS_LDO_HIX22 64
1508 +#define R_SPARC_TLS_LDO_LOX10 65
1509 +#define R_SPARC_TLS_LDO_ADD 66
1510 +#define R_SPARC_TLS_IE_HI22 67
1511 +#define R_SPARC_TLS_IE_LO10 68
1512 +#define R_SPARC_TLS_IE_LD 69
1513 +#define R_SPARC_TLS_IE_LDX 70
1514 +#define R_SPARC_TLS_IE_ADD 71
1515 +#define R_SPARC_TLS_LE_HIX22 72
1516 +#define R_SPARC_TLS_LE_LOX10 73
1517 +#define R_SPARC_TLS_DTPMOD32 74
1518 +#define R_SPARC_TLS_DTPMOD64 75
1519 +#define R_SPARC_TLS_DTPOFF32 76
1520 +#define R_SPARC_TLS_DTPOFF64 77
1521 +#define R_SPARC_TLS_TPOFF32 78
1522 +#define R_SPARC_TLS_TPOFF64 79
1523 +/* Keep this the last entry. */
1524 +#define R_SPARC_NUM 80
1526 +/* For Sparc64, legal values for d_tag of Elf64_Dyn. */
1528 +#define DT_SPARC_REGISTER 0x70000001
1529 +#define DT_SPARC_NUM 2
1531 +/* Bits present in AT_HWCAP, primarily for Sparc32. */
1533 +#define HWCAP_SPARC_FLUSH 1 /* The cpu supports flush insn. */
1534 +#define HWCAP_SPARC_STBAR 2
1535 +#define HWCAP_SPARC_SWAP 4
1536 +#define HWCAP_SPARC_MULDIV 8
1537 +#define HWCAP_SPARC_V9 16 /* The cpu is v9, so v8plus is ok. */
1538 +#define HWCAP_SPARC_ULTRA3 32
1540 +/* MIPS R3000 specific definitions. */
1542 +/* Legal values for e_flags field of Elf32_Ehdr. */
1544 +#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */
1545 +#define EF_MIPS_PIC 2 /* Contains PIC code */
1546 +#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */
1547 +#define EF_MIPS_XGOT 8
1548 +#define EF_MIPS_64BIT_WHIRL 16
1549 +#define EF_MIPS_ABI2 32
1550 +#define EF_MIPS_ABI_ON32 64
1551 +#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */
1553 +/* Legal values for MIPS architecture level. */
1555 +#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
1556 +#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
1557 +#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
1558 +#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
1559 +#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
1560 +#define EF_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */
1561 +#define EF_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */
1563 +/* The following are non-official names and should not be used. */
1565 +#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
1566 +#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
1567 +#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
1568 +#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
1569 +#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
1570 +#define E_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */
1571 +#define E_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */
1573 +/* Special section indices. */
1575 +#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */
1576 +#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
1577 +#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
1578 +#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
1579 +#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
1581 +/* Legal values for sh_type field of Elf32_Shdr. */
1583 +#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */
1584 +#define SHT_MIPS_MSYM 0x70000001
1585 +#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */
1586 +#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */
1587 +#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
1588 +#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/
1589 +#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */
1590 +#define SHT_MIPS_PACKAGE 0x70000007
1591 +#define SHT_MIPS_PACKSYM 0x70000008
1592 +#define SHT_MIPS_RELD 0x70000009
1593 +#define SHT_MIPS_IFACE 0x7000000b
1594 +#define SHT_MIPS_CONTENT 0x7000000c
1595 +#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */
1596 +#define SHT_MIPS_SHDR 0x70000010
1597 +#define SHT_MIPS_FDESC 0x70000011
1598 +#define SHT_MIPS_EXTSYM 0x70000012
1599 +#define SHT_MIPS_DENSE 0x70000013
1600 +#define SHT_MIPS_PDESC 0x70000014
1601 +#define SHT_MIPS_LOCSYM 0x70000015
1602 +#define SHT_MIPS_AUXSYM 0x70000016
1603 +#define SHT_MIPS_OPTSYM 0x70000017
1604 +#define SHT_MIPS_LOCSTR 0x70000018
1605 +#define SHT_MIPS_LINE 0x70000019
1606 +#define SHT_MIPS_RFDESC 0x7000001a
1607 +#define SHT_MIPS_DELTASYM 0x7000001b
1608 +#define SHT_MIPS_DELTAINST 0x7000001c
1609 +#define SHT_MIPS_DELTACLASS 0x7000001d
1610 +#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */
1611 +#define SHT_MIPS_DELTADECL 0x7000001f
1612 +#define SHT_MIPS_SYMBOL_LIB 0x70000020
1613 +#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */
1614 +#define SHT_MIPS_TRANSLATE 0x70000022
1615 +#define SHT_MIPS_PIXIE 0x70000023
1616 +#define SHT_MIPS_XLATE 0x70000024
1617 +#define SHT_MIPS_XLATE_DEBUG 0x70000025
1618 +#define SHT_MIPS_WHIRL 0x70000026
1619 +#define SHT_MIPS_EH_REGION 0x70000027
1620 +#define SHT_MIPS_XLATE_OLD 0x70000028
1621 +#define SHT_MIPS_PDR_EXCEPTION 0x70000029
1623 +/* Legal values for sh_flags field of Elf32_Shdr. */
1625 +#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */
1626 +#define SHF_MIPS_MERGE 0x20000000
1627 +#define SHF_MIPS_ADDR 0x40000000
1628 +#define SHF_MIPS_STRINGS 0x80000000
1629 +#define SHF_MIPS_NOSTRIP 0x08000000
1630 +#define SHF_MIPS_LOCAL 0x04000000
1631 +#define SHF_MIPS_NAMES 0x02000000
1632 +#define SHF_MIPS_NODUPE 0x01000000
1635 +/* Symbol tables. */
1637 +/* MIPS specific values for `st_other'. */
1638 +#define STO_MIPS_DEFAULT 0x0
1639 +#define STO_MIPS_INTERNAL 0x1
1640 +#define STO_MIPS_HIDDEN 0x2
1641 +#define STO_MIPS_PROTECTED 0x3
1642 +#define STO_MIPS_SC_ALIGN_UNUSED 0xff
1644 +/* MIPS specific values for `st_info'. */
1645 +#define STB_MIPS_SPLIT_COMMON 13
1647 +/* Entries found in sections of type SHT_MIPS_GPTAB. */
1653 + Elf32_Word gt_current_g_value; /* -G value used for compilation */
1654 + Elf32_Word gt_unused; /* Not used */
1655 + } gt_header; /* First entry in section */
1658 + Elf32_Word gt_g_value; /* If this value were used for -G */
1659 + Elf32_Word gt_bytes; /* This many bytes would be used */
1660 + } gt_entry; /* Subsequent entries in section */
1663 +/* Entry found in sections of type SHT_MIPS_REGINFO. */
1667 + Elf32_Word ri_gprmask; /* General registers used */
1668 + Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
1669 + Elf32_Sword ri_gp_value; /* $gp register value */
1672 +/* Entries found in sections of type SHT_MIPS_OPTIONS. */
1676 + unsigned char kind; /* Determines interpretation of the
1677 + variable part of descriptor. */
1678 + unsigned char size; /* Size of descriptor, including header. */
1679 + Elf32_Section section; /* Section header index of section affected,
1680 + 0 for global options. */
1681 + Elf32_Word info; /* Kind-specific information. */
1684 +/* Values for `kind' field in Elf_Options. */
1686 +#define ODK_NULL 0 /* Undefined. */
1687 +#define ODK_REGINFO 1 /* Register usage information. */
1688 +#define ODK_EXCEPTIONS 2 /* Exception processing options. */
1689 +#define ODK_PAD 3 /* Section padding options. */
1690 +#define ODK_HWPATCH 4 /* Hardware workarounds performed */
1691 +#define ODK_FILL 5 /* record the fill value used by the linker. */
1692 +#define ODK_TAGS 6 /* reserve space for desktop tools to write. */
1693 +#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */
1694 +#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */
1696 +/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */
1698 +#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */
1699 +#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */
1700 +#define OEX_PAGE0 0x10000 /* page zero must be mapped. */
1701 +#define OEX_SMM 0x20000 /* Force sequential memory mode? */
1702 +#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */
1703 +#define OEX_PRECISEFP OEX_FPDBUG
1704 +#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */
1706 +#define OEX_FPU_INVAL 0x10
1707 +#define OEX_FPU_DIV0 0x08
1708 +#define OEX_FPU_OFLO 0x04
1709 +#define OEX_FPU_UFLO 0x02
1710 +#define OEX_FPU_INEX 0x01
1712 +/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */
1714 +#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */
1715 +#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */
1716 +#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */
1717 +#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */
1719 +#define OPAD_PREFIX 0x1
1720 +#define OPAD_POSTFIX 0x2
1721 +#define OPAD_SYMBOL 0x4
1723 +/* Entry found in `.options' section. */
1727 + Elf32_Word hwp_flags1; /* Extra flags. */
1728 + Elf32_Word hwp_flags2; /* Extra flags. */
1731 +/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */
1733 +#define OHWA0_R4KEOP_CHECKED 0x00000001
1734 +#define OHWA1_R4KEOP_CLEAN 0x00000002
1738 +#define R_MIPS_NONE 0 /* No reloc */
1739 +#define R_MIPS_16 1 /* Direct 16 bit */
1740 +#define R_MIPS_32 2 /* Direct 32 bit */
1741 +#define R_MIPS_REL32 3 /* PC relative 32 bit */
1742 +#define R_MIPS_26 4 /* Direct 26 bit shifted */
1743 +#define R_MIPS_HI16 5 /* High 16 bit */
1744 +#define R_MIPS_LO16 6 /* Low 16 bit */
1745 +#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
1746 +#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
1747 +#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
1748 +#define R_MIPS_PC16 10 /* PC relative 16 bit */
1749 +#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
1750 +#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
1752 +#define R_MIPS_SHIFT5 16
1753 +#define R_MIPS_SHIFT6 17
1754 +#define R_MIPS_64 18
1755 +#define R_MIPS_GOT_DISP 19
1756 +#define R_MIPS_GOT_PAGE 20
1757 +#define R_MIPS_GOT_OFST 21
1758 +#define R_MIPS_GOT_HI16 22
1759 +#define R_MIPS_GOT_LO16 23
1760 +#define R_MIPS_SUB 24
1761 +#define R_MIPS_INSERT_A 25
1762 +#define R_MIPS_INSERT_B 26
1763 +#define R_MIPS_DELETE 27
1764 +#define R_MIPS_HIGHER 28
1765 +#define R_MIPS_HIGHEST 29
1766 +#define R_MIPS_CALL_HI16 30
1767 +#define R_MIPS_CALL_LO16 31
1768 +#define R_MIPS_SCN_DISP 32
1769 +#define R_MIPS_REL16 33
1770 +#define R_MIPS_ADD_IMMEDIATE 34
1771 +#define R_MIPS_PJUMP 35
1772 +#define R_MIPS_RELGOT 36
1773 +#define R_MIPS_JALR 37
1774 +#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */
1775 +#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */
1776 +#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */
1777 +#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */
1778 +#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */
1779 +#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */
1780 +#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */
1781 +#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */
1782 +#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */
1783 +#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */
1784 +#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */
1785 +#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */
1786 +#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */
1787 +/* Keep this the last entry. */
1788 +#define R_MIPS_NUM 51
1790 +/* Legal values for p_type field of Elf32_Phdr. */
1792 +#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
1793 +#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */
1794 +#define PT_MIPS_OPTIONS 0x70000002
1796 +/* Special program header types. */
1798 +#define PF_MIPS_LOCAL 0x10000000
1800 +/* Legal values for d_tag field of Elf32_Dyn. */
1802 +#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */
1803 +#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
1804 +#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */
1805 +#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
1806 +#define DT_MIPS_FLAGS 0x70000005 /* Flags */
1807 +#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */
1808 +#define DT_MIPS_MSYM 0x70000007
1809 +#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */
1810 +#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */
1811 +#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */
1812 +#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */
1813 +#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */
1814 +#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */
1815 +#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
1816 +#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */
1817 +#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
1818 +#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */
1819 +#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */
1820 +#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in
1821 + DT_MIPS_DELTA_CLASS. */
1822 +#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */
1823 +#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in
1824 + DT_MIPS_DELTA_INSTANCE. */
1825 +#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */
1826 +#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in
1827 + DT_MIPS_DELTA_RELOC. */
1828 +#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta
1829 + relocations refer to. */
1830 +#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in
1831 + DT_MIPS_DELTA_SYM. */
1832 +#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the
1833 + class declaration. */
1834 +#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in
1835 + DT_MIPS_DELTA_CLASSSYM. */
1836 +#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */
1837 +#define DT_MIPS_PIXIE_INIT 0x70000023
1838 +#define DT_MIPS_SYMBOL_LIB 0x70000024
1839 +#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
1840 +#define DT_MIPS_LOCAL_GOTIDX 0x70000026
1841 +#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
1842 +#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
1843 +#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */
1844 +#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */
1845 +#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
1846 +#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */
1847 +#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve
1848 + function stored in GOT. */
1849 +#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added
1850 + by rld on dlopen() calls. */
1851 +#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */
1852 +#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */
1853 +#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */
1854 +#define DT_MIPS_NUM 0x32
1856 +/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */
1858 +#define RHF_NONE 0 /* No flags */
1859 +#define RHF_QUICKSTART (1 << 0) /* Use quickstart */
1860 +#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */
1861 +#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */
1862 +#define RHF_NO_MOVE (1 << 3)
1863 +#define RHF_SGI_ONLY (1 << 4)
1864 +#define RHF_GUARANTEE_INIT (1 << 5)
1865 +#define RHF_DELTA_C_PLUS_PLUS (1 << 6)
1866 +#define RHF_GUARANTEE_START_INIT (1 << 7)
1867 +#define RHF_PIXIE (1 << 8)
1868 +#define RHF_DEFAULT_DELAY_LOAD (1 << 9)
1869 +#define RHF_REQUICKSTART (1 << 10)
1870 +#define RHF_REQUICKSTARTED (1 << 11)
1871 +#define RHF_CORD (1 << 12)
1872 +#define RHF_NO_UNRES_UNDEF (1 << 13)
1873 +#define RHF_RLD_ORDER_SAFE (1 << 14)
1875 +/* Entries found in sections of type SHT_MIPS_LIBLIST. */
1879 + Elf32_Word l_name; /* Name (string table index) */
1880 + Elf32_Word l_time_stamp; /* Timestamp */
1881 + Elf32_Word l_checksum; /* Checksum */
1882 + Elf32_Word l_version; /* Interface version */
1883 + Elf32_Word l_flags; /* Flags */
1888 + Elf64_Word l_name; /* Name (string table index) */
1889 + Elf64_Word l_time_stamp; /* Timestamp */
1890 + Elf64_Word l_checksum; /* Checksum */
1891 + Elf64_Word l_version; /* Interface version */
1892 + Elf64_Word l_flags; /* Flags */
1896 +/* Legal values for l_flags. */
1899 +#define LL_EXACT_MATCH (1 << 0) /* Require exact match */
1900 +#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */
1901 +#define LL_REQUIRE_MINOR (1 << 2)
1902 +#define LL_EXPORTS (1 << 3)
1903 +#define LL_DELAY_LOAD (1 << 4)
1904 +#define LL_DELTA (1 << 5)
1906 +/* Entries found in sections of type SHT_MIPS_CONFLICT. */
1908 +typedef Elf32_Addr Elf32_Conflict;
1911 +/* HPPA specific definitions. */
1913 +/* Legal values for e_flags field of Elf32_Ehdr. */
1915 +#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */
1916 +#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */
1917 +#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */
1918 +#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */
1919 +#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch
1921 +#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */
1922 +#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */
1924 +/* Defined values for `e_flags & EF_PARISC_ARCH' are: */
1926 +#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */
1927 +#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */
1928 +#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */
1930 +/* Additional section indeces. */
1932 +#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared
1933 + symbols in ANSI C. */
1934 +#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */
1936 +/* Legal values for sh_type field of Elf32_Shdr. */
1938 +#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */
1939 +#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */
1940 +#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */
1942 +/* Legal values for sh_flags field of Elf32_Shdr. */
1944 +#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */
1945 +#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */
1946 +#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */
1948 +/* Legal values for ST_TYPE subfield of st_info (symbol type). */
1950 +#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */
1952 +#define STT_HP_OPAQUE (STT_LOOS + 0x1)
1953 +#define STT_HP_STUB (STT_LOOS + 0x2)
1957 +#define R_PARISC_NONE 0 /* No reloc. */
1958 +#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */
1959 +#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */
1960 +#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */
1961 +#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */
1962 +#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */
1963 +#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */
1964 +#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */
1965 +#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */
1966 +#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */
1967 +#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */
1968 +#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */
1969 +#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */
1970 +#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */
1971 +#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */
1972 +#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */
1973 +#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */
1974 +#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */
1975 +#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */
1976 +#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */
1977 +#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */
1978 +#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */
1979 +#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */
1980 +#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */
1981 +#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */
1982 +#define R_PARISC_FPTR64 64 /* 64 bits function address. */
1983 +#define R_PARISC_PLABEL32 65 /* 32 bits function address. */
1984 +#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */
1985 +#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */
1986 +#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */
1987 +#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */
1988 +#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */
1989 +#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */
1990 +#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */
1991 +#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */
1992 +#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */
1993 +#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */
1994 +#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */
1995 +#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */
1996 +#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */
1997 +#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */
1998 +#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */
1999 +#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */
2000 +#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */
2001 +#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */
2002 +#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */
2003 +#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */
2004 +#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */
2005 +#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */
2006 +#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */
2007 +#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */
2008 +#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */
2009 +#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */
2010 +#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */
2011 +#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */
2012 +#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */
2013 +#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */
2014 +#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */
2015 +#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */
2016 +#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */
2017 +#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */
2018 +#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */
2019 +#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */
2020 +#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */
2021 +#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */
2022 +#define R_PARISC_LORESERVE 128
2023 +#define R_PARISC_COPY 128 /* Copy relocation. */
2024 +#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */
2025 +#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */
2026 +#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */
2027 +#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */
2028 +#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */
2029 +#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */
2030 +#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/
2031 +#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */
2032 +#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */
2033 +#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */
2034 +#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */
2035 +#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */
2036 +#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */
2037 +#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */
2038 +#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */
2039 +#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/
2040 +#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/
2041 +#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */
2042 +#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */
2043 +#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */
2044 +#define R_PARISC_HIRESERVE 255
2046 +/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */
2048 +#define PT_HP_TLS (PT_LOOS + 0x0)
2049 +#define PT_HP_CORE_NONE (PT_LOOS + 0x1)
2050 +#define PT_HP_CORE_VERSION (PT_LOOS + 0x2)
2051 +#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3)
2052 +#define PT_HP_CORE_COMM (PT_LOOS + 0x4)
2053 +#define PT_HP_CORE_PROC (PT_LOOS + 0x5)
2054 +#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6)
2055 +#define PT_HP_CORE_STACK (PT_LOOS + 0x7)
2056 +#define PT_HP_CORE_SHM (PT_LOOS + 0x8)
2057 +#define PT_HP_CORE_MMF (PT_LOOS + 0x9)
2058 +#define PT_HP_PARALLEL (PT_LOOS + 0x10)
2059 +#define PT_HP_FASTBIND (PT_LOOS + 0x11)
2060 +#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12)
2061 +#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13)
2062 +#define PT_HP_STACK (PT_LOOS + 0x14)
2064 +#define PT_PARISC_ARCHEXT 0x70000000
2065 +#define PT_PARISC_UNWIND 0x70000001
2067 +/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */
2069 +#define PF_PARISC_SBP 0x08000000
2071 +#define PF_HP_PAGE_SIZE 0x00100000
2072 +#define PF_HP_FAR_SHARED 0x00200000
2073 +#define PF_HP_NEAR_SHARED 0x00400000
2074 +#define PF_HP_CODE 0x01000000
2075 +#define PF_HP_MODIFY 0x02000000
2076 +#define PF_HP_LAZYSWAP 0x04000000
2077 +#define PF_HP_SBP 0x08000000
2080 +/* Alpha specific definitions. */
2082 +/* Legal values for e_flags field of Elf64_Ehdr. */
2084 +#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */
2085 +#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */
2087 +/* Legal values for sh_type field of Elf64_Shdr. */
2089 +/* These two are primerily concerned with ECOFF debugging info. */
2090 +#define SHT_ALPHA_DEBUG 0x70000001
2091 +#define SHT_ALPHA_REGINFO 0x70000002
2093 +/* Legal values for sh_flags field of Elf64_Shdr. */
2095 +#define SHF_ALPHA_GPREL 0x10000000
2097 +/* Legal values for st_other field of Elf64_Sym. */
2098 +#define STO_ALPHA_NOPV 0x80 /* No PV required. */
2099 +#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */
2101 +/* Alpha relocs. */
2103 +#define R_ALPHA_NONE 0 /* No reloc */
2104 +#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
2105 +#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
2106 +#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
2107 +#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
2108 +#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
2109 +#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
2110 +#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
2111 +#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
2112 +#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
2113 +#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
2114 +#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
2115 +#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */
2116 +#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */
2117 +#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */
2118 +#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
2119 +#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
2120 +#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
2121 +#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
2122 +#define R_ALPHA_TLS_GD_HI 28
2123 +#define R_ALPHA_TLSGD 29
2124 +#define R_ALPHA_TLS_LDM 30
2125 +#define R_ALPHA_DTPMOD64 31
2126 +#define R_ALPHA_GOTDTPREL 32
2127 +#define R_ALPHA_DTPREL64 33
2128 +#define R_ALPHA_DTPRELHI 34
2129 +#define R_ALPHA_DTPRELLO 35
2130 +#define R_ALPHA_DTPREL16 36
2131 +#define R_ALPHA_GOTTPREL 37
2132 +#define R_ALPHA_TPREL64 38
2133 +#define R_ALPHA_TPRELHI 39
2134 +#define R_ALPHA_TPRELLO 40
2135 +#define R_ALPHA_TPREL16 41
2136 +/* Keep this the last entry. */
2137 +#define R_ALPHA_NUM 46
2139 +/* Magic values of the LITUSE relocation addend. */
2140 +#define LITUSE_ALPHA_ADDR 0
2141 +#define LITUSE_ALPHA_BASE 1
2142 +#define LITUSE_ALPHA_BYTOFF 2
2143 +#define LITUSE_ALPHA_JSR 3
2144 +#define LITUSE_ALPHA_TLS_GD 4
2145 +#define LITUSE_ALPHA_TLS_LDM 5
2147 +/* Legal values for d_tag of Elf64_Dyn. */
2148 +#define DT_ALPHA_PLTRO (DT_LOPROC + 0)
2149 +#define DT_ALPHA_NUM 1
2151 +/* PowerPC specific declarations */
2153 +/* Values for Elf32/64_Ehdr.e_flags. */
2154 +#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */
2156 +/* Cygnus local bits below */
2157 +#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
2158 +#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib
2161 +/* PowerPC relocations defined by the ABIs */
2162 +#define R_PPC_NONE 0
2163 +#define R_PPC_ADDR32 1 /* 32bit absolute address */
2164 +#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
2165 +#define R_PPC_ADDR16 3 /* 16bit absolute address */
2166 +#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
2167 +#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
2168 +#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
2169 +#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
2170 +#define R_PPC_ADDR14_BRTAKEN 8
2171 +#define R_PPC_ADDR14_BRNTAKEN 9
2172 +#define R_PPC_REL24 10 /* PC relative 26 bit */
2173 +#define R_PPC_REL14 11 /* PC relative 16 bit */
2174 +#define R_PPC_REL14_BRTAKEN 12
2175 +#define R_PPC_REL14_BRNTAKEN 13
2176 +#define R_PPC_GOT16 14
2177 +#define R_PPC_GOT16_LO 15
2178 +#define R_PPC_GOT16_HI 16
2179 +#define R_PPC_GOT16_HA 17
2180 +#define R_PPC_PLTREL24 18
2181 +#define R_PPC_COPY 19
2182 +#define R_PPC_GLOB_DAT 20
2183 +#define R_PPC_JMP_SLOT 21
2184 +#define R_PPC_RELATIVE 22
2185 +#define R_PPC_LOCAL24PC 23
2186 +#define R_PPC_UADDR32 24
2187 +#define R_PPC_UADDR16 25
2188 +#define R_PPC_REL32 26
2189 +#define R_PPC_PLT32 27
2190 +#define R_PPC_PLTREL32 28
2191 +#define R_PPC_PLT16_LO 29
2192 +#define R_PPC_PLT16_HI 30
2193 +#define R_PPC_PLT16_HA 31
2194 +#define R_PPC_SDAREL16 32
2195 +#define R_PPC_SECTOFF 33
2196 +#define R_PPC_SECTOFF_LO 34
2197 +#define R_PPC_SECTOFF_HI 35
2198 +#define R_PPC_SECTOFF_HA 36
2200 +/* PowerPC relocations defined for the TLS access ABI. */
2201 +#define R_PPC_TLS 67 /* none (sym+add)@tls */
2202 +#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */
2203 +#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */
2204 +#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
2205 +#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
2206 +#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
2207 +#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */
2208 +#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */
2209 +#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
2210 +#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
2211 +#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
2212 +#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */
2213 +#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
2214 +#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
2215 +#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
2216 +#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
2217 +#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
2218 +#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
2219 +#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
2220 +#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
2221 +#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */
2222 +#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */
2223 +#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
2224 +#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
2225 +#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */
2226 +#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */
2227 +#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */
2228 +#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */
2230 +/* Keep this the last entry. */
2231 +#define R_PPC_NUM 95
2233 +/* The remaining relocs are from the Embedded ELF ABI, and are not
2234 + in the SVR4 ELF ABI. */
2235 +#define R_PPC_EMB_NADDR32 101
2236 +#define R_PPC_EMB_NADDR16 102
2237 +#define R_PPC_EMB_NADDR16_LO 103
2238 +#define R_PPC_EMB_NADDR16_HI 104
2239 +#define R_PPC_EMB_NADDR16_HA 105
2240 +#define R_PPC_EMB_SDAI16 106
2241 +#define R_PPC_EMB_SDA2I16 107
2242 +#define R_PPC_EMB_SDA2REL 108
2243 +#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
2244 +#define R_PPC_EMB_MRKREF 110
2245 +#define R_PPC_EMB_RELSEC16 111
2246 +#define R_PPC_EMB_RELST_LO 112
2247 +#define R_PPC_EMB_RELST_HI 113
2248 +#define R_PPC_EMB_RELST_HA 114
2249 +#define R_PPC_EMB_BIT_FLD 115
2250 +#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
2252 +/* Diab tool relocations. */
2253 +#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
2254 +#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
2255 +#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
2256 +#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
2257 +#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
2258 +#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
2260 +/* GNU relocs used in PIC code sequences. */
2261 +#define R_PPC_REL16 249 /* word32 (sym-.) */
2262 +#define R_PPC_REL16_LO 250 /* half16 (sym-.)@l */
2263 +#define R_PPC_REL16_HI 251 /* half16 (sym-.)@h */
2264 +#define R_PPC_REL16_HA 252 /* half16 (sym-.)@ha */
2266 +/* This is a phony reloc to handle any old fashioned TOC16 references
2267 + that may still be in object files. */
2268 +#define R_PPC_TOC16 255
2270 +/* PowerPC specific values for the Dyn d_tag field. */
2271 +#define DT_PPC_GOT (DT_LOPROC + 0)
2272 +#define DT_PPC_NUM 1
2274 +/* PowerPC64 relocations defined by the ABIs */
2275 +#define R_PPC64_NONE R_PPC_NONE
2276 +#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */
2277 +#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */
2278 +#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */
2279 +#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */
2280 +#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */
2281 +#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */
2282 +#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */
2283 +#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
2284 +#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
2285 +#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */
2286 +#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */
2287 +#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
2288 +#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
2289 +#define R_PPC64_GOT16 R_PPC_GOT16
2290 +#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
2291 +#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
2292 +#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
2294 +#define R_PPC64_COPY R_PPC_COPY
2295 +#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
2296 +#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
2297 +#define R_PPC64_RELATIVE R_PPC_RELATIVE
2299 +#define R_PPC64_UADDR32 R_PPC_UADDR32
2300 +#define R_PPC64_UADDR16 R_PPC_UADDR16
2301 +#define R_PPC64_REL32 R_PPC_REL32
2302 +#define R_PPC64_PLT32 R_PPC_PLT32
2303 +#define R_PPC64_PLTREL32 R_PPC_PLTREL32
2304 +#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
2305 +#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
2306 +#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
2308 +#define R_PPC64_SECTOFF R_PPC_SECTOFF
2309 +#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
2310 +#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
2311 +#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
2312 +#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */
2313 +#define R_PPC64_ADDR64 38 /* doubleword64 S + A */
2314 +#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */
2315 +#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */
2316 +#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */
2317 +#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */
2318 +#define R_PPC64_UADDR64 43 /* doubleword64 S + A */
2319 +#define R_PPC64_REL64 44 /* doubleword64 S + A - P */
2320 +#define R_PPC64_PLT64 45 /* doubleword64 L + A */
2321 +#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */
2322 +#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */
2323 +#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */
2324 +#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */
2325 +#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */
2326 +#define R_PPC64_TOC 51 /* doubleword64 .TOC */
2327 +#define R_PPC64_PLTGOT16 52 /* half16* M + A */
2328 +#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */
2329 +#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */
2330 +#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */
2332 +#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */
2333 +#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */
2334 +#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */
2335 +#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */
2336 +#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */
2337 +#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */
2338 +#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */
2339 +#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */
2340 +#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */
2341 +#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */
2342 +#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */
2344 +/* PowerPC64 relocations defined for the TLS access ABI. */
2345 +#define R_PPC64_TLS 67 /* none (sym+add)@tls */
2346 +#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */
2347 +#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */
2348 +#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
2349 +#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
2350 +#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
2351 +#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */
2352 +#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */
2353 +#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
2354 +#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
2355 +#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
2356 +#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */
2357 +#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
2358 +#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
2359 +#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
2360 +#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
2361 +#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
2362 +#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
2363 +#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
2364 +#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
2365 +#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */
2366 +#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */
2367 +#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
2368 +#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
2369 +#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */
2370 +#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */
2371 +#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */
2372 +#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */
2373 +#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */
2374 +#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */
2375 +#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */
2376 +#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */
2377 +#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */
2378 +#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */
2379 +#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */
2380 +#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */
2381 +#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */
2382 +#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */
2383 +#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */
2384 +#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */
2386 +/* Keep this the last entry. */
2387 +#define R_PPC64_NUM 107
2389 +/* PowerPC64 specific values for the Dyn d_tag field. */
2390 +#define DT_PPC64_GLINK (DT_LOPROC + 0)
2391 +#define DT_PPC64_OPD (DT_LOPROC + 1)
2392 +#define DT_PPC64_OPDSZ (DT_LOPROC + 2)
2393 +#define DT_PPC64_NUM 3
2396 +/* ARM specific declarations */
2398 +/* Processor specific flags for the ELF header e_flags field. */
2399 +#define EF_ARM_RELEXEC 0x01
2400 +#define EF_ARM_HASENTRY 0x02
2401 +#define EF_ARM_INTERWORK 0x04
2402 +#define EF_ARM_APCS_26 0x08
2403 +#define EF_ARM_APCS_FLOAT 0x10
2404 +#define EF_ARM_PIC 0x20
2405 +#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */
2406 +#define EF_ARM_NEW_ABI 0x80
2407 +#define EF_ARM_OLD_ABI 0x100
2409 +/* Other constants defined in the ARM ELF spec. version B-01. */
2410 +/* NB. These conflict with values defined above. */
2411 +#define EF_ARM_SYMSARESORTED 0x04
2412 +#define EF_ARM_DYNSYMSUSESEGIDX 0x08
2413 +#define EF_ARM_MAPSYMSFIRST 0x10
2414 +#define EF_ARM_EABIMASK 0XFF000000
2416 +#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
2417 +#define EF_ARM_EABI_UNKNOWN 0x00000000
2418 +#define EF_ARM_EABI_VER1 0x01000000
2419 +#define EF_ARM_EABI_VER2 0x02000000
2421 +/* Additional symbol types for Thumb */
2422 +#define STT_ARM_TFUNC 0xd
2424 +/* ARM-specific values for sh_flags */
2425 +#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */
2426 +#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined
2427 + in the input to a link step */
2429 +/* ARM-specific program header flags */
2430 +#define PF_ARM_SB 0x10000000 /* Segment contains the location
2431 + addressed by the static base */
2433 +/* Processor specific values for the Phdr p_type field. */
2434 +#define PT_ARM_EXIDX 0x70000001 /* .ARM.exidx segment */
2438 +#define R_ARM_NONE 0 /* No reloc */
2439 +#define R_ARM_PC24 1 /* PC relative 26 bit branch */
2440 +#define R_ARM_ABS32 2 /* Direct 32 bit */
2441 +#define R_ARM_REL32 3 /* PC relative 32 bit */
2442 +#define R_ARM_PC13 4
2443 +#define R_ARM_ABS16 5 /* Direct 16 bit */
2444 +#define R_ARM_ABS12 6 /* Direct 12 bit */
2445 +#define R_ARM_THM_ABS5 7
2446 +#define R_ARM_ABS8 8 /* Direct 8 bit */
2447 +#define R_ARM_SBREL32 9
2448 +#define R_ARM_THM_PC22 10
2449 +#define R_ARM_THM_PC8 11
2450 +#define R_ARM_AMP_VCALL9 12
2451 +#define R_ARM_SWI24 13
2452 +#define R_ARM_THM_SWI8 14
2453 +#define R_ARM_XPC25 15
2454 +#define R_ARM_THM_XPC22 16
2455 +#define R_ARM_COPY 20 /* Copy symbol at runtime */
2456 +#define R_ARM_GLOB_DAT 21 /* Create GOT entry */
2457 +#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */
2458 +#define R_ARM_RELATIVE 23 /* Adjust by program base */
2459 +#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */
2460 +#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */
2461 +#define R_ARM_GOT32 26 /* 32 bit GOT entry */
2462 +#define R_ARM_PLT32 27 /* 32 bit PLT address */
2463 +#define R_ARM_ALU_PCREL_7_0 32
2464 +#define R_ARM_ALU_PCREL_15_8 33
2465 +#define R_ARM_ALU_PCREL_23_15 34
2466 +#define R_ARM_LDR_SBREL_11_0 35
2467 +#define R_ARM_ALU_SBREL_19_12 36
2468 +#define R_ARM_ALU_SBREL_27_20 37
2469 +#define R_ARM_GNU_VTENTRY 100
2470 +#define R_ARM_GNU_VTINHERIT 101
2471 +#define R_ARM_THM_PC11 102 /* thumb unconditional branch */
2472 +#define R_ARM_THM_PC9 103 /* thumb conditional branch */
2473 +#define R_ARM_RXPC25 249
2474 +#define R_ARM_RSBREL32 250
2475 +#define R_ARM_THM_RPC22 251
2476 +#define R_ARM_RREL32 252
2477 +#define R_ARM_RABS22 253
2478 +#define R_ARM_RPC24 254
2479 +#define R_ARM_RBASE 255
2480 +/* Keep this the last entry. */
2481 +#define R_ARM_NUM 256
2483 +/* IA-64 specific declarations. */
2485 +/* Processor specific flags for the Ehdr e_flags field. */
2486 +#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */
2487 +#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */
2488 +#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */
2490 +/* Processor specific values for the Phdr p_type field. */
2491 +#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */
2492 +#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */
2493 +#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12)
2494 +#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13)
2495 +#define PT_IA_64_HP_STACK (PT_LOOS + 0x14)
2497 +/* Processor specific flags for the Phdr p_flags field. */
2498 +#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */
2500 +/* Processor specific values for the Shdr sh_type field. */
2501 +#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */
2502 +#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */
2504 +/* Processor specific flags for the Shdr sh_flags field. */
2505 +#define SHF_IA_64_SHORT 0x10000000 /* section near gp */
2506 +#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */
2508 +/* Processor specific values for the Dyn d_tag field. */
2509 +#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0)
2510 +#define DT_IA_64_NUM 1
2512 +/* IA-64 relocations. */
2513 +#define R_IA64_NONE 0x00 /* none */
2514 +#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */
2515 +#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */
2516 +#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */
2517 +#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */
2518 +#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */
2519 +#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */
2520 +#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */
2521 +#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */
2522 +#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */
2523 +#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */
2524 +#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */
2525 +#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */
2526 +#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */
2527 +#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */
2528 +#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */
2529 +#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */
2530 +#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */
2531 +#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */
2532 +#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */
2533 +#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */
2534 +#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */
2535 +#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */
2536 +#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */
2537 +#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */
2538 +#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */
2539 +#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */
2540 +#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */
2541 +#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */
2542 +#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */
2543 +#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */
2544 +#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */
2545 +#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */
2546 +#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */
2547 +#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */
2548 +#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */
2549 +#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */
2550 +#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */
2551 +#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */
2552 +#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */
2553 +#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */
2554 +#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */
2555 +#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */
2556 +#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */
2557 +#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */
2558 +#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */
2559 +#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */
2560 +#define R_IA64_REL32MSB 0x6c /* data 4 + REL */
2561 +#define R_IA64_REL32LSB 0x6d /* data 4 + REL */
2562 +#define R_IA64_REL64MSB 0x6e /* data 8 + REL */
2563 +#define R_IA64_REL64LSB 0x6f /* data 8 + REL */
2564 +#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */
2565 +#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */
2566 +#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */
2567 +#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */
2568 +#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */
2569 +#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */
2570 +#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */
2571 +#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */
2572 +#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */
2573 +#define R_IA64_COPY 0x84 /* copy relocation */
2574 +#define R_IA64_SUB 0x85 /* Addend and symbol difference */
2575 +#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */
2576 +#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */
2577 +#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */
2578 +#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */
2579 +#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */
2580 +#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */
2581 +#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */
2582 +#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */
2583 +#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */
2584 +#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */
2585 +#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */
2586 +#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */
2587 +#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */
2588 +#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */
2589 +#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */
2590 +#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */
2591 +#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */
2592 +#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */
2593 +#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */
2595 +/* SH specific declarations */
2597 +/* SH specific values for `st_other'. */
2599 +/* If set, this is a symbol pointing to SHmedia code, which will be branched
2600 + to, so need to add 1 to the symbol value. */
2601 +#define STO_SH5_ISA32 (1 << 2)
2604 +#define R_SH_NONE 0
2605 +#define R_SH_DIR32 1
2606 +#define R_SH_REL32 2
2607 +#define R_SH_DIR8WPN 3
2608 +#define R_SH_IND12W 4
2609 +#define R_SH_DIR8WPL 5
2610 +#define R_SH_DIR8WPZ 6
2611 +#define R_SH_DIR8BP 7
2612 +#define R_SH_DIR8W 8
2613 +#define R_SH_DIR8L 9
2614 +#define R_SH_SWITCH16 25
2615 +#define R_SH_SWITCH32 26
2616 +#define R_SH_USES 27
2617 +#define R_SH_COUNT 28
2618 +#define R_SH_ALIGN 29
2619 +#define R_SH_CODE 30
2620 +#define R_SH_DATA 31
2621 +#define R_SH_LABEL 32
2622 +#define R_SH_SWITCH8 33
2623 +#define R_SH_GNU_VTINHERIT 34
2624 +#define R_SH_GNU_VTENTRY 35
2625 +#define R_SH_TLS_GD_32 144
2626 +#define R_SH_TLS_LD_32 145
2627 +#define R_SH_TLS_LDO_32 146
2628 +#define R_SH_TLS_IE_32 147
2629 +#define R_SH_TLS_LE_32 148
2630 +#define R_SH_TLS_DTPMOD32 149
2631 +#define R_SH_TLS_DTPOFF32 150
2632 +#define R_SH_TLS_TPOFF32 151
2633 +#define R_SH_GOT32 160
2634 +#define R_SH_PLT32 161
2635 +#define R_SH_COPY 162
2636 +#define R_SH_GLOB_DAT 163
2637 +#define R_SH_JMP_SLOT 164
2638 +#define R_SH_RELATIVE 165
2639 +#define R_SH_GOTOFF 166
2640 +#define R_SH_GOTPC 167
2641 +#define R_SH_RELATIVE_LOW16 197
2642 +#define R_SH_RELATIVE_MEDLOW16 198
2643 +#define R_SH_IMM_LOW16 246
2644 +#define R_SH_IMM_LOW16_PCREL 247
2645 +#define R_SH_IMM_MEDLOW16 248
2646 +#define R_SH_IMM_MEDLOW16_PCREL 249
2648 +/* Keep this the last entry. */
2649 +#define R_SH_NUM 256
2651 +/* Additional s390 relocs */
2653 +#define R_390_NONE 0 /* No reloc. */
2654 +#define R_390_8 1 /* Direct 8 bit. */
2655 +#define R_390_12 2 /* Direct 12 bit. */
2656 +#define R_390_16 3 /* Direct 16 bit. */
2657 +#define R_390_32 4 /* Direct 32 bit. */
2658 +#define R_390_PC32 5 /* PC relative 32 bit. */
2659 +#define R_390_GOT12 6 /* 12 bit GOT offset. */
2660 +#define R_390_GOT32 7 /* 32 bit GOT offset. */
2661 +#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */
2662 +#define R_390_COPY 9 /* Copy symbol at runtime. */
2663 +#define R_390_GLOB_DAT 10 /* Create GOT entry. */
2664 +#define R_390_JMP_SLOT 11 /* Create PLT entry. */
2665 +#define R_390_RELATIVE 12 /* Adjust by program base. */
2666 +#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */
2667 +#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */
2668 +#define R_390_GOT16 15 /* 16 bit GOT offset. */
2669 +#define R_390_PC16 16 /* PC relative 16 bit. */
2670 +#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */
2671 +#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */
2672 +#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */
2673 +#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */
2674 +#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */
2675 +#define R_390_64 22 /* Direct 64 bit. */
2676 +#define R_390_PC64 23 /* PC relative 64 bit. */
2677 +#define R_390_GOT64 24 /* 64 bit GOT offset. */
2678 +#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */
2679 +#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */
2680 +#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */
2681 +#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */
2682 +#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */
2683 +#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */
2684 +#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */
2685 +#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */
2686 +#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */
2687 +#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */
2688 +#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */
2689 +#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */
2690 +#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */
2691 +#define R_390_TLS_GDCALL 38 /* Tag for function call in general
2692 + dynamic TLS code. */
2693 +#define R_390_TLS_LDCALL 39 /* Tag for function call in local
2694 + dynamic TLS code. */
2695 +#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic
2696 + thread local data. */
2697 +#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic
2698 + thread local data. */
2699 +#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS
2701 +#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS
2703 +#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS
2705 +#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic
2706 + thread local data in LE code. */
2707 +#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic
2708 + thread local data in LE code. */
2709 +#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for
2710 + negated static TLS block offset. */
2711 +#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for
2712 + negated static TLS block offset. */
2713 +#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for
2714 + negated static TLS block offset. */
2715 +#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to
2716 + static TLS block. */
2717 +#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to
2718 + static TLS block. */
2719 +#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS
2721 +#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS
2723 +#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */
2724 +#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */
2725 +#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS
2727 +#define R_390_20 57 /* Direct 20 bit. */
2728 +#define R_390_GOT20 58 /* 20 bit GOT offset. */
2729 +#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */
2730 +#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS
2732 +/* Keep this the last entry. */
2733 +#define R_390_NUM 61
2737 +#define EF_CRIS_VARIANT_MASK 0x0000000e
2738 +#define EF_CRIS_VARIANT_ANY_V0_V10 0x00000000
2739 +#define EF_CRIS_VARIANT_V32 0x00000002
2740 +#define EF_CRIS_VARIANT_COMMON_V10_V32 0x00000004
2742 +/* CRIS relocations. */
2743 +#define R_CRIS_NONE 0
2745 +#define R_CRIS_16 2
2746 +#define R_CRIS_32 3
2747 +#define R_CRIS_8_PCREL 4
2748 +#define R_CRIS_16_PCREL 5
2749 +#define R_CRIS_32_PCREL 6
2750 +#define R_CRIS_GNU_VTINHERIT 7
2751 +#define R_CRIS_GNU_VTENTRY 8
2752 +#define R_CRIS_COPY 9
2753 +#define R_CRIS_GLOB_DAT 10
2754 +#define R_CRIS_JUMP_SLOT 11
2755 +#define R_CRIS_RELATIVE 12
2756 +#define R_CRIS_16_GOT 13
2757 +#define R_CRIS_32_GOT 14
2758 +#define R_CRIS_16_GOTPLT 15
2759 +#define R_CRIS_32_GOTPLT 16
2760 +#define R_CRIS_32_GOTREL 17
2761 +#define R_CRIS_32_PLT_GOTREL 18
2762 +#define R_CRIS_32_PLT_PCREL 19
2764 +/* Keep this the last entry. */
2765 +#define R_CRIS_NUM 20
2768 +/* AMD x86-64 relocations. */
2769 +#define R_X86_64_NONE 0 /* No reloc */
2770 +#define R_X86_64_64 1 /* Direct 64 bit */
2771 +#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
2772 +#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
2773 +#define R_X86_64_PLT32 4 /* 32 bit PLT address */
2774 +#define R_X86_64_COPY 5 /* Copy symbol at runtime */
2775 +#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
2776 +#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
2777 +#define R_X86_64_RELATIVE 8 /* Adjust by program base */
2778 +#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative
2780 +#define R_X86_64_32 10 /* Direct 32 bit zero extended */
2781 +#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
2782 +#define R_X86_64_16 12 /* Direct 16 bit zero extended */
2783 +#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
2784 +#define R_X86_64_8 14 /* Direct 8 bit sign extended */
2785 +#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
2786 +#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
2787 +#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */
2788 +#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */
2789 +#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset
2790 + to two GOT entries for GD symbol */
2791 +#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset
2792 + to two GOT entries for LD symbol */
2793 +#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
2794 +#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset
2795 + to GOT entry for IE symbol */
2796 +#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */
2798 +#define R_X86_64_NUM 24
2801 +/* AM33 relocations. */
2802 +#define R_MN10300_NONE 0 /* No reloc. */
2803 +#define R_MN10300_32 1 /* Direct 32 bit. */
2804 +#define R_MN10300_16 2 /* Direct 16 bit. */
2805 +#define R_MN10300_8 3 /* Direct 8 bit. */
2806 +#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */
2807 +#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */
2808 +#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */
2809 +#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */
2810 +#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */
2811 +#define R_MN10300_24 9 /* Direct 24 bit. */
2812 +#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */
2813 +#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */
2814 +#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */
2815 +#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */
2816 +#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */
2817 +#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */
2818 +#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */
2819 +#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */
2820 +#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */
2821 +#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */
2822 +#define R_MN10300_COPY 20 /* Copy symbol at runtime. */
2823 +#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */
2824 +#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */
2825 +#define R_MN10300_RELATIVE 23 /* Adjust by program base. */
2827 +#define R_MN10300_NUM 24
2831 +#define R_M32R_NONE 0 /* No reloc. */
2832 +#define R_M32R_16 1 /* Direct 16 bit. */
2833 +#define R_M32R_32 2 /* Direct 32 bit. */
2834 +#define R_M32R_24 3 /* Direct 24 bit. */
2835 +#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */
2836 +#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */
2837 +#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */
2838 +#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */
2839 +#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */
2840 +#define R_M32R_LO16 9 /* Low 16 bit. */
2841 +#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */
2842 +#define R_M32R_GNU_VTINHERIT 11
2843 +#define R_M32R_GNU_VTENTRY 12
2844 +/* M32R relocs use SHT_RELA. */
2845 +#define R_M32R_16_RELA 33 /* Direct 16 bit. */
2846 +#define R_M32R_32_RELA 34 /* Direct 32 bit. */
2847 +#define R_M32R_24_RELA 35 /* Direct 24 bit. */
2848 +#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */
2849 +#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */
2850 +#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */
2851 +#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */
2852 +#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */
2853 +#define R_M32R_LO16_RELA 41 /* Low 16 bit */
2854 +#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */
2855 +#define R_M32R_RELA_GNU_VTINHERIT 43
2856 +#define R_M32R_RELA_GNU_VTENTRY 44
2858 +#define R_M32R_GOT24 48 /* 24 bit GOT entry */
2859 +#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */
2860 +#define R_M32R_COPY 50 /* Copy symbol at runtime */
2861 +#define R_M32R_GLOB_DAT 51 /* Create GOT entry */
2862 +#define R_M32R_JMP_SLOT 52 /* Create PLT entry */
2863 +#define R_M32R_RELATIVE 53 /* Adjust by program base */
2864 +#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */
2865 +#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */
2866 +#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned
2868 +#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed
2870 +#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */
2871 +#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to
2872 + GOT with unsigned low */
2873 +#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to
2874 + GOT with signed low */
2875 +#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to
2877 +#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT
2878 + with unsigned low */
2879 +#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT
2880 + with signed low */
2881 +#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */
2882 +#define R_M32R_NUM 256 /* Keep this the last entry. */
2884 +/* i960 Relocations */
2885 +#define R_960_NONE 0
2888 +#define R_960_IP24 3
2889 +#define R_960_SUB 4
2890 +#define R_960_OPTCALL 5
2891 +#define R_960_OPTCALLX 6
2892 +#define R_960_OPTCALLXA 7
2893 +/* Keep this the last entry. */
2894 +#define R_960_NUM 8
2897 +/* v850 relocations. */
2898 +#define R_V850_NONE 0
2899 +#define R_V850_9_PCREL 1
2900 +#define R_V850_22_PCREL 2
2901 +#define R_V850_HI16_S 3
2902 +#define R_V850_HI16 4
2903 +#define R_V850_LO16 5
2904 +#define R_V850_32 6
2905 +#define R_V850_16 7
2907 +#define R_V850_SDA_16_16_OFFSET 9 /* For ld.b, st.b, set1, clr1,
2908 + not1, tst1, movea, movhi */
2909 +#define R_V850_SDA_15_16_OFFSET 10 /* For ld.w, ld.h, ld.hu, st.w, st.h */
2910 +#define R_V850_ZDA_16_16_OFFSET 11 /* For ld.b, st.b, set1, clr1,
2911 + not1, tst1, movea, movhi */
2912 +#define R_V850_ZDA_15_16_OFFSET 12 /* For ld.w, ld.h, ld.hu, st.w, st.h */
2913 +#define R_V850_TDA_6_8_OFFSET 13 /* For sst.w, sld.w */
2914 +#define R_V850_TDA_7_8_OFFSET 14 /* For sst.h, sld.h */
2915 +#define R_V850_TDA_7_7_OFFSET 15 /* For sst.b, sld.b */
2916 +#define R_V850_TDA_16_16_OFFSET 16 /* For set1, clr1, not1, tst1,
2918 +/* CYGNUS LOCAL v850e */
2919 +#define R_V850_TDA_4_5_OFFSET 17 /* For sld.hu */
2920 +#define R_V850_TDA_4_4_OFFSET 18 /* For sld.bu */
2921 +#define R_V850_SDA_16_16_SPLIT_OFFSET 19 /* For ld.bu */
2922 +#define R_V850_ZDA_16_16_SPLIT_OFFSET 20 /* For ld.bu */
2923 +#define R_V850_CALLT_6_7_OFFSET 21 /* For callt */
2924 +#define R_V850_CALLT_16_16_OFFSET 22 /* For callt */
2925 +/* END CYGNUS LOCAL */
2926 +#define R_V850_GNU_VTINHERIT 23
2927 +#define R_V850_GNU_VTENTRY 24
2928 +/* Keep this the last entry. */
2929 +#define R_V850_NUM 25
2932 +/* Renesas H8/300 Relocations */
2933 +#define R_H8_NONE 0
2934 +#define R_H8_DIR32 1
2935 +#define R_H8_DIR32_28 2
2936 +#define R_H8_DIR32_24 3
2937 +#define R_H8_DIR32_16 4
2938 +#define R_H8_DIR32U 6
2939 +#define R_H8_DIR32U_28 7
2940 +#define R_H8_DIR32U_24 8
2941 +#define R_H8_DIR32U_20 9
2942 +#define R_H8_DIR32U_16 10
2943 +#define R_H8_DIR24 11
2944 +#define R_H8_DIR24_20 12
2945 +#define R_H8_DIR24_16 13
2946 +#define R_H8_DIR24U 14
2947 +#define R_H8_DIR24U_20 15
2948 +#define R_H8_DIR24U_16 16
2949 +#define R_H8_DIR16 17
2950 +#define R_H8_DIR16U 18
2951 +#define R_H8_DIR16S_32 19
2952 +#define R_H8_DIR16S_28 20
2953 +#define R_H8_DIR16S_24 21
2954 +#define R_H8_DIR16S_20 22
2955 +#define R_H8_DIR16S 23
2956 +#define R_H8_DIR8 24
2957 +#define R_H8_DIR8U 25
2958 +#define R_H8_DIR8Z_32 26
2959 +#define R_H8_DIR8Z_28 27
2960 +#define R_H8_DIR8Z_24 28
2961 +#define R_H8_DIR8Z_20 29
2962 +#define R_H8_DIR8Z_16 30
2963 +#define R_H8_PCREL16 31
2964 +#define R_H8_PCREL8 32
2965 +#define R_H8_BPOS 33
2966 +#define R_H8_PCREL32 34
2967 +#define R_H8_GOT32O 35
2968 +#define R_H8_GOT16O 36
2969 +#define R_H8_DIR16A8 59
2970 +#define R_H8_DIR16R8 60
2971 +#define R_H8_DIR24A8 61
2972 +#define R_H8_DIR24R8 62
2973 +#define R_H8_DIR32A16 63
2974 +#define R_H8_ABS32 65
2975 +#define R_H8_ABS32A16 127
2976 +#define R_H8_NUM 128
2978 +/* NIOS relocations. */
2979 +#define R_NIOS_NONE 0
2980 +#define R_NIOS_32 1 /* A 32 bit absolute relocation.*/
2981 +#define R_NIOS_LO16_LO5 2 /* A LO-16 5 bit absolute relocation. */
2982 +#define R_NIOS_LO16_HI11 3 /* A LO-16 top 11 bit absolute relocation. */
2983 +#define R_NIOS_HI16_LO5 4 /* A HI-16 5 bit absolute relocation. */
2984 +#define R_NIOS_HI16_HI11 5 /* A HI-16 top 11 bit absolute relocation. */
2985 +#define R_NIOS_PCREL6 6 /* A 6 bit relative relocation. */
2986 +#define R_NIOS_PCREL8 7 /* An 8 bit relative relocation. */
2987 +#define R_NIOS_PCREL11 8 /* An 11 bit relative relocation. */
2988 +#define R_NIOS_16 9 /* A 16 bit absolute relocation. */
2989 +#define R_NIOS_H_LO5 10 /* Low 5-bits of absolute relocation in halfwords. */
2990 +#define R_NIOS_H_HI11 11 /* Top 11 bits of 16-bit absolute relocation in halfwords. */
2991 +#define R_NIOS_H_XLO5 12 /* Low 5 bits of top 16-bits of 32-bit absolute relocation in halfwords. */
2992 +#define R_NIOS_H_XHI11 13 /* Top 11 bits of top 16-bits of 32-bit absolute relocation in halfwords. */
2993 +#define R_NIOS_H_16 14 /* Half-word @h value */
2994 +#define R_NIOS_H_32 15 /* Word @h value */
2995 +#define R_NIOS_GNU_VTINHERIT 200 /* GNU extension to record C++ vtable hierarchy */
2996 +#define R_NIOS_GNU_VTENTRY 201 /* GNU extension to record C++ vtable member usage */
2997 +/* Keep this the last entry. */
2998 +#define R_NIOS_NUM 202
3000 +/* NIOS II relocations */
3001 +#define R_NIOS2_NONE 0
3002 +#define R_NIOS2_S16 1
3003 +#define R_NIOS2_U16 2
3004 +#define R_NIOS2_PCREL16 3
3005 +#define R_NIOS2_CALL26 4
3006 +#define R_NIOS2_IMM5 5
3007 +#define R_NIOS2_CACHE_OPX 6
3008 +#define R_NIOS2_IMM6 7
3009 +#define R_NIOS2_IMM8 8
3010 +#define R_NIOS2_HI16 9
3011 +#define R_NIOS2_LO16 10
3012 +#define R_NIOS2_HIADJ16 11
3013 +#define R_NIOS2_BFD_RELOC_32 12
3014 +#define R_NIOS2_BFD_RELOC_16 13
3015 +#define R_NIOS2_BFD_RELOC_8 14
3016 +#define R_NIOS2_GPREL 15
3017 +#define R_NIOS2_GNU_VTINHERIT 16
3018 +#define R_NIOS2_GNU_VTENTRY 17
3019 +#define R_NIOS2_UJMP 18
3020 +#define R_NIOS2_CJMP 19
3021 +#define R_NIOS2_CALLR 20
3022 +#define R_NIOS2_ALIGN 21
3023 +/* Keep this the last entry. */
3024 +#define R_NIOS2_NUM 22
3029 diff -Nrup a/ldso/include/dl-string.h b/ldso/include/dl-string.h
3030 --- a/ldso/include/dl-string.h 2007-01-25 19:22:03.000000000 -0500
3031 +++ b/ldso/include/dl-string.h 2008-02-28 19:03:13.000000000 -0500
3032 @@ -285,7 +285,9 @@ static __always_inline char * _dl_simple
3033 /* On some arches constant strings are referenced through the GOT.
3034 * This requires that load_addr must already be defined... */
3035 #if defined(mc68000) || defined(__arm__) || defined(__thumb__) || \
3036 - defined(__mips__) || defined(__sh__) || defined(__powerpc__)
3037 + defined(__mips__) || defined(__sh__) || defined(__powerpc__) || \
3038 + defined(__avr32__)
3040 # define CONSTANT_STRING_GOT_FIXUP(X) \
3041 if ((X) < (const char *) load_addr) (X) += load_addr
3042 # define NO_EARLY_SEND_STDERR
3043 diff -Nrup a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h
3044 --- a/ldso/include/dl-syscall.h 2007-01-28 00:51:31.000000000 -0500
3045 +++ b/ldso/include/dl-syscall.h 2008-02-28 19:06:04.000000000 -0500
3047 dynamic linking at all, so we cannot return any error codes.
3048 We just punt if there is an error. */
3049 #define __NR__dl_exit __NR_exit
3050 -static inline _syscall1(void, _dl_exit, int, status);
3051 +static __always_inline _syscall1(void, _dl_exit, int, status);
3053 #define __NR__dl_close __NR_close
3054 -static inline _syscall1(int, _dl_close, int, fd);
3055 +static __always_inline _syscall1(int, _dl_close, int, fd);
3057 #define __NR__dl_open __NR_open
3058 -static inline _syscall3(int, _dl_open, const char *, fn, int, flags,
3059 +static __always_inline _syscall3(int, _dl_open, const char *, fn, int, flags,
3060 __kernel_mode_t, mode);
3062 #define __NR__dl_write __NR_write
3063 -static inline _syscall3(unsigned long, _dl_write, int, fd,
3064 +static __always_inline _syscall3(unsigned long, _dl_write, int, fd,
3065 const void *, buf, unsigned long, count);
3067 #define __NR__dl_read __NR_read
3068 -static inline _syscall3(unsigned long, _dl_read, int, fd,
3069 +static __always_inline _syscall3(unsigned long, _dl_read, int, fd,
3070 const void *, buf, unsigned long, count);
3072 #define __NR__dl_mprotect __NR_mprotect
3073 -static inline _syscall3(int, _dl_mprotect, const void *, addr,
3074 +static __always_inline _syscall3(int, _dl_mprotect, const void *, addr,
3075 unsigned long, len, int, prot);
3077 #define __NR__dl_stat __NR_stat
3078 -static inline _syscall2(int, _dl_stat, const char *, file_name,
3079 +static __always_inline _syscall2(int, _dl_stat, const char *, file_name,
3080 struct stat *, buf);
3082 #define __NR__dl_fstat __NR_fstat
3083 -static inline _syscall2(int, _dl_fstat, int, fd, struct stat *, buf);
3084 +static __always_inline _syscall2(int, _dl_fstat, int, fd, struct stat *, buf);
3086 #define __NR__dl_munmap __NR_munmap
3087 -static inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length);
3088 +static __always_inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length);
3091 # define __NR_getuid __NR_getxuid
3093 #define __NR__dl_getuid __NR_getuid
3094 -static inline _syscall0(uid_t, _dl_getuid);
3095 +static __always_inline _syscall0(uid_t, _dl_getuid);
3097 #ifndef __NR_geteuid
3098 # define __NR_geteuid __NR_getuid
3100 #define __NR__dl_geteuid __NR_geteuid
3101 -static inline _syscall0(uid_t, _dl_geteuid);
3102 +static __always_inline _syscall0(uid_t, _dl_geteuid);
3105 # define __NR_getgid __NR_getxgid
3107 #define __NR__dl_getgid __NR_getgid
3108 -static inline _syscall0(gid_t, _dl_getgid);
3109 +static __always_inline _syscall0(gid_t, _dl_getgid);
3111 #ifndef __NR_getegid
3112 # define __NR_getegid __NR_getgid
3114 #define __NR__dl_getegid __NR_getegid
3115 -static inline _syscall0(gid_t, _dl_getegid);
3116 +static __always_inline _syscall0(gid_t, _dl_getegid);
3119 # define __NR_getpid __NR_getxpid
3121 #define __NR__dl_getpid __NR_getpid
3122 -static inline _syscall0(gid_t, _dl_getpid);
3123 +static __always_inline _syscall0(gid_t, _dl_getpid);
3125 #define __NR__dl_readlink __NR_readlink
3126 -static inline _syscall3(int, _dl_readlink, const char *, path, char *, buf,
3127 +static __always_inline _syscall3(int, _dl_readlink, const char *, path, char *, buf,
3131 @@ -134,14 +134,14 @@ static inline _syscall3(int, _dl_readlin
3132 #if defined(__UCLIBC_MMAP_HAS_6_ARGS__) && defined(__NR_mmap)
3134 # define __NR__dl_mmap __NR_mmap
3135 -static inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
3136 +static __always_inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
3137 int, prot, int, flags, int, fd, off_t, offset);
3139 /* then try mmap2() */
3140 #elif defined(__NR_mmap2)
3142 # define __NR___syscall_mmap2 __NR_mmap2
3143 -static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, size_t, len,
3144 +static __always_inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, size_t, len,
3145 int, prot, int, flags, int, fd, off_t, offset);
3147 /* Some architectures always use 12 as page shift for mmap2() eventhough the
3148 @@ -152,7 +152,7 @@ static inline _syscall6(__ptr_t, __sysca
3149 # define MMAP2_PAGE_SHIFT 12
3152 -static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
3153 +static __always_inline void * _dl_mmap(void * addr, unsigned long size, int prot,
3154 int flags, int fd, unsigned long offset)
3156 if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
3157 @@ -165,8 +165,8 @@ static inline void * _dl_mmap(void * add
3158 #elif defined(__NR_mmap)
3160 # define __NR__dl_mmap_real __NR_mmap
3161 -static inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer);
3162 -static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
3163 +static __always_inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer);
3164 +static __always_inline void * _dl_mmap(void * addr, unsigned long size, int prot,
3165 int flags, int fd, unsigned long offset)
3167 unsigned long buffer[6];
3168 diff -Nrup a/ldso/ldso/avr32/dl-debug.h b/ldso/ldso/avr32/dl-debug.h
3169 --- a/ldso/ldso/avr32/dl-debug.h 1969-12-31 19:00:00.000000000 -0500
3170 +++ b/ldso/ldso/avr32/dl-debug.h 2008-02-28 19:02:10.000000000 -0500
3173 + * AVR32 ELF shared libary loader support
3175 + * Copyright (C) 2005 Atmel Norway
3176 + * All rights reserved.
3178 + * Redistribution and use in source and binary forms, with or without
3179 + * modification, are permitted provided that the following conditions
3181 + * 1. Redistributions of source code must retain the above copyright
3182 + * notice, this list of conditions and the following disclaimer.
3183 + * 2. The name of the above contributors may not be
3184 + * used to endorse or promote products derived from this software
3185 + * without specific prior written permission.
3187 + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
3188 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3189 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3190 + * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
3191 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3192 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3193 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3194 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3195 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3196 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3200 +static const char *_dl_reltypes_tab[] = {
3202 + "R_AVR32_32", "R_AVR32_16", "R_AVR32_8",
3203 + "R_AVR32_32_PCREL", "R_AVR32_16_PCREL", "R_AVR32_8_PCREL",
3204 + "R_AVR32_DIFF32", "R_AVR32_DIFF16", "R_AVR32_DIFF8",
3205 + "R_AVR32_GOT32", "R_AVR32_GOT16", "R_AVR32_GOT8",
3206 + "R_AVR32_21S", "R_AVR32_16U", "R_AVR32_16S", "R_AVR32_8S", "R_AVR32_8S_EXT",
3207 + "R_AVR32_22H_PCREL", "R_AVR32_18W_PCREL", "R_AVR32_16B_PCREL",
3208 + "R_AVR32_16N_PCREL", "R_AVR32_14UW_PCREL", "R_AVR32_11H_PCREL",
3209 + "R_AVR32_10UW_PCREL", "R_AVR32_9H_PCREL", "R_AVR32_9UW_PCREL",
3210 + "R_AVR32_HI16", "R_AVR32_LO16",
3211 + "R_AVR32_GOTPC", "R_AVR32_GOTCALL", "R_AVR32_LDA_GOT",
3212 + "R_AVR32_GOT21S", "R_AVR32_GOT18SW", "R_AVR32_GOT16S", "R_AVR32_GOT7UW",
3213 + "R_AVR32_32_CPENT", "R_AVR32_CPCALL", "R_AVR32_16_CP", "R_AVR32_9W_CP",
3214 + "R_AVR32_RELATIVE", "R_AVR32_GLOB_DAT", "R_AVR32_JMP_SLOT",
3217 diff -Nrup a/ldso/ldso/avr32/dl-startup.h b/ldso/ldso/avr32/dl-startup.h
3218 --- a/ldso/ldso/avr32/dl-startup.h 1969-12-31 19:00:00.000000000 -0500
3219 +++ b/ldso/ldso/avr32/dl-startup.h 2008-02-28 19:02:10.000000000 -0500
3221 +/* vi: set sw=4 ts=4: */
3223 + * Architecture specific code used by dl-startup.c
3224 + * Copyright (C) 2005 Atmel Norway
3227 +/* This is the library loader's main entry point. Let _dl_boot2 do its
3228 + * initializations and jump to the application's entry point
3231 + " .global _start\n"
3232 + " .type _start,@function\n"
3234 + /* All arguments are on the stack initially */
3236 + " rcall _dl_start\n"
3237 + /* Returns user entry point in r12. Save it. */
3239 + /* We're PIC, so get the Global Offset Table */
3240 + " lddpc r6, .L_GOT\n"
3243 + /* Adjust argc and argv according to _dl_skip_args */
3244 + " ld.w r1, r6[_dl_skip_args@got]\n"
3245 + " ld.w r1, r1[0]\n"
3246 + " ld.w r2, sp++\n"
3248 + " add sp, sp, r1 << 2\n"
3249 + " st.w --sp, r2\n"
3250 + /* Load the finalizer function */
3251 + " ld.w r12, r6[_dl_fini@got]\n"
3252 + /* Jump to the user's entry point */
3257 + " .long .L_RGOT - _GLOBAL_OFFSET_TABLE_\n"
3258 + " .size _start, . - _start\n"
3261 +/* Get a pointer to the argv array. On many platforms this can be just
3262 + * the address if the first argument, on other platforms we need to
3263 + * do something a little more subtle here. */
3264 +#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long *)ARGS + 1)
3267 +/* We can't call functions before the GOT has been initialized */
3268 +#define NO_FUNCS_BEFORE_BOOTSTRAP
3271 + * Relocate the GOT during dynamic loader bootstrap. This will add
3272 + * the load address to all entries in the GOT, which is necessary
3273 + * because the linker doesn't generate R_AVR32_RELATIVE relocs for the
3276 +static __always_inline
3277 +void PERFORM_BOOTSTRAP_GOT(struct elf_resolve *tpnt)
3279 + Elf32_Addr i, nr_got;
3280 + register Elf32_Addr *__r6 __asm__("r6");
3281 + Elf32_Addr *got = __r6;
3283 + nr_got = tpnt->dynamic_info[DT_AVR32_GOTSZ_IDX] / sizeof(*got);
3284 + for (i = 2; i < nr_got; i++)
3285 + got[i] += tpnt->loadaddr;
3288 +#define PERFORM_BOOTSTRAP_GOT(tpnt) PERFORM_BOOTSTRAP_GOT(tpnt)
3290 +/* Handle relocation of the symbols in the dynamic loader. */
3291 +static __always_inline
3292 +void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
3293 + unsigned long symbol_addr,
3294 + unsigned long load_addr, Elf32_Sym *symtab)
3296 + switch(ELF32_R_TYPE(rpnt->r_info)) {
3297 + case R_AVR32_NONE:
3299 + case R_AVR32_GLOB_DAT:
3300 + case R_AVR32_JMP_SLOT:
3301 + *reloc_addr = symbol_addr;
3303 + case R_AVR32_RELATIVE:
3304 + SEND_STDERR_DEBUG("Applying RELATIVE relocation: ");
3305 + SEND_ADDRESS_STDERR_DEBUG(load_addr, 0);
3306 + SEND_STDERR_DEBUG(" + ");
3307 + SEND_ADDRESS_STDERR_DEBUG(rpnt->r_addend, 1);
3308 + *reloc_addr = load_addr + rpnt->r_addend;
3311 + SEND_STDERR("BOOTSTRAP_RELOC: unhandled reloc_type ");
3312 + SEND_NUMBER_STDERR(ELF32_R_TYPE(rpnt->r_info), 1);
3313 + SEND_STDERR("REL, SYMBOL, LOAD: ");
3314 + SEND_ADDRESS_STDERR(reloc_addr, 0);
3315 + SEND_STDERR(", ");
3316 + SEND_ADDRESS_STDERR(symbol_addr, 0);
3317 + SEND_STDERR(", ");
3318 + SEND_ADDRESS_STDERR(load_addr, 1);
3323 +/* Transfer control to the user's application, once the dynamic loader
3324 + * is done. This routine has to exit the current function, then call
3325 + * the _dl_elf_main function.
3327 + * Since our _dl_boot will simply call whatever is returned by
3328 + * _dl_boot2, we can just return the address we're supposed to
3330 +#define START() return _dl_elf_main;
3331 diff -Nrup a/ldso/ldso/avr32/dl-syscalls.h b/ldso/ldso/avr32/dl-syscalls.h
3332 --- a/ldso/ldso/avr32/dl-syscalls.h 1969-12-31 19:00:00.000000000 -0500
3333 +++ b/ldso/ldso/avr32/dl-syscalls.h 2008-02-28 19:02:10.000000000 -0500
3335 +/* We can't use the real errno in ldso, since it has not yet
3336 + * been dynamicly linked in yet. */
3337 +extern int _dl_errno;
3338 +#define __set_errno(X) {(_dl_errno) = (X);}
3339 +#include "sys/syscall.h"
3340 diff -Nrup a/ldso/ldso/avr32/dl-sysdep.h b/ldso/ldso/avr32/dl-sysdep.h
3341 --- a/ldso/ldso/avr32/dl-sysdep.h 1969-12-31 19:00:00.000000000 -0500
3342 +++ b/ldso/ldso/avr32/dl-sysdep.h 2008-02-28 19:02:10.000000000 -0500
3344 +/* vi: set sw=4 ts=4: */
3346 + * Various assembly language/system dependent hacks that are required
3347 + * so that we can minimize the amount of platform specific code.
3348 + * Copyright (C) 2004-2005 Atmel Norway
3351 +/* Define this if the system uses RELOCA. */
3352 +#define ELF_USES_RELOCA
3357 +#define DT_AVR32_GOTSZ_IDX (DT_NUM + OS_NUM)
3359 +#define ARCH_DYNAMIC_INFO(dpnt, dynamic, debug_addr) \
3361 + if (dpnt->d_tag == DT_AVR32_GOTSZ) \
3362 + dynamic[DT_AVR32_GOTSZ_IDX] = dpnt->d_un.d_val; \
3365 +/* Initialization sequence for the application/library GOT. */
3366 +#define INIT_GOT(GOT_BASE,MODULE) \
3368 + unsigned long i, nr_got; \
3370 + GOT_BASE[0] = (unsigned long) _dl_linux_resolve; \
3371 + GOT_BASE[1] = (unsigned long) MODULE; \
3373 + /* Add load address displacement to all GOT entries */ \
3374 + nr_got = MODULE->dynamic_info[DT_AVR32_GOTSZ_IDX] / 4; \
3375 + for (i = 2; i < nr_got; i++) \
3376 + GOT_BASE[i] += (unsigned long)MODULE->loadaddr; \
3379 +#define do_rem(result, n, base) ((result) = (n) % (base))
3381 +/* Here we define the magic numbers that this dynamic loader should accept */
3382 +#define MAGIC1 EM_AVR32
3385 +/* Used for error messages */
3386 +#define ELF_TARGET "AVR32"
3388 +unsigned long _dl_linux_resolver(unsigned long got_offset, unsigned long *got);
3390 +/* 4096 bytes alignment */
3391 +#define PAGE_ALIGN 0xfffff000
3392 +#define ADDR_ALIGN 0xfff
3393 +#define OFFS_ALIGN 0x7ffff000
3395 +#define elf_machine_type_class(type) \
3396 + ((type == R_AVR32_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)
3398 +/* AVR32 doesn't need any COPY relocs */
3399 +#define DL_NO_COPY_RELOCS
3401 +/* Return the link-time address of _DYNAMIC. Conveniently, this is the
3402 + first element of the GOT. This must be inlined in a function which
3403 + uses global data. */
3404 +static inline Elf32_Addr
3405 +elf_machine_dynamic (void)
3407 + register Elf32_Addr *got asm ("r6");
3411 +/* Return the run-time load address of the shared object. */
3412 +static inline Elf32_Addr
3413 +elf_machine_load_address (void)
3415 + extern void __dl_start asm("_dl_start");
3416 + Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
3417 + Elf32_Addr pcrel_addr;
3419 + asm (" lddpc %0, 2f\n"
3423 + "2: .long _dl_start - 1b\n"
3425 + : "=r"(pcrel_addr) : : "cc");
3427 + return pcrel_addr - got_addr;
3431 + * Perform any RELATIVE relocations specified by DT_RELCOUNT.
3432 + * Currently, we don't use that tag, but we might in the future as
3433 + * this would reduce the startup time somewhat (although probably not by much).
3436 +elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
3437 + Elf32_Word relative_count)
3439 + Elf32_Rela *rpnt = (void *)rel_addr;
3442 + Elf32_Addr *reloc_addr;
3443 + reloc_addr = (void *)(load_off + (rpnt++)->r_offset);
3444 + *reloc_addr = load_off + rpnt->r_addend;
3445 + } while (--relative_count);
3447 diff -Nrup a/ldso/ldso/avr32/elfinterp.c b/ldso/ldso/avr32/elfinterp.c
3448 --- a/ldso/ldso/avr32/elfinterp.c 1969-12-31 19:00:00.000000000 -0500
3449 +++ b/ldso/ldso/avr32/elfinterp.c 2008-02-28 19:02:10.000000000 -0500
3452 + * AVR32 ELF shared library loader suppport
3454 + * Copyright (C) 2004-2006 Atmel Corporation
3456 + * All rights reserved.
3458 + * Redistribution and use in source and binary forms, with or without
3459 + * modification, are permitted provided that the following conditions
3461 + * 1. Redistributions of source code must retain the above copyright
3462 + * notice, this list of conditions and the following disclaimer.
3463 + * 2. The name of the above contributors may not be
3464 + * used to endorse or promote products derived from this software
3465 + * without specific prior written permission.
3467 + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
3468 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3469 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3470 + * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
3471 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3472 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3473 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3474 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3475 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3476 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3480 +unsigned long _dl_linux_resolver(unsigned long got_offset, unsigned long *got)
3482 + struct elf_resolve *tpnt = (struct elf_resolve *)got[1];
3484 + unsigned long local_gotno;
3485 + unsigned long gotsym;
3486 + unsigned long new_addr;
3487 + char *strtab, *symname;
3488 + unsigned long *entry;
3489 + unsigned long sym_index = got_offset / 4;
3492 + local_gotno = tpnt->dynamic_info[DT_AVR32_LOCAL_GOTNO];
3493 + gotsym = tpnt->dynamic_info[DT_AVR32_GOTSYM];
3495 + sym = ((Elf32_Sym *)(tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr))
3497 + strtab = (char *)(tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
3498 + symname = strtab + sym->st_name;
3501 + new_addr = (unsigned long) _dl_find_hash(strtab + sym->st_name,
3502 + tpnt->symbol_scope, tpnt,
3506 + entry = (unsigned long *)(got + local_gotno + sym_index - gotsym);
3507 + *entry = new_addr;
3514 +_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
3515 + unsigned long rel_addr, unsigned long rel_size,
3516 + int (*reloc_func)(struct elf_resolve *tpnt, struct dyn_elf *scope,
3517 + Elf32_Rela *rpnt, Elf32_Sym *symtab, char *strtab))
3519 + Elf32_Sym *symtab;
3524 + rpnt = (Elf32_Rela *)rel_addr;
3525 + rel_size /= sizeof(Elf32_Rela);
3526 + symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB];
3527 + strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
3529 + for (i = 0; i < rel_size; i++, rpnt++) {
3530 + int symtab_index, res;
3532 + symtab_index = ELF32_R_SYM(rpnt->r_info);
3534 + debug_sym(symtab, strtab, symtab_index);
3535 + debug_reloc(symtab, strtab, rpnt);
3537 + res = reloc_func(tpnt, scope, rpnt, symtab, strtab);
3542 + _dl_dprintf(2, "\n%s: ", _dl_progname);
3545 + _dl_dprintf(2, "symbol '%s': ",
3546 + strtab + symtab[symtab_index].st_name);
3549 + int reloc_type = ELF32_R_TYPE(rpnt->r_info);
3550 +#if defined(__SUPPORT_LD_DEBUG__)
3551 + _dl_dprintf(2, "can't handle reloc type %s\n",
3552 + _dl_reltypes(reloc_type));
3554 + _dl_dprintf(2, "can't handle reloc type %x\n",
3559 + _dl_dprintf(2, "can't resolve symbol\n");
3567 +static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
3568 + Elf32_Rela *rpnt, Elf32_Sym *symtab, char *strtab)
3573 + unsigned long *reloc_addr;
3574 + unsigned long symbol_addr;
3575 +#if defined(__SUPPORT_LD_DEBUG__)
3576 + unsigned long old_val;
3579 + reloc_addr = (unsigned long *)(tpnt->loadaddr + rpnt->r_offset);
3580 + reloc_type = ELF32_R_TYPE(rpnt->r_info);
3581 + symtab_index = ELF32_R_SYM(rpnt->r_info);
3583 + symname = strtab + symtab[symtab_index].st_name;
3585 + if (symtab_index) {
3586 + symbol_addr = (unsigned long)
3587 + _dl_find_hash(strtab + symtab[symtab_index].st_name,
3588 + tpnt->symbol_scope, tpnt,
3589 + elf_machine_type_class(reloc_type));
3591 + /* Allow undefined references to weak symbols */
3592 + if (!symbol_addr &&
3593 + ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) {
3594 + _dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
3595 + _dl_progname, symname);
3600 +#if defined(__SUPPORT_LD_DEBUG__)
3601 + old_val = *reloc_addr;
3603 + switch (reloc_type) {
3604 + case R_AVR32_NONE:
3606 + case R_AVR32_GLOB_DAT:
3607 + case R_AVR32_JMP_SLOT:
3608 + *reloc_addr = symbol_addr + rpnt->r_addend;
3610 + case R_AVR32_RELATIVE:
3611 + *reloc_addr = (unsigned long)tpnt->loadaddr
3618 +#if defined(__SUPPORT_LD_DEBUG__)
3619 + if (_dl_debug_reloc && _dl_debug_detail)
3620 + _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x\n",
3621 + old_val, *reloc_addr);
3627 +void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
3628 + unsigned long rel_addr,
3629 + unsigned long rel_size)
3631 + /* TODO: Might want to support this in order to get faster
3632 + * startup times... */
3635 +int _dl_parse_relocation_information(struct dyn_elf *rpnt,
3636 + unsigned long rel_addr,
3637 + unsigned long rel_size)
3639 + return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size,
3642 diff -Nrup a/ldso/ldso/avr32/resolve.S b/ldso/ldso/avr32/resolve.S
3643 --- a/ldso/ldso/avr32/resolve.S 1969-12-31 19:00:00.000000000 -0500
3644 +++ b/ldso/ldso/avr32/resolve.S 2008-02-28 19:02:10.000000000 -0500
3647 + * Linux dynamic resolving code for AVR32. Fixes up the GOT entry as
3648 + * indicated in register r12 and jumps to the resolved address.
3650 + * This file is subject to the terms and conditions of the GNU Lesser General
3651 + * Public License. See the file "COPYING.LIB" in the main directory of this
3652 + * archive for more details.
3654 + * Copyright (C) 2004 Atmel Norway
3660 + .global _dl_linux_resolve
3661 + .type _dl_linux_resolve,@function
3663 + /* The PLT code pushed r8 for us. It contains the address of this
3664 + function's GOT entry, that is entry 0. ip contains the address
3665 + of the GOT entry of the function we wanted to call. */
3666 + stm --sp, r9-r12, lr
3669 + rcall _dl_linux_resolver
3673 + .size _dl_linux_resolve, . - _dl_linux_resolve
3674 diff -Nrup a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c
3675 --- a/ldso/ldso/dl-startup.c 2007-01-25 19:22:03.000000000 -0500
3676 +++ b/ldso/ldso/dl-startup.c 2008-02-28 19:02:10.000000000 -0500
3677 @@ -217,7 +217,9 @@ static void * __attribute_used__ _dl_sta
3678 /* some arches (like MIPS) we have to tweak the GOT before relocations */
3679 PERFORM_BOOTSTRAP_GOT(tpnt);
3684 +#if !defined(PERFORM_BOOTSTRAP_GOT) || defined(__avr32__)
3686 /* OK, now do the relocations. We do not do a lazy binding here, so
3687 that once we are done, we have considerably more flexibility. */
3688 @@ -259,7 +261,7 @@ static void * __attribute_used__ _dl_sta
3689 rel_addr += relative_count * sizeof(ELF_RELOC);;
3692 - rpnt = (ELF_RELOC *) (rel_addr + load_addr);
3693 + rpnt = (ELF_RELOC *) (rel_addr /* + load_addr */);
3694 for (i = 0; i < rel_size; i += sizeof(ELF_RELOC), rpnt++) {
3695 reloc_addr = (unsigned long *) (load_addr + (unsigned long) rpnt->r_offset);
3696 symtab_index = ELF_R_SYM(rpnt->r_info);
3697 diff -Nrup a/libc/Makefile b/libc/Makefile
3698 --- a/libc/Makefile 2007-02-28 16:23:09.000000000 -0500
3699 +++ b/libc/Makefile 2008-02-28 19:02:10.000000000 -0500
3700 @@ -59,7 +59,7 @@ $(LIBNAME) shared_$(LIBNAME) ar-target:
3701 $(AR) dN 2 $(LIBNAME) $$objs && \
3702 $(AR) dN 2 $(LIBNAME) $$objs
3703 @for objfile in obj.signal \
3704 - obj.string.generic obj.string.$(TARGET_ARCH) obj.string \
3705 + obj.string obj.string.generic obj.string.$(TARGET_ARCH) \
3706 obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \
3707 if [ -e $$objfile ] ; then \
3708 if [ "$(MAKE_IS_SILENT)" = "n" ] ; then \
3709 diff -Nrup a/libc/string/avr32/bcopy.S b/libc/string/avr32/bcopy.S
3710 --- a/libc/string/avr32/bcopy.S 1969-12-31 19:00:00.000000000 -0500
3711 +++ b/libc/string/avr32/bcopy.S 2008-02-28 19:02:10.000000000 -0500
3714 + * Copyright (C) 2004 Atmel Norway
3719 + .type bcopy, @function
3722 + /* Swap the first two arguments */
3727 + .size bcopy, . - bcopy
3728 diff -Nrup a/libc/string/avr32/bzero.S b/libc/string/avr32/bzero.S
3729 --- a/libc/string/avr32/bzero.S 1969-12-31 19:00:00.000000000 -0500
3730 +++ b/libc/string/avr32/bzero.S 2008-02-28 19:02:10.000000000 -0500
3733 + * Copyright (C) 2004 Atmel Norway
3738 + .type bzero, @function
3744 diff -Nrup a/libc/string/avr32/Makefile b/libc/string/avr32/Makefile
3745 --- a/libc/string/avr32/Makefile 1969-12-31 19:00:00.000000000 -0500
3746 +++ b/libc/string/avr32/Makefile 2008-02-28 19:02:10.000000000 -0500
3748 +# Makefile for uClibc
3750 +# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
3752 +# This program is free software; you can redistribute it and/or modify it under
3753 +# the terms of the GNU Library General Public License as published by the Free
3754 +# Software Foundation; either version 2 of the License, or (at your option) any
3757 +# This program is distributed in the hope that it will be useful, but WITHOUT
3758 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
3759 +# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
3762 +# You should have received a copy of the GNU Library General Public License
3763 +# along with this program; if not, write to the Free Software Foundation, Inc.,
3764 +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3767 +include $(TOPDIR)Rules.mak
3769 +SSRC := bcopy.S bzero.S memcmp.S memcpy.S memmove.S
3770 +SSRC += memset.S strcmp.S strlen.S
3771 +# memchr.S, strcat.S, strcpy.S, strncpy.S is broken
3772 +SOBJS := $(patsubst %.S,%.o, $(SSRC))
3775 +OBJ_LIST:= ../../obj.string.$(TARGET_ARCH)
3779 +$(OBJ_LIST): $(OBJS)
3780 + echo $(addprefix string/$(TARGET_ARCH)/, $(OBJS)) > $@
3783 + $(CC) $(ASFLAGS) -c $< -o $@
3784 + $(STRIPTOOL) -x -R .note -R .comment $@
3787 + $(RM) *.[oa] *~ core
3788 diff -Nrup a/libc/string/avr32/memchr.S b/libc/string/avr32/memchr.S
3789 --- a/libc/string/avr32/memchr.S 1969-12-31 19:00:00.000000000 -0500
3790 +++ b/libc/string/avr32/memchr.S 2008-02-28 19:02:10.000000000 -0500
3793 + * Copyright (C) 2004 Atmel Norway
3802 + .type memchr, @function
3804 + or chr, chr, chr << 8
3805 + or chr, chr, chr << 16
3809 + brne .Lunaligned_str
3814 + psub.b r9, r8, r11
3819 + bfextu r9, r8, 24, 8
3823 + bfextu r9, r8, 16, 8
3827 + bfextu r9, r8, 8, 8
3853 + rjmp .Laligned_search
3854 diff -Nrup a/libc/string/avr32/memcmp.S b/libc/string/avr32/memcmp.S
3855 --- a/libc/string/avr32/memcmp.S 1969-12-31 19:00:00.000000000 -0500
3856 +++ b/libc/string/avr32/memcmp.S 2008-02-28 19:02:10.000000000 -0500
3859 + * Copyright (C) 2004 Atmel Norway.
3868 + .type memcmp, @function
3872 + brlt .Lless_than_4
3896 + bfextu r8, r9, 24, 8
3898 + bfextu r8, r9, 16, 8
3900 + bfextu r8, r9, 8, 8
3904 + .size memcmp, . - memcmp
3908 diff -Nrup a/libc/string/avr32/memcpy.S b/libc/string/avr32/memcpy.S
3909 --- a/libc/string/avr32/memcpy.S 1969-12-31 19:00:00.000000000 -0500
3910 +++ b/libc/string/avr32/memcpy.S 2008-02-28 19:02:10.000000000 -0500
3913 + * Copyright (C) 2004 Atmel Norway
3916 +/* Don't use r12 as dst since we must return it unmodified */
3923 + .type memcpy, @function
3927 + .type __memcpy, @function
3933 + /* If we have less than 32 bytes, don't do anything fancy */
3935 + brge .Lmore_than_31
3948 + /* Check alignment */
3951 + brne .Lunaligned_src
3954 + brne .Lunaligned_dst
3958 + brlt .Lless_than_32
3960 +1: /* Copy 32 bytes at a time */
3969 + /* Copy 16 more bytes if possible */
3971 + brlt .Lless_than_16
3979 + /* Do the remaining as byte copies */
3981 + add pc, pc, len << 2
3990 + /* Make src cacheline-aligned. r8 = (src & 31) */
3998 + /* If dst is word-aligned, we're ready to go */
4002 + breq .Laligned_copy
4005 + /* src is aligned, but dst is not. Expect bad performance */
4014 + add pc, pc, len << 2
4021 + .size memcpy, . - memcpy
4022 diff -Nrup a/libc/string/avr32/memmove.S b/libc/string/avr32/memmove.S
4023 --- a/libc/string/avr32/memmove.S 1969-12-31 19:00:00.000000000 -0500
4024 +++ b/libc/string/avr32/memmove.S 2008-02-28 19:02:10.000000000 -0500
4027 + * Copyright (C) 2004 Atmel Norway
4036 + .type memmove, @function
4040 + .type __memmove, @function
4051 + * The rest is basically the same as in memcpy.S except that
4052 + * the direction is reversed.
4055 + brge .Lmore_than_31
4068 + /* Check alignment */
4071 + brne .Lunaligned_src
4074 + brne .Lunaligned_dst
4078 + brlt .Lless_than_32
4080 +1: /* Copy 32 bytes at a time */
4089 + /* Copy 16 more bytes if possible */
4091 + brlt .Lless_than_16
4099 + /* Do the remaining as byte copies */
4110 + /* Make src cacheline-aligned. r8 = (src & 31) */
4117 + /* If dst is word-aligned, we're ready to go */
4121 + breq .Laligned_copy
4124 + /* src is aligned, but dst is not. Expect bad performance */
4133 + add pc, pc, len << 2
4140 diff -Nrup a/libc/string/avr32/memset.S b/libc/string/avr32/memset.S
4141 --- a/libc/string/avr32/memset.S 1969-12-31 19:00:00.000000000 -0500
4142 +++ b/libc/string/avr32/memset.S 2008-02-28 19:02:10.000000000 -0500
4145 + * Copyright (C) 2004 Atmel Norway.
4154 + .type memset, @function
4158 + .type __memset, @function
4165 + brge .Llarge_memset
4178 + bfins r8, r8, 8, 8
4179 + bfins r8, r8, 16, 16
4196 + /* If we are done, n == -8 and we'll skip all st.b insns below */
4204 diff -Nrup a/libc/string/avr32/strcat.S b/libc/string/avr32/strcat.S
4205 --- a/libc/string/avr32/strcat.S 1969-12-31 19:00:00.000000000 -0500
4206 +++ b/libc/string/avr32/strcat.S 2008-02-28 19:02:10.000000000 -0500
4209 + * Copyright (C) 2004 Atmel Norway
4217 + .type strcat, @function
4222 + /* Make sure s1 is word-aligned */
4227 + add pc, pc, r10 << 3
4228 + sub r0, r0, 0 /* 4-byte nop */
4239 + /* Find the end of the first string */
4246 + bfextu r10, r8, 24, 8
4250 + bfextu r10, r8, 16, 8
4254 + bfextu r10, r8, 8, 8
4260 + /* Now, append s2 */
4278 + /* Copy one word at a time */
4287 + /* Copy the remaining bytes */
4288 + bfextu r10, r8, 24, 8
4292 + bfextu r10, r8, 16, 8
4296 + bfextu r10, r8, 8, 8
4302 + .size strcat, . - strcat
4303 diff -Nrup a/libc/string/avr32/strcmp.S b/libc/string/avr32/strcmp.S
4304 --- a/libc/string/avr32/strcmp.S 1969-12-31 19:00:00.000000000 -0500
4305 +++ b/libc/string/avr32/strcmp.S 2008-02-28 19:02:10.000000000 -0500
4308 + * Copyright (C) 2004 Atmel Norway.
4317 + .type strcmp, @function
4322 + brne .Lunaligned_s1
4324 + brne .Lunaligned_s2
4334 +2: bfextu r12, r8, 24, 8
4335 + bfextu r11, r9, 24, 8
4340 + bfextu r12, r8, 16, 8
4341 + bfextu r11, r9, 16, 8
4346 + bfextu r12, r8, 8, 8
4347 + bfextu r11, r9, 8, 8
4352 + bfextu r12, r8, 0, 8
4353 + bfextu r11, r9, 0, 8
4373 + * s1 and s2 can't both be aligned, and unaligned word loads
4374 + * can trigger spurious exceptions if we cross a page boundary.
4375 + * Do it the slow way...
4387 diff -Nrup a/libc/string/avr32/strcpy.S b/libc/string/avr32/strcpy.S
4388 --- a/libc/string/avr32/strcpy.S 1969-12-31 19:00:00.000000000 -0500
4389 +++ b/libc/string/avr32/strcpy.S 2008-02-28 19:02:10.000000000 -0500
4392 + * Copyright (C) 2004 Atmel Norway
4394 + * To reduce the size, this one might simply call strncpy with len = -1.
4402 + .type strcpy, @function
4409 + * Check alignment. If src is aligned but dst isn't, we can't
4410 + * do much about it...
4414 + brne .Lunaligned_src
4424 + * Ok, r8 now contains the terminating '\0'. Copy the
4425 + * remaining bytes individually.
4427 + bfextu r10, r8, 24, 8
4431 + bfextu r10, r8, 16, 8
4435 + bfextu r10, r8, 8, 8
4443 + /* Copy bytes until we're aligned */
4445 + add pc, pc, r8 << 3
4453 + rjmp .Laligned_copy
4454 diff -Nrup a/libc/string/avr32/stringtest.c b/libc/string/avr32/stringtest.c
4455 --- a/libc/string/avr32/stringtest.c 1969-12-31 19:00:00.000000000 -0500
4456 +++ b/libc/string/avr32/stringtest.c 2008-02-28 19:02:10.000000000 -0500
4460 +#include <string.h>
4462 +#include <sys/mman.h>
4464 +#define BUF_SIZE (8 * 1024)
4467 +static char *buf1_ref;
4470 +extern void *optimized_memcpy(void *dest, void *src, size_t len);
4471 +extern void *optimized_memmove(void *dest, void *src, size_t len);
4472 +extern char *optimized_strcpy(char *dest, char *src);
4473 +extern char *optimized_strncpy(char *dest, char *src, size_t len);
4475 +void dump_mismatch(char *buf, char *ref, size_t len)
4479 + for (i = 0; i < len; i += 16) {
4480 + if (memcmp(buf + i, ref + i, 16) == 0)
4483 + printf("%4x buf:", i);
4484 + for (j = i; j < (i + 16); j++)
4485 + printf(" %02x", buf[j]);
4486 + printf("\n ref:");
4487 + for (j = i; j < (i + 16); j++)
4488 + printf(" %02x", ref[j]);
4493 +static void test_memcpy(int src_offset, int dst_offset, int len)
4495 + clock_t start, old, new;
4498 + memset(buf1, 0x55, BUF_SIZE);
4499 + memset(buf1_ref, 0x55, BUF_SIZE);
4500 + memset(buf2, 0xaa, BUF_SIZE);
4502 + printf("Testing memcpy with offsets %d => %d and len %d...",
4503 + src_offset, dst_offset, len);
4506 + for (i = 0; i < 8192; i++)
4507 + optimized_memcpy(buf1 + dst_offset, buf2 + src_offset, len);
4508 + new = clock() - start;
4510 + for ( i = 0; i < 8192; i++)
4511 + memcpy(buf1_ref + dst_offset, buf2 + src_offset, len);
4512 + old = clock() - start;
4514 + if (memcmp(buf1, buf1_ref, BUF_SIZE) == 0)
4517 + printf("FAILED\n");
4518 + dump_mismatch(buf1, buf1_ref, BUF_SIZE);
4520 + printf("CPU time used: %d vs. %d\n", new, old);
4523 +static void test_memmove(int src_offset, int dst_offset, int len)
4525 + clock_t start, old, new;
4527 + memset(buf1, 0x55, BUF_SIZE);
4528 + memset(buf1_ref, 0x55, BUF_SIZE);
4529 + memset(buf2, 0xaa, BUF_SIZE);
4531 + printf("Testing memmove with offsets %d => %d and len %d...",
4532 + src_offset, dst_offset, len);
4535 + optimized_memmove(buf1 + dst_offset, buf2 + src_offset, len);
4536 + new = clock() - start;
4538 + memmove(buf1_ref + dst_offset, buf2 + src_offset, len);
4539 + old = clock() - start;
4541 + if (memcmp(buf1, buf1_ref, BUF_SIZE) == 0)
4544 + printf("FAILED\n");
4545 + dump_mismatch(buf1, buf1_ref, BUF_SIZE);
4547 + printf("CPU time used: %d vs. %d\n", new, old);
4550 +int main(int argc, char *argv[])
4552 + buf2 = mmap(NULL, BUF_SIZE, PROT_READ | PROT_WRITE,
4553 + MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
4554 + if (buf2 == MAP_FAILED) {
4555 + perror("Failed to allocate memory for buf2");
4558 + buf1 = mmap(NULL, BUF_SIZE, PROT_READ | PROT_WRITE,
4559 + MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
4560 + if (buf1 == MAP_FAILED) {
4561 + perror("Failed to allocate memory for buf1");
4564 + buf1_ref = mmap(NULL, BUF_SIZE, PROT_READ | PROT_WRITE,
4565 + MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
4566 + if (buf1_ref == MAP_FAILED) {
4567 + perror("Failed to allocate memory for buf1_ref");
4570 + printf("\n === MEMCPY ===\n\n");
4572 + test_memcpy(0, 0, BUF_SIZE - 32);
4573 + test_memcpy(0, 0, 1);
4574 + test_memcpy(0, 0, 31);
4575 + test_memcpy(0, 0, 32);
4576 + test_memcpy(0, 0, 127);
4577 + test_memcpy(0, 0, 128);
4578 + test_memcpy(4, 4, BUF_SIZE - 32 - 4);
4579 + test_memcpy(1, 1, BUF_SIZE - 32 - 1);
4580 + test_memcpy(1, 1, 126);
4581 + test_memcpy(0, 3, 128);
4582 + test_memcpy(1, 4, 128);
4583 + test_memcpy(0, 0, 0);
4585 + printf("\n === MEMMOVE ===\n\n");
4587 + test_memmove(0, 0, BUF_SIZE - 32);
4588 + test_memmove(0, 0, 1);
4589 + test_memmove(0, 0, 31);
4590 + test_memmove(0, 0, 32);
4591 + test_memmove(0, 0, BUF_SIZE - 33);
4592 + test_memmove(0, 0, 128);
4593 + test_memmove(4, 4, BUF_SIZE - 32 - 4);
4594 + test_memmove(1, 1, BUF_SIZE - 32 - 1);
4595 + test_memmove(1, 1, BUF_SIZE - 130);
4596 + test_memmove(0, 3, BUF_SIZE - 128);
4597 + test_memmove(1, 4, BUF_SIZE - 128);
4598 + test_memmove(0, 0, 0);
4602 diff -Nrup a/libc/string/avr32/strlen.S b/libc/string/avr32/strlen.S
4603 --- a/libc/string/avr32/strlen.S 1969-12-31 19:00:00.000000000 -0500
4604 +++ b/libc/string/avr32/strlen.S 2008-02-28 19:02:10.000000000 -0500
4607 + * Copyright (C) 2004 Atmel Norway
4614 + .type strlen, @function
4620 + brne .Lunaligned_str
4627 + bfextu r9, r8, 24, 8
4631 + bfextu r9, r8, 16, 8
4635 + bfextu r9, r8, 8, 8
4643 + add pc, pc, r9 << 3
4644 + sub r0, r0, 0 /* 4-byte nop */
4658 diff -Nrup a/libc/string/avr32/strncpy.S b/libc/string/avr32/strncpy.S
4659 --- a/libc/string/avr32/strncpy.S 1969-12-31 19:00:00.000000000 -0500
4660 +++ b/libc/string/avr32/strncpy.S 2008-02-28 19:02:10.000000000 -0500
4663 + * Copyright (C) 2004 Atmel Norway
4671 + .type strncpy, @function
4679 + * Check alignment. If src is aligned but dst isn't, we can't
4680 + * do much about it...
4684 + brne .Lunaligned_src
4699 + /* This is safe as long as src is word-aligned and r10 > 0 */
4703 + * Ok, r8 now contains the terminating '\0'. Copy the
4704 + * remaining bytes individually.
4706 + bfextu r11, r8, 24, 8
4712 + bfextu r11, r8, 16, 8
4718 + bfextu r11, r8, 8, 8
4728 + /* Copy bytes until we're aligned */
4733 +1: ld.ub r10, src++
4738 + rjmp .Laligned_copy
4739 diff -Nrup a/libc/string/avr32/test_memcpy.c b/libc/string/avr32/test_memcpy.c
4740 --- a/libc/string/avr32/test_memcpy.c 1969-12-31 19:00:00.000000000 -0500
4741 +++ b/libc/string/avr32/test_memcpy.c 2008-02-28 19:02:10.000000000 -0500
4745 +#include <string.h>
4747 +#define BUF_SIZE 32768
4749 +static char buf1[BUF_SIZE] __attribute__((aligned(32)));
4750 +static char buf1_ref[BUF_SIZE] __attribute__((aligned(32)));
4751 +static char buf2[BUF_SIZE] __attribute__((aligned(32)));
4753 +extern void *new_memcpy(void *dest, void *src, size_t len);
4755 +void dump_mismatch(char *buf, char *ref, size_t len)
4759 + for (i = 0; i < len; i += 16) {
4760 + if (memcmp(buf + i, ref + i, 16) == 0)
4763 + printf("% 4x buf:", i);
4764 + for (j = i; j < (i + 16); j++)
4765 + printf(" %02x", buf[j]);
4766 + printf("\n ref:");
4767 + for (j = i; j < (i + 16); j++)
4768 + printf(" %02x", ref[j]);
4773 +void test(int src_offset, int dst_offset, int len)
4775 + memset(buf1, 0x55, sizeof(buf1));
4776 + memset(buf1_ref, 0x55, sizeof(buf1_ref));
4777 + memset(buf2, 0xaa, sizeof(buf2));
4779 + printf("Testing with offsets %d => %d and len %d...",
4780 + src_offset, dst_offset, len);
4782 + new_memcpy(buf1 + dst_offset, buf2 + src_offset, len);
4783 + memcpy(buf1_ref + dst_offset, buf2 + src_offset, len);
4785 + if (memcmp(buf1, buf1_ref, sizeof(buf1)) == 0)
4788 + printf("FAILED\n");
4789 + dump_mismatch(buf1, buf1_ref, sizeof(buf1));
4793 +int main(int argc, char *argv[])
4795 + test(0, 0, BUF_SIZE);
4801 + test(4, 4, BUF_SIZE - 4);
4802 + test(1, 1, BUF_SIZE - 1);
4809 diff -Nrup a/libc/sysdeps/linux/avr32/bits/atomicity.h b/libc/sysdeps/linux/avr32/bits/atomicity.h
4810 --- a/libc/sysdeps/linux/avr32/bits/atomicity.h 1969-12-31 19:00:00.000000000 -0500
4811 +++ b/libc/sysdeps/linux/avr32/bits/atomicity.h 2008-02-28 19:02:10.000000000 -0500
4813 +/* Low-level functions for atomic operations. AVR32 version.
4814 + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
4815 + This file is part of the GNU C Library.
4817 + The GNU C Library is free software; you can redistribute it and/or
4818 + modify it under the terms of the GNU Lesser General Public
4819 + License as published by the Free Software Foundation; either
4820 + version 2.1 of the License, or (at your option) any later version.
4822 + The GNU C Library is distributed in the hope that it will be useful,
4823 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4824 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4825 + Lesser General Public License for more details.
4827 + You should have received a copy of the GNU Lesser General Public
4828 + License along with the GNU C Library; if not, write to the Free
4829 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4830 + 02111-1307 USA. */
4832 +#ifndef _ATOMICITY_H
4833 +#define _ATOMICITY_H 1
4835 +#include <inttypes.h>
4838 +__attribute__((unused))
4839 +exchange_and_add (volatile uint32_t *mem, int val)
4843 + __asm__ __volatile__(
4844 + "/* Inline exchange and add */\n"
4847 + " add %1, %0, %4\n"
4848 + " stcond %2, %1\n"
4850 + : "=&r"(result), "=&r"(tmp), "=m"(*mem)
4851 + : "m"(*mem), "r"(val)
4852 + : "cc", "memory");
4858 +__attribute__((unused))
4859 +atomic_add (volatile uin32_t *mem, int val)
4863 + __asm__ __volatile__(
4864 + "/* Inline atomic add */\n"
4868 + " stcond %2, %0\n"
4870 + : "=&r"(result), "=m"(*mem)
4871 + : "m"(*mem), "r"(val)
4872 + : "cc", "memory");
4876 +__attribute__((unused))
4877 +compare_and_swap(volatile long int *p, long int oldval, long int newval)
4879 + long int result, tmp;
4881 + __asm__ __volatile__(
4882 + "/* Inline compare and swap */\n"
4888 + " stcond %2, %4\n"
4891 + : "=&r"(result), "=&r"(tmp), "=m"(*p)
4892 + : "m"(*p), "r"(newval), "r"(oldval)
4893 + : "cc", "memory");
4898 +#endif /* atomicity.h */
4899 diff -Nrup a/libc/sysdeps/linux/avr32/bits/byteswap.h b/libc/sysdeps/linux/avr32/bits/byteswap.h
4900 --- a/libc/sysdeps/linux/avr32/bits/byteswap.h 1969-12-31 19:00:00.000000000 -0500
4901 +++ b/libc/sysdeps/linux/avr32/bits/byteswap.h 2008-02-28 19:02:10.000000000 -0500
4903 +/* Macros to swap the order of bytes in integer values.
4904 + Copyright (C) 2005 Atmel Norway.
4906 + The GNU C Library is free software; you can redistribute it and/or
4907 + modify it under the terms of the GNU Lesser General Public
4908 + License as published by the Free Software Foundation; either
4909 + version 2.1 of the License, or (at your option) any later version.
4911 + The GNU C Library is distributed in the hope that it will be useful,
4912 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4913 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4914 + Lesser General Public License for more details.
4916 + You should have received a copy of the GNU Lesser General Public
4917 + License along with the GNU C Library; if not, write to the Free
4918 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4919 + 02111-1307 USA. */
4921 +#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
4922 +# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
4925 +#ifndef _BITS_BYTESWAP_H
4926 +#define _BITS_BYTESWAP_H 1
4928 +/* Swap bytes in 16 bit value. */
4929 +#if defined __GNUC__
4930 +# define __bswap_16(x) (__extension__ __builtin_bswap_16(x))
4932 +/* This is better than nothing. */
4933 +static __inline unsigned short int
4934 +__bswap_16 (unsigned short int __bsx)
4936 + return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
4940 +/* Swap bytes in 32 bit value. */
4941 +#if defined __GNUC__
4942 +# define __bswap_32(x) (__extension__ __builtin_bswap_32(x))
4944 +static __inline unsigned int
4945 +__bswap_32 (unsigned int __bsx)
4947 + return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) |
4948 + (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
4952 +#if defined __GNUC__
4953 +/* Swap bytes in 64 bit value. */
4954 +# define __bswap_constant_64(x) \
4955 + ((((x) & 0xff00000000000000ull) >> 56) \
4956 + | (((x) & 0x00ff000000000000ull) >> 40) \
4957 + | (((x) & 0x0000ff0000000000ull) >> 24) \
4958 + | (((x) & 0x000000ff00000000ull) >> 8) \
4959 + | (((x) & 0x00000000ff000000ull) << 8) \
4960 + | (((x) & 0x0000000000ff0000ull) << 24) \
4961 + | (((x) & 0x000000000000ff00ull) << 40) \
4962 + | (((x) & 0x00000000000000ffull) << 56))
4964 +# define __bswap_64(x) \
4968 + __extension__ unsigned long long int __ll; \
4969 + unsigned int __l[2]; \
4971 + if (__builtin_constant_p(x)) \
4972 + __r.__ll = __bswap_constant_64(x); \
4975 + __r.__l[0] = __bswap_32(__w.__l[1]); \
4976 + __r.__l[1] = __bswap_32(__w.__l[0]); \
4982 +#endif /* _BITS_BYTESWAP_H */
4983 diff -Nrup a/libc/sysdeps/linux/avr32/bits/endian.h b/libc/sysdeps/linux/avr32/bits/endian.h
4984 --- a/libc/sysdeps/linux/avr32/bits/endian.h 1969-12-31 19:00:00.000000000 -0500
4985 +++ b/libc/sysdeps/linux/avr32/bits/endian.h 2008-02-28 19:02:10.000000000 -0500
4987 +/* AVR32 is big-endian */
4990 +# error "Never use <bits/endian.h> directly; include <endian.h> instead."
4993 +#define __BYTE_ORDER __BIG_ENDIAN
4994 diff -Nrup a/libc/sysdeps/linux/avr32/bits/fcntl.h b/libc/sysdeps/linux/avr32/bits/fcntl.h
4995 --- a/libc/sysdeps/linux/avr32/bits/fcntl.h 1969-12-31 19:00:00.000000000 -0500
4996 +++ b/libc/sysdeps/linux/avr32/bits/fcntl.h 2008-02-28 19:02:10.000000000 -0500
4999 + * Copyright (C) 2004 Atmel Norway AS
5001 + * This file is part of the Linux kernel
5004 +# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
5007 +#include <sys/types.h>
5009 +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5010 + located on an ext2 file system */
5011 +#define O_ACCMODE 00000003
5012 +#define O_RDONLY 00000000
5013 +#define O_WRONLY 00000001
5014 +#define O_RDWR 00000002
5015 +#define O_CREAT 00000100 /* not fcntl */
5016 +#define O_EXCL 00000200 /* not fcntl */
5017 +#define O_NOCTTY 00000400 /* not fcntl */
5018 +#define O_TRUNC 00001000 /* not fcntl */
5019 +#define O_APPEND 00002000
5020 +#define O_NONBLOCK 00004000
5021 +#define O_NDELAY O_NONBLOCK
5022 +#define O_SYNC 00010000
5023 +#define O_ASYNC 00020000
5026 +# define O_DIRECT 00040000 /* must be a directory */
5027 +# define O_DIRECTORY 00200000 /* direct disk access */
5028 +# define O_NOFOLLOW 00400000 /* don't follow links */
5029 +# define O_NOATIME 01000000 /* don't set atime */
5032 +#ifdef __USE_LARGEFILE64
5033 +# define O_LARGEFILE 00100000
5036 +/* For now Linux has synchronisity options for data and read operations.
5037 + We define the symbols here but let them do the same as O_SYNC since
5038 + this is a superset. */
5039 +#if defined __USE_POSIX199309 || defined __USE_UNIX98
5040 +# define O_DSYNC O_SYNC /* Synchronize data. */
5041 +# define O_RSYNC O_SYNC /* Synchronize read operations. */
5044 +#define F_DUPFD 0 /* dup */
5045 +#define F_GETFD 1 /* get close_on_exec */
5046 +#define F_SETFD 2 /* set/clear close_on_exec */
5047 +#define F_GETFL 3 /* get file->f_flags */
5048 +#define F_SETFL 4 /* set file->f_flags */
5050 +#ifndef __USE_FILE_OFFSET64
5053 +# define F_SETLKW 7
5055 +# define F_GETLK F_GETLK64
5056 +# define F_SETLK F_SETLK64
5057 +# define F_SETLKW F_SETLKW64
5059 +#define F_GETLK64 12 /* using 'struct flock64' */
5060 +#define F_SETLK64 13
5061 +#define F_SETLKW64 14
5063 +#if defined __USE_BSD || defined __USE_XOPEN2K
5064 +# define F_SETOWN 8 /* for sockets. */
5065 +# define F_GETOWN 9 /* for sockets. */
5069 +# define F_SETSIG 10 /* for sockets. */
5070 +# define F_GETSIG 11 /* for sockets. */
5074 +# define F_SETLEASE 1024 /* Set a lease. */
5075 +# define F_GETLEASE 1025 /* Enquire what lease is active. */
5076 +# define F_NOTIFY 1026 /* Request notfications on a directory. */
5079 +/* for F_[GET|SET]FL */
5080 +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
5082 +/* for posix fcntl() and lockf() */
5087 +/* for old implementation of bsd flock () */
5088 +#define F_EXLCK 4 /* or 3 */
5089 +#define F_SHLCK 8 /* or 4 */
5092 +#define F_INPROGRESS 16
5095 +/* operations for bsd flock(), also used by the kernel implementation */
5096 +# define LOCK_SH 1 /* shared lock */
5097 +# define LOCK_EX 2 /* exclusive lock */
5098 +# define LOCK_NB 4 /* or'd with one of the above to prevent
5100 +# define LOCK_UN 8 /* remove lock */
5104 +# define LOCK_MAND 32 /* This is a mandatory flock */
5105 +# define LOCK_READ 64 /* ... Which allows concurrent
5106 + read operations */
5107 +# define LOCK_WRITE 128 /* ... Which allows concurrent
5108 + write operations */
5109 +# define LOCK_RW 192 /* ... Which allows concurrent
5110 + read & write ops */
5114 +/* Types of directory notifications that may be requested with F_NOTIFY. */
5115 +# define DN_ACCESS 0x00000001 /* File accessed. */
5116 +# define DN_MODIFY 0x00000002 /* File modified. */
5117 +# define DN_CREATE 0x00000004 /* File created. */
5118 +# define DN_DELETE 0x00000008 /* File removed. */
5119 +# define DN_RENAME 0x00000010 /* File renamed. */
5120 +# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
5121 +# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
5127 +#ifndef __USE_FILE_OFFSET64
5131 + __off64_t l_start;
5137 +#ifdef __USE_LARGEFILE64
5141 + __off64_t l_start;
5147 +/* Define some more compatibility macros to be backward compatible with
5148 + * BSD systems which did not managed to hide these kernel macros. */
5150 +# define FAPPEND O_APPEND
5151 +# define FFSYNC O_FSYNC
5152 +# define FASYNC O_ASYNC
5153 +# define FNONBLOCK O_NONBLOCK
5154 +# define FNDELAY O_NDELAY
5155 +#endif /* Use BSD. */
5157 +/* Advise to `posix_fadvise'. */
5158 +#ifdef __USE_XOPEN2K
5159 +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
5160 +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
5161 +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
5162 +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
5163 +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
5164 +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
5166 diff -Nrup a/libc/sysdeps/linux/avr32/bits/kernel_stat.h b/libc/sysdeps/linux/avr32/bits/kernel_stat.h
5167 --- a/libc/sysdeps/linux/avr32/bits/kernel_stat.h 1969-12-31 19:00:00.000000000 -0500
5168 +++ b/libc/sysdeps/linux/avr32/bits/kernel_stat.h 2008-02-28 19:02:10.000000000 -0500
5170 +#ifndef _BITS_STAT_STRUCT_H
5171 +#define _BITS_STAT_STRUCT_H
5174 + * This file provides struct stat, taken from kernel 2.6.4
5175 + * (include/asm-avr32/stat.h revision 1.1).
5178 +struct kernel_stat {
5179 + unsigned long st_dev;
5180 + unsigned long st_ino;
5181 + unsigned short st_mode;
5182 + unsigned short st_nlink;
5183 + unsigned short st_uid;
5184 + unsigned short st_gid;
5185 + unsigned long st_rdev;
5186 + unsigned long st_size;
5187 + unsigned long st_blksize;
5188 + unsigned long st_blocks;
5189 + unsigned long st_atime;
5190 + unsigned long st_atime_nsec;
5191 + unsigned long st_mtime;
5192 + unsigned long st_mtime_nsec;
5193 + unsigned long st_ctime;
5194 + unsigned long st_ctime_nsec;
5195 + unsigned long __unused4;
5196 + unsigned long __unused5;
5199 +#define STAT_HAVE_NSEC 1
5201 +struct kernel_stat64 {
5202 + unsigned long long st_dev;
5204 + unsigned long long st_ino;
5205 + unsigned int st_mode;
5206 + unsigned int st_nlink;
5208 + unsigned long st_uid;
5209 + unsigned long st_gid;
5211 + unsigned long long st_rdev;
5213 + long long st_size;
5214 + unsigned long __pad1;
5215 + unsigned long st_blksize;
5217 + unsigned long long st_blocks;
5219 + unsigned long st_atime;
5220 + unsigned long st_atime_nsec;
5222 + unsigned long st_mtime;
5223 + unsigned long st_mtime_nsec;
5225 + unsigned long st_ctime;
5226 + unsigned long st_ctime_nsec;
5228 + unsigned long __unused1;
5229 + unsigned long __unused2;
5232 +#endif /* _BITS_STAT_STRUCT_H */
5233 diff -Nrup a/libc/sysdeps/linux/avr32/bits/kernel_types.h b/libc/sysdeps/linux/avr32/bits/kernel_types.h
5234 --- a/libc/sysdeps/linux/avr32/bits/kernel_types.h 1969-12-31 19:00:00.000000000 -0500
5235 +++ b/libc/sysdeps/linux/avr32/bits/kernel_types.h 2008-02-28 19:02:10.000000000 -0500
5237 +/* Note that we use the exact same include guard #define names
5238 + * as asm/posix_types.h. This will avoid gratuitous conflicts
5239 + * with the posix_types.h kernel header, and will ensure that
5240 + * our private content, and not the kernel header, will win.
5243 +#ifndef __ASM_AVR32_POSIX_TYPES_H
5244 +#define __ASM_AVR32_POSIX_TYPES_H
5247 + * This file is generally used by user-level software, so you need to
5248 + * be a little careful about namespace pollution etc. Also, we cannot
5249 + * assume GCC is being used.
5252 +typedef unsigned long __kernel_dev_t;
5253 +typedef unsigned long __kernel_ino_t;
5254 +typedef unsigned short __kernel_mode_t;
5255 +typedef unsigned short __kernel_nlink_t;
5256 +typedef long __kernel_off_t;
5257 +typedef int __kernel_pid_t;
5258 +typedef unsigned short __kernel_ipc_pid_t;
5259 +typedef unsigned int __kernel_uid_t;
5260 +typedef unsigned int __kernel_gid_t;
5261 +typedef unsigned long __kernel_size_t;
5262 +typedef int __kernel_ssize_t;
5263 +typedef int __kernel_ptrdiff_t;
5264 +typedef long __kernel_time_t;
5265 +typedef long __kernel_suseconds_t;
5266 +typedef long __kernel_clock_t;
5267 +typedef int __kernel_timer_t;
5268 +typedef int __kernel_clockid_t;
5269 +typedef int __kernel_daddr_t;
5270 +typedef char * __kernel_caddr_t;
5271 +typedef unsigned short __kernel_uid16_t;
5272 +typedef unsigned short __kernel_gid16_t;
5273 +typedef unsigned int __kernel_uid32_t;
5274 +typedef unsigned int __kernel_gid32_t;
5276 +typedef unsigned short __kernel_old_uid_t;
5277 +typedef unsigned short __kernel_old_gid_t;
5278 +typedef unsigned short __kernel_old_dev_t;
5281 +typedef long long __kernel_loff_t;
5285 +#if defined(__USE_ALL)
5292 +#endif /* __ASM_AVR32_POSIX_TYPES_H */
5293 diff -Nrup a/libc/sysdeps/linux/avr32/bits/machine-gmon.h b/libc/sysdeps/linux/avr32/bits/machine-gmon.h
5294 --- a/libc/sysdeps/linux/avr32/bits/machine-gmon.h 1969-12-31 19:00:00.000000000 -0500
5295 +++ b/libc/sysdeps/linux/avr32/bits/machine-gmon.h 2008-02-28 19:02:10.000000000 -0500
5297 +/* Machine-dependent definitions for profiling support. AVR32 version.
5298 + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
5299 + This file is part of the GNU C Library.
5301 + The GNU C Library is free software; you can redistribute it and/or
5302 + modify it under the terms of the GNU Lesser General Public
5303 + License as published by the Free Software Foundation; either
5304 + version 2.1 of the License, or (at your option) any later version.
5306 + The GNU C Library is distributed in the hope that it will be useful,
5307 + but WITHOUT ANY WARRANTY; without even the implied warranty of
5308 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5309 + Lesser General Public License for more details.
5311 + You should have received a copy of the GNU Lesser General Public
5312 + License along with the GNU C Library; if not, write to the Free
5313 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5314 + 02111-1307 USA. */
5316 +#define mcount_internal __mcount_internal
5318 +#define _MCOUNT_DECL(frompc, selfpc) \
5319 +static void __attribute((used)) mcount_internal(unsigned long frompc, unsigned long selfpc)
5322 + * This mcount implementation expects to get called after the prologue
5323 + * has been run. It also expects that r7 contains a valid frame
5326 + * When profiling, the compiler should generate something like this at
5327 + * each function entry:
5329 + * pushm r0-r7,lr // lr mandatory, others optional
5331 + * // rest of prologue goes here
5332 + * mcall pc[.LC1 - .]
5333 + * // rest of function goes here
5341 + * // rest of prologue goes here
5343 + * .L1: rsub r0, pc
5344 + * mcall r0[mcount@GOT]
5345 + * // rest of function goes here
5347 + * .long .L1 - _GLOBAL_OFFSET_TABLE_
5349 + * This way, when mcount() is called, r7 points to the calling
5350 + * function's return address. It is guaranteed that calling mcount
5351 + * will clobber no registers except LR, which is unavoidable.
5353 +#define MCOUNT asm( \
5355 + " .global _mcount\n" \
5356 + " .type _mcount,@function\n" \
5358 + " pushm r8-r12,lr\n" \
5359 + " mov r11, lr\n" \
5360 + " ld.w r12, r7[0]\n" \
5361 + " rcall __mcount_internal\n" \
5362 + " popm r8-r12,pc\n" \
5363 + " .size _mcount, . - _mcount\n" \
5364 + " .weak mcount\n" \
5365 + " mcount = _mcount");
5366 diff -Nrup a/libc/sysdeps/linux/avr32/bits/mman.h b/libc/sysdeps/linux/avr32/bits/mman.h
5367 --- a/libc/sysdeps/linux/avr32/bits/mman.h 1969-12-31 19:00:00.000000000 -0500
5368 +++ b/libc/sysdeps/linux/avr32/bits/mman.h 2008-02-28 19:02:10.000000000 -0500
5370 +/* Definitions for POSIX memory map interface. Linux/AVR32 version.
5371 + Copyright (C) 1997, 2000 Free Software Foundation, Inc.
5372 + This file is part of the GNU C Library.
5374 + The GNU C Library is free software; you can redistribute it and/or
5375 + modify it under the terms of the GNU Lesser General Public
5376 + License as published by the Free Software Foundation; either
5377 + version 2.1 of the License, or (at your option) any later version.
5379 + The GNU C Library is distributed in the hope that it will be useful,
5380 + but WITHOUT ANY WARRANTY; without even the implied warranty of
5381 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5382 + Lesser General Public License for more details.
5384 + You should have received a copy of the GNU Lesser General Public
5385 + License along with the GNU C Library; if not, write to the Free
5386 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5387 + 02111-1307 USA. */
5389 +#ifndef _SYS_MMAN_H
5390 +# error "Never include this file directly. Use <sys/mman.h> instead"
5393 +/* The following definitions basically come from the kernel headers.
5394 + But the kernel header is not namespace clean. */
5397 +/* Protections are chosen from these bits, OR'd together. The
5398 + implementation does not necessarily support PROT_EXEC or PROT_WRITE
5399 + without PROT_READ. The only guarantees are that no writing will be
5400 + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
5402 +#define PROT_READ 0x1 /* Page can be read. */
5403 +#define PROT_WRITE 0x2 /* Page can be written. */
5404 +#define PROT_EXEC 0x4 /* Page can be executed. */
5405 +#define PROT_NONE 0x0 /* Page can not be accessed. */
5407 +/* Sharing types (must choose one and only one of these). */
5408 +#define MAP_SHARED 0x01 /* Share changes. */
5409 +#define MAP_PRIVATE 0x02 /* Changes are private. */
5411 +# define MAP_TYPE 0x0f /* Mask for type of mapping. */
5415 +#define MAP_FIXED 0x10 /* Interpret addr exactly. */
5417 +# define MAP_FILE 0
5418 +# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
5419 +# define MAP_ANON MAP_ANONYMOUS
5422 +/* These are Linux-specific. */
5424 +# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
5425 +# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
5426 +# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
5427 +# define MAP_LOCKED 0x2000 /* Lock the mapping. */
5428 +# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */
5429 +# define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
5430 +# define MAP_NONBLOCK 0x10000 /* do not block on IO */
5433 +/* Flags to `msync'. */
5434 +#define MS_ASYNC 1 /* Sync memory asynchronously. */
5435 +#define MS_SYNC 4 /* Synchronous memory sync. */
5436 +#define MS_INVALIDATE 2 /* Invalidate the caches. */
5438 +/* Flags for `mlockall'. */
5439 +#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
5440 +#define MCL_FUTURE 2 /* Lock all additions to address
5443 +/* Flags for `mremap'. */
5445 +# define MREMAP_MAYMOVE 1
5448 +/* Advise to `madvise'. */
5450 +# define MADV_NORMAL 0 /* No further special treatment. */
5451 +# define MADV_RANDOM 1 /* Expect random page references. */
5452 +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
5453 +# define MADV_WILLNEED 3 /* Will need these pages. */
5454 +# define MADV_DONTNEED 4 /* Don't need these pages. */
5457 +/* The POSIX people had to invent similar names for the same things. */
5458 +#ifdef __USE_XOPEN2K
5459 +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
5460 +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
5461 +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
5462 +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
5463 +# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
5465 diff -Nrup a/libc/sysdeps/linux/avr32/bits/profil-counter.h b/libc/sysdeps/linux/avr32/bits/profil-counter.h
5466 --- a/libc/sysdeps/linux/avr32/bits/profil-counter.h 1969-12-31 19:00:00.000000000 -0500
5467 +++ b/libc/sysdeps/linux/avr32/bits/profil-counter.h 2008-02-28 19:02:10.000000000 -0500
5469 +/* Low-level statistical profiling support function. Linux/AVR32 version.
5470 + Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc.
5471 + This file is part of the GNU C Library.
5473 + The GNU C Library is free software; you can redistribute it and/or
5474 + modify it under the terms of the GNU Lesser General Public
5475 + License as published by the Free Software Foundation; either
5476 + version 2.1 of the License, or (at your option) any later version.
5478 + The GNU C Library is distributed in the hope that it will be useful,
5479 + but WITHOUT ANY WARRANTY; without even the implied warranty of
5480 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5481 + Lesser General Public License for more details.
5483 + You should have received a copy of the GNU Lesser General Public
5484 + License along with the GNU C Library; if not, write to the Free
5485 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5486 + 02111-1307 USA. */
5488 +#include <signal.h>
5491 +profil_counter(int signo, siginfo_t *si, struct sigcontext *sc)
5493 + profil_count((void *)sc->pc);
5495 diff -Nrup a/libc/sysdeps/linux/avr32/bits/setjmp.h b/libc/sysdeps/linux/avr32/bits/setjmp.h
5496 --- a/libc/sysdeps/linux/avr32/bits/setjmp.h 1969-12-31 19:00:00.000000000 -0500
5497 +++ b/libc/sysdeps/linux/avr32/bits/setjmp.h 2008-02-28 19:02:10.000000000 -0500
5500 + * Copyright (C) 2004-2005 Atmel Norway
5503 +# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
5508 + * The jump buffer contains r0-r7, sr, sp and lr. Other registers are
5511 +typedef int __jmp_buf[11];
5514 +#define __JMP_BUF_SP 4
5516 +/* Test if longjmp to JMPBUF would unwind the frame containing a local
5517 + variable at ADDRESS. */
5518 +#define _JMPBUF_UNWINDS(jmpbuf, address) \
5519 + ((void *)(address) < (void *)(jmpbuf[__JMP_BUF_SP]))
5520 diff -Nrup a/libc/sysdeps/linux/avr32/bits/syscalls.h b/libc/sysdeps/linux/avr32/bits/syscalls.h
5521 --- a/libc/sysdeps/linux/avr32/bits/syscalls.h 1969-12-31 19:00:00.000000000 -0500
5522 +++ b/libc/sysdeps/linux/avr32/bits/syscalls.h 2008-02-28 19:02:10.000000000 -0500
5525 +# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
5529 + * This includes the `__NR_<name>' syscall numbers taken from the
5530 + * Linux kernel header files. It also defines the traditional
5531 + * `SYS_<name>' macros for older programs.
5533 +#include <bits/sysnum.h>
5535 +#ifndef __set_errno
5536 +# define __set_errno(val) (*__errno_location()) = (val)
5539 +# define SYS_ify(syscall_name) (__NR_##syscall_name)
5542 +#ifndef __ASSEMBLER__
5545 +#define _syscall0(type,name) \
5548 + return (type)(INLINE_SYSCALL(name, 0)); \
5552 +#define _syscall1(type,name,type1,arg1) \
5553 + type name(type1 arg1) \
5555 + return (type)(INLINE_SYSCALL(name, 1, arg1)); \
5559 +#define _syscall2(type,name,type1,arg1,type2,arg2) \
5560 + type name(type1 arg1, type2 arg2) \
5562 + return (type)(INLINE_SYSCALL(name, 2, arg1, arg2)); \
5566 +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
5567 + type name(type1 arg1, type2 arg2, type3 arg3) \
5569 + return (type)(INLINE_SYSCALL(name, 3, arg1, \
5574 +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \
5576 + type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
5578 + return (type)(INLINE_SYSCALL(name, 4, arg1, arg2, \
5583 +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3, \
5584 + type4,arg4,type5,arg5) \
5585 + type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
5588 + return (type)(INLINE_SYSCALL(name, 5, arg1, arg2, \
5589 + arg3, arg4, arg5)); \
5593 +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3, \
5594 + type4,arg4,type5,arg5,type6,arg6) \
5595 + type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
5596 + type5 arg5, type6 arg6) \
5598 + return (type)(INLINE_SYSCALL(name, 6, arg1, arg2, arg3, \
5599 + arg4, arg5, arg6)); \
5603 +#define unlikely(x) __builtin_expect((x), 0)
5605 +#undef INLINE_SYSCALL
5606 +#define INLINE_SYSCALL(name, nr, args...) \
5608 + unsigned _sys_result = INTERNAL_SYSCALL(name, , nr, args); \
5609 + if (unlikely(INTERNAL_SYSCALL_ERROR_P(_sys_result, ))) { \
5610 + __set_errno(INTERNAL_SYSCALL_ERRNO(_sys_result, )); \
5611 + _sys_result = (unsigned int) -1; \
5613 + (int) _sys_result; \
5616 +#undef INTERNAL_SYSCALL_DECL
5617 +#define INTERNAL_SYSCALL_DECL(err) do { } while(0)
5619 +#undef INTERNAL_SYSCALL
5620 +#define INTERNAL_SYSCALL(name, err, nr, args...) \
5622 + register int _a1 asm ("r12"); \
5623 + register int _scno asm("r8") = SYS_ify(name); \
5624 + LOAD_ARGS_##nr (args); \
5625 + asm volatile ("scall /* syscall " #name " */" \
5627 + : "r"(_scno) ASM_ARGS_##nr \
5628 + : "lr", "cc", "memory"); \
5632 +#undef INTERNAL_SYSCALL_ERROR_P
5633 +#define INTERNAL_SYSCALL_ERROR_P(val, err) \
5634 + ((unsigned int)(val) >= 0xfffff001U)
5636 +#undef INTERNAL_SYSCALL_ERRNO
5637 +#define INTERNAL_SYSCALL_ERRNO(val, errr) (-(val))
5639 +#define LOAD_ARGS_0() do { } while(0)
5641 +#define LOAD_ARGS_1(a1) \
5642 + _a1 = (int) (a1); \
5644 +#define ASM_ARGS_1 ASM_ARGS_0, "r"(_a1)
5645 +#define LOAD_ARGS_2(a1, a2) \
5646 + register int _a2 asm("r11") = (int)(a2); \
5648 +#define ASM_ARGS_2 ASM_ARGS_1, "r"(_a2)
5649 +#define LOAD_ARGS_3(a1, a2, a3) \
5650 + register int _a3 asm("r10") = (int)(a3); \
5651 + LOAD_ARGS_2(a1, a2)
5652 +#define ASM_ARGS_3 ASM_ARGS_2, "r"(_a3)
5653 +#define LOAD_ARGS_4(a1, a2, a3, a4) \
5654 + register int _a4 asm("r9") = (int)(a4); \
5655 + LOAD_ARGS_3(a1, a2, a3)
5656 +#define ASM_ARGS_4 ASM_ARGS_3, "r"(_a4)
5657 +#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
5658 + register int _a5 asm("r5") = (int)(a5); \
5659 + LOAD_ARGS_4(a1, a2, a3, a4)
5660 +#define ASM_ARGS_5 ASM_ARGS_4, "r"(_a5)
5661 +#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
5662 + register int _a6 asm("r3") = (int)(a6); \
5663 + LOAD_ARGS_5(a1, a2, a3, a4, a5)
5664 +#define ASM_ARGS_6 ASM_ARGS_5, "r"(_a6)
5666 +#endif /* __ASSEMBLER__ */
5667 diff -Nrup a/libc/sysdeps/linux/avr32/bits/wordsize.h b/libc/sysdeps/linux/avr32/bits/wordsize.h
5668 --- a/libc/sysdeps/linux/avr32/bits/wordsize.h 1969-12-31 19:00:00.000000000 -0500
5669 +++ b/libc/sysdeps/linux/avr32/bits/wordsize.h 2008-02-28 19:02:10.000000000 -0500
5671 +#define __WORDSIZE 32
5672 diff -Nrup a/libc/sysdeps/linux/avr32/brk.c b/libc/sysdeps/linux/avr32/brk.c
5673 --- a/libc/sysdeps/linux/avr32/brk.c 1969-12-31 19:00:00.000000000 -0500
5674 +++ b/libc/sysdeps/linux/avr32/brk.c 2008-02-28 19:02:10.000000000 -0500
5677 + * Copyright (C) 2004 Atmel Norway AS
5680 +#include <sys/syscall.h>
5682 +void *__curbrk = 0;
5684 +int brk (void *addr)
5688 + newbrk = INLINE_SYSCALL(brk, 1, addr);
5690 + __curbrk = newbrk;
5692 + if (newbrk < addr) {
5693 + __set_errno (ENOMEM);
5699 diff -Nrup a/libc/sysdeps/linux/avr32/bsd-_setjmp.S b/libc/sysdeps/linux/avr32/bsd-_setjmp.S
5700 --- a/libc/sysdeps/linux/avr32/bsd-_setjmp.S 1969-12-31 19:00:00.000000000 -0500
5701 +++ b/libc/sysdeps/linux/avr32/bsd-_setjmp.S 2008-02-28 19:02:10.000000000 -0500
5704 + * Copyright (C) 2004 Atmel Norway AS
5707 + /* This just does a tail-call to __sigsetjmp(env, 0) */
5709 + .type _setjmp,"function"
5713 + bral __sigsetjmp_internal
5714 + .size _setjmp, . - _setjmp
5715 diff -Nrup a/libc/sysdeps/linux/avr32/bsd-setjmp.S b/libc/sysdeps/linux/avr32/bsd-setjmp.S
5716 --- a/libc/sysdeps/linux/avr32/bsd-setjmp.S 1969-12-31 19:00:00.000000000 -0500
5717 +++ b/libc/sysdeps/linux/avr32/bsd-setjmp.S 2008-02-28 19:02:10.000000000 -0500
5720 + * Copyright (C) 2004 Atmel Norway AS
5723 + /* This just does a tail-call to __sigsetjmp(env, 1) */
5725 + .type setjmp,"function"
5729 + bral __sigsetjmp_internal
5730 + .size setjmp, . - setjmp
5731 diff -Nrup a/libc/sysdeps/linux/avr32/clone.c b/libc/sysdeps/linux/avr32/clone.c
5732 --- a/libc/sysdeps/linux/avr32/clone.c 1969-12-31 19:00:00.000000000 -0500
5733 +++ b/libc/sysdeps/linux/avr32/clone.c 2008-02-28 19:02:10.000000000 -0500
5736 + * Copyright (C) 2004 Atmel Norway AS
5739 +#include <sys/syscall.h>
5740 +#include <unistd.h>
5743 + * I don't know if we can be absolutely certain that the fn and arg
5744 + * parameters are preserved when returning as the child. If the
5745 + * compiler stores them in registers (r0-r7), they should be.
5747 +int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg)
5749 + register int (*_fn)(void *arg) = fn;
5750 + register void *_arg = arg;
5753 + /* Sanity check the arguments */
5756 + goto syscall_error;
5758 + goto syscall_error;
5760 + err = INLINE_SYSCALL(clone, 2, flags, child_stack);
5762 + goto syscall_error;
5763 + else if (err != 0)
5769 + __set_errno (-err);
5772 diff -Nrup a/libc/sysdeps/linux/avr32/crt1.S b/libc/sysdeps/linux/avr32/crt1.S
5773 --- a/libc/sysdeps/linux/avr32/crt1.S 1969-12-31 19:00:00.000000000 -0500
5774 +++ b/libc/sysdeps/linux/avr32/crt1.S 2008-02-28 19:02:10.000000000 -0500
5777 + * Copyright (C) 2004 Atmel Norway AS
5779 + * When we enter _start, the stack looks like this:
5780 + * argc argument counter
5781 + * argv[0] pointer to program name
5782 + * argv[1..argc-1] pointers to program args
5784 + * env[0..N] pointers to environment variables
5787 + * r12 contains a function pointer to be registered with `atexit'.
5788 + * This is how the dynamic linker arranges to have DT_FINI functions
5789 + * called for shared libraries that have been loaded before this
5792 + * We're going to call the following function:
5793 + * __uClibc_main(int (*main)(int, char **, char **), int argc,
5794 + * char **argv, void (*app_init)(void), void (*app_fini)(void),
5795 + * void (*rtld_fini)(void), void *stack_end)
5797 + * So we need to set up things as follows:
5798 + * r12 = address of main
5801 + * r9 = address of _init
5802 + * r8 = address of _fini
5803 + * sp[0] = whatever we got passed in r12
5806 +#include <features.h>
5810 + .type _start, @function
5812 + /* Clear the frame pointer and link register since this is the outermost frame. */
5816 + ld.w r11, sp++ /* argc */
5817 + mov r10, sp /* &argv[0] */
5819 + st.w --sp, r10 /* stack_end */
5820 + st.w --sp, r12 /* rtld_fini */
5830 + /* Ok, now run uClibc's main() -- should not return */
5831 + call __uClibc_main
5835 + .long .L_RGOT - _GLOBAL_OFFSET_TABLE_
5837 + lddpc r9, __init_addr /* app_init */
5838 + lddpc r8, __fini_addr /* app_fini */
5839 + lddpc r12, __main_addr /* main */
5841 + /* Ok, now run uClibc's main() -- should not return */
5842 + lddpc pc, ___uClibc_main_addr
5851 +___uClibc_main_addr:
5852 + .long __uClibc_main
5854 + .size _start, . - _start
5857 + * The LSB says we need this.
5859 + .section ".note.ABI-tag", "a"
5861 + .long 2f - 1f /* namesz */
5862 + .long 4f - 3f /* descsz */
5863 + .long 1 /* type */
5864 +1: .asciz "GNU" /* name */
5866 +3: .long 0 /* Linux executable */
5867 + .long 2,6,0 /* Earliest compatible kernel */
5869 diff -Nrup a/libc/sysdeps/linux/avr32/crti.S b/libc/sysdeps/linux/avr32/crti.S
5870 --- a/libc/sysdeps/linux/avr32/crti.S 1969-12-31 19:00:00.000000000 -0500
5871 +++ b/libc/sysdeps/linux/avr32/crti.S 2008-02-28 19:02:10.000000000 -0500
5877 + .type _init, @function
5879 + /* Use a four-byte instruction to avoid NOPs */
5880 + stm --sp, r0-r7,lr
5886 + .type _fini, @function
5888 + stm --sp, r0-r7,lr
5890 diff -Nrup a/libc/sysdeps/linux/avr32/crtn.S b/libc/sysdeps/linux/avr32/crtn.S
5891 --- a/libc/sysdeps/linux/avr32/crtn.S 1969-12-31 19:00:00.000000000 -0500
5892 +++ b/libc/sysdeps/linux/avr32/crtn.S 2008-02-28 19:02:10.000000000 -0500
5898 + .type _init, @function
5899 + ldm sp++, r0-r7,pc
5900 + .size _init, . - _init
5905 + .type _fini, @function
5906 + ldm sp++, r0-r7,pc
5907 + .size _fini, . - _fini
5908 diff -Nrup a/libc/sysdeps/linux/avr32/__longjmp.S b/libc/sysdeps/linux/avr32/__longjmp.S
5909 --- a/libc/sysdeps/linux/avr32/__longjmp.S 1969-12-31 19:00:00.000000000 -0500
5910 +++ b/libc/sysdeps/linux/avr32/__longjmp.S 2008-02-28 19:02:10.000000000 -0500
5912 +/* longjmp for AVR32
5914 + * Copyright (C) 2004 Atmel Norway AS
5918 + .type __longjmp,"function"
5921 + ldm r12++, r0,r1,r2,r3,r4,r5,r6,r7,r8,sp,lr
5922 + mov r12, r11 /* get the return value right */
5923 + mustr r8 /* restore status register (lower half) */
5924 + cp r12, 0 /* can't return zero */
5928 + .size __longjmp, . - __longjmp
5929 diff -Nrup a/libc/sysdeps/linux/avr32/Makefile b/libc/sysdeps/linux/avr32/Makefile
5930 --- a/libc/sysdeps/linux/avr32/Makefile 1969-12-31 19:00:00.000000000 -0500
5931 +++ b/libc/sysdeps/linux/avr32/Makefile 2008-02-28 19:02:10.000000000 -0500
5933 +# Makefile for uClibc
5935 +# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
5937 +# This program is free software; you can redistribute it and/or modify it under
5938 +# the terms of the GNU Library General Public License as published by the Free
5939 +# Software Foundation; either version 2 of the License, or (at your option) any
5942 +# This program is distributed in the hope that it will be useful, but WITHOUT
5943 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
5944 +# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
5947 +# You should have received a copy of the GNU Library General Public License
5948 +# along with this program; if not, write to the Free Software Foundation, Inc.,
5949 +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5951 +TOPDIR=../../../../
5952 +include $(TOPDIR)Rules.mak
5957 +SCRT_OBJ = $(patsubst %,S%, $(CRT_OBJ))
5958 +CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
5960 +SSRC=__longjmp.S setjmp.S bsd-setjmp.S vfork.S \
5961 + bsd-_setjmp.S sigrestorer.S syscall.S
5962 +SOBJS=$(patsubst %.S,%.o, $(SSRC))
5964 +CSRC=clone.c brk.c sigaction.c mmap.c
5965 +COBJS=$(patsubst %.c,%.o, $(CSRC))
5967 +OBJS=$(SOBJS) $(COBJS)
5969 +OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH)
5973 +$(OBJ_LIST): $(OBJS) $(CRT_OBJ) $(SCRT_OBJ) $(CTOR_TARGETS)
5974 + echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $(OBJ_LIST)
5975 + $(INSTALL) -d $(TOPDIR)lib/
5976 + cp $(CRT_OBJ) $(SCRT_OBJ) $(TOPDIR)lib/
5978 +$(CRT_OBJ): $(CRT_SRC)
5979 + $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
5980 + $(STRIPTOOL) -x -R .note -R .comment $*.o
5982 +$(SCRT_OBJ): $(CRT_SRC)
5983 + $(CC) $(ASFLAGS) $(PIEFLAG) -DL_$* $< -c -o $*.o
5984 + $(STRIPTOOL) -x -R .note -R .comment $*.o
5986 +$(SOBJS): %.o : %.S
5987 + $(CC) $(ASFLAGS) -c $< -o $@
5988 + $(STRIPTOOL) -x -R .note -R .comment $*.o
5990 +$(COBJS): %.o : %.c
5991 + $(CC) $(CFLAGS) -c $< -o $@
5992 + $(STRIPTOOL) -x -R .note -R .comment $*.o
5994 +ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
5996 + $(CC) $(ASFLAGS) -c crti.S -o crti.o
5998 +$(TOPDIR)lib/crti.o: crti.o
5999 + $(INSTALL) -d $(TOPDIR)lib/
6000 + cp crti.o $(TOPDIR)lib/
6003 + $(CC) $(ASFLAGS) -c crtn.S -o crtn.o
6005 +$(TOPDIR)lib/crtn.o: crtn.o
6006 + $(INSTALL) -d $(TOPDIR)lib/
6007 + cp crtn.o $(TOPDIR)lib/
6009 +$(TOPDIR)lib/crti.o:
6010 + $(INSTALL) -d $(TOPDIR)lib/
6011 + $(AR) $(ARFLAGS) $(TOPDIR)lib/crti.o
6012 +$(TOPDIR)lib/crtn.o:
6013 + $(INSTALL) -d $(TOPDIR)lib/
6014 + $(AR) $(ARFLAGS) $(TOPDIR)lib/crtn.o
6019 +# $(LN) -fs ../libc/sysdeps/linux/avr32/fpu_control.h $(TOPDIR)/include/
6022 + $(RM) *.[oa] *~ core
6023 + $(RM) bits/sysnum.h
6024 + $(RM) gmon-start.S
6026 diff -Nrup a/libc/sysdeps/linux/avr32/_mmap.c b/libc/sysdeps/linux/avr32/_mmap.c
6027 --- a/libc/sysdeps/linux/avr32/_mmap.c 1969-12-31 19:00:00.000000000 -0500
6028 +++ b/libc/sysdeps/linux/avr32/_mmap.c 2008-02-28 19:02:10.000000000 -0500
6030 +/* Copyright (C) 2005 Atmel Norway
6032 + This program is free software; you can redistribute it and/or modify it under
6033 + the terms of the GNU Library General Public License as published by the Free
6034 + Software Foundation; either version 2 of the License, or (at your option) any
6037 + This program is distributed in the hope that it will be useful, but WITHOUT
6038 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
6039 + FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
6042 + You should have received a copy of the GNU Library General Public License
6043 + along with this program; if not, write to the Free Software Foundation, Inc.,
6044 + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6046 + Derived in part from the Linux-8086 C library, the GNU C Library, and several
6047 + other sundry sources. Files within this library are copyright by their
6048 + respective copyright holders.
6052 +#include <sys/mman.h>
6053 +#include <sys/syscall.h>
6055 +#define __NR_mmap2 __NR_mmap
6057 +static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, pgoff);
6059 +__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
6061 + return mmap2(addr, len, prot, flags, fd, offset >> 12);
6063 diff -Nrup a/libc/sysdeps/linux/avr32/mmap.c b/libc/sysdeps/linux/avr32/mmap.c
6064 --- a/libc/sysdeps/linux/avr32/mmap.c 1969-12-31 19:00:00.000000000 -0500
6065 +++ b/libc/sysdeps/linux/avr32/mmap.c 2008-02-28 19:02:10.000000000 -0500
6067 +/* Copyright (C) 2005 Atmel Norway
6069 + This program is free software; you can redistribute it and/or modify it under
6070 + the terms of the GNU Library General Public License as published by the Free
6071 + Software Foundation; either version 2 of the License, or (at your option) any
6074 + This program is distributed in the hope that it will be useful, but WITHOUT
6075 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
6076 + FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
6079 + You should have received a copy of the GNU Library General Public License
6080 + along with this program; if not, write to the Free Software Foundation, Inc.,
6081 + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6083 + Derived in part from the Linux-8086 C library, the GNU C Library, and several
6084 + other sundry sources. Files within this library are copyright by their
6085 + respective copyright holders.
6089 +#include <sys/mman.h>
6090 +#include <sys/syscall.h>
6092 +static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, pgoff);
6094 +__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
6096 + return mmap2(addr, len, prot, flags, fd, offset >> 12);
6098 diff -Nrup a/libc/sysdeps/linux/avr32/setjmp.S b/libc/sysdeps/linux/avr32/setjmp.S
6099 --- a/libc/sysdeps/linux/avr32/setjmp.S 1969-12-31 19:00:00.000000000 -0500
6100 +++ b/libc/sysdeps/linux/avr32/setjmp.S 2008-02-28 19:02:10.000000000 -0500
6103 + * Copyright (C) 2004 Atmel Norway AS
6107 +#include <bits/setjmp.h>
6111 + .global __sigsetjmp
6112 + .type __sigsetjmp,"function"
6114 + /* Create a global, hidden symbol for use by setjmp() and _setjmp().
6115 + If it's not hidden, the linker will complain about a relative
6116 + jump to a dynamic symbol when building a shared library.
6118 + Also, if a user overrides the __sigsetjmp function, he might not
6119 + expect the setjmp() and _setjmp() function to effectively be
6120 + overridden as well. */
6121 + .global __sigsetjmp_internal
6122 + .hidden __sigsetjmp_internal
6123 + .type __sigsetjmp_internal,"function"
6126 +__sigsetjmp_internal:
6128 + stm r12, r0,r1,r2,r3,r4,r5,r6,r7,r8,sp,lr
6130 + /* Make a tail call to __sigjmp_save; it takes the same args. */
6135 + ld.w r8, r6[__sigjmp_save@got]
6140 +.LG: .long .L1 - _GLOBAL_OFFSET_TABLE_
6142 + rjmp __sigjmp_save
6144 + .size __sigsetjmp, . - __sigsetjmp
6145 diff -Nrup a/libc/sysdeps/linux/avr32/sigaction.c b/libc/sysdeps/linux/avr32/sigaction.c
6146 --- a/libc/sysdeps/linux/avr32/sigaction.c 1969-12-31 19:00:00.000000000 -0500
6147 +++ b/libc/sysdeps/linux/avr32/sigaction.c 2008-02-28 19:02:10.000000000 -0500
6150 + * Copyright (C) 2004 Atmel Norway AS
6153 +#include <signal.h>
6154 +#include <string.h>
6155 +#include <sys/syscall.h>
6156 +#include <bits/kernel_sigaction.h>
6158 +#define SA_RESTORER 0x04000000
6159 +extern void __default_rt_sa_restorer(void);
6162 + * If act is not NULL, change the action for sig to *act.
6163 + * If oact is not NULL, put the old action for sig in *oact.
6165 +int __libc_sigaction(int signum, const struct sigaction *act,
6166 + struct sigaction *oldact)
6168 + struct kernel_sigaction kact, koact;
6172 + kact.k_sa_handler = act->sa_handler;
6173 + memcpy(&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
6174 + kact.sa_flags = act->sa_flags;
6175 + if (kact.sa_flags & (SA_RESTORER | SA_ONSTACK))
6176 + kact.sa_restorer = act->sa_restorer;
6178 + kact.sa_restorer = __default_rt_sa_restorer;
6179 + kact.sa_flags |= SA_RESTORER;
6182 + result = __syscall_rt_sigaction(signum, act ? __ptrvalue(&kact) : NULL,
6183 + oldact ? __ptrvalue(&koact) : NULL,
6186 + if (oldact && result >= 0) {
6187 + oldact->sa_handler = koact.k_sa_handler;
6188 + memcpy(&oldact->sa_mask, &koact.sa_mask,
6189 + sizeof(oldact->sa_mask));
6190 + oldact->sa_flags = koact.sa_flags;
6191 + oldact->sa_restorer = koact.sa_restorer;
6197 +weak_alias(__libc_sigaction, sigaction)
6198 diff -Nrup a/libc/sysdeps/linux/avr32/sigrestorer.S b/libc/sysdeps/linux/avr32/sigrestorer.S
6199 --- a/libc/sysdeps/linux/avr32/sigrestorer.S 1969-12-31 19:00:00.000000000 -0500
6200 +++ b/libc/sysdeps/linux/avr32/sigrestorer.S 2008-02-28 19:02:10.000000000 -0500
6203 + * Copyright (C) 2004 Atmel Norway AS
6205 +#include <sys/syscall.h>
6207 + .global __default_rt_sa_restorer
6208 + .type __default_rt_sa_restorer,"function"
6210 +__default_rt_sa_restorer:
6211 + mov r8, __NR_rt_sigreturn
6213 diff -Nrup a/libc/sysdeps/linux/avr32/sys/elf.h b/libc/sysdeps/linux/avr32/sys/elf.h
6214 --- a/libc/sysdeps/linux/avr32/sys/elf.h 1969-12-31 19:00:00.000000000 -0500
6215 +++ b/libc/sysdeps/linux/avr32/sys/elf.h 2008-02-28 19:02:10.000000000 -0500
6217 +/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
6218 + This file is part of the GNU C Library.
6220 + The GNU C Library is free software; you can redistribute it and/or
6221 + modify it under the terms of the GNU Lesser General Public
6222 + License as published by the Free Software Foundation; either
6223 + version 2.1 of the License, or (at your option) any later version.
6225 + The GNU C Library is distributed in the hope that it will be useful,
6226 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6227 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6228 + Lesser General Public License for more details.
6230 + You should have received a copy of the GNU Lesser General Public
6231 + License along with the GNU C Library; if not, write to the Free
6232 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6233 + 02111-1307 USA. */
6236 +#define _SYS_ELF_H 1
6238 +#warning "This header is obsolete; use <sys/procfs.h> instead."
6240 +#include <sys/procfs.h>
6242 +#endif /* sys/elf.h */
6243 diff -Nrup a/libc/sysdeps/linux/avr32/sys/io.h b/libc/sysdeps/linux/avr32/sys/io.h
6244 --- a/libc/sysdeps/linux/avr32/sys/io.h 1969-12-31 19:00:00.000000000 -0500
6245 +++ b/libc/sysdeps/linux/avr32/sys/io.h 2008-02-28 19:02:10.000000000 -0500
6247 +/* Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
6248 + This file is part of the GNU C Library.
6250 + The GNU C Library is free software; you can redistribute it and/or
6251 + modify it under the terms of the GNU Lesser General Public
6252 + License as published by the Free Software Foundation; either
6253 + version 2.1 of the License, or (at your option) any later version.
6255 + The GNU C Library is distributed in the hope that it will be useful,
6256 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6257 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6258 + Lesser General Public License for more details.
6260 + You should have received a copy of the GNU Lesser General Public
6261 + License along with the GNU C Library; if not, write to the Free
6262 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6263 + 02111-1307 USA. */
6267 +#define _SYS_IO_H 1
6268 +#include <features.h>
6272 +/* If TURN_ON is TRUE, request for permission to do direct i/o on the
6273 + port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O
6274 + permission off for that range. This call requires root privileges. */
6275 +extern int ioperm (unsigned long int __from, unsigned long int __num,
6276 + int __turn_on) __THROW;
6278 +/* Set the I/O privilege level to LEVEL. If LEVEL is nonzero,
6279 + permission to access any I/O port is granted. This call requires
6280 + root privileges. */
6281 +extern int iopl (int __level) __THROW;
6283 +/* The functions that actually perform reads and writes. */
6284 +extern unsigned char inb (unsigned long int port) __THROW;
6285 +extern unsigned short int inw (unsigned long int port) __THROW;
6286 +extern unsigned long int inl (unsigned long int port) __THROW;
6288 +extern void outb (unsigned char value, unsigned long int port) __THROW;
6289 +extern void outw (unsigned short value, unsigned long int port) __THROW;
6290 +extern void outl (unsigned long value, unsigned long int port) __THROW;
6294 +#endif /* _SYS_IO_H */
6295 diff -Nrup a/libc/sysdeps/linux/avr32/sys/procfs.h b/libc/sysdeps/linux/avr32/sys/procfs.h
6296 --- a/libc/sysdeps/linux/avr32/sys/procfs.h 1969-12-31 19:00:00.000000000 -0500
6297 +++ b/libc/sysdeps/linux/avr32/sys/procfs.h 2008-02-28 19:02:10.000000000 -0500
6299 +/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
6300 + This file is part of the GNU C Library.
6302 + The GNU C Library is free software; you can redistribute it and/or
6303 + modify it under the terms of the GNU Lesser General Public
6304 + License as published by the Free Software Foundation; either
6305 + version 2.1 of the License, or (at your option) any later version.
6307 + The GNU C Library is distributed in the hope that it will be useful,
6308 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6309 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6310 + Lesser General Public License for more details.
6312 + You should have received a copy of the GNU Lesser General Public
6313 + License along with the GNU C Library; if not, write to the Free
6314 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6315 + 02111-1307 USA. */
6317 +#ifndef _SYS_PROCFS_H
6318 +#define _SYS_PROCFS_H 1
6320 +/* This is somewhat modelled after the file of the same name on SVR4
6321 + systems. It provides a definition of the core file format for ELF
6322 + used on Linux. It doesn't have anything to do with the /proc file
6323 + system, even though Linux has one.
6325 + Anyway, the whole purpose of this file is for GDB and GDB only.
6326 + Don't read too much into it. Don't use it for anything other than
6327 + GDB unless you know what you are doing. */
6329 +#include <features.h>
6330 +#include <sys/time.h>
6331 +#include <sys/types.h>
6332 +#include <sys/user.h>
6336 +/* Type for a general-purpose register. */
6337 +typedef unsigned long elf_greg_t;
6339 +/* And the whole bunch of them. We could have used `struct
6340 + user_regs' directly in the typedef, but tradition says that
6341 + the register set is an array, which does have some peculiar
6342 + semantics, so leave it that way. */
6343 +#define ELF_NGREG (sizeof (struct user_regs) / sizeof(elf_greg_t))
6344 +typedef elf_greg_t elf_gregset_t[ELF_NGREG];
6346 +/* Register set for the floating-point registers. */
6347 +typedef struct user_fpregs elf_fpregset_t;
6352 + int si_signo; /* Signal number. */
6353 + int si_code; /* Extra code. */
6354 + int si_errno; /* Errno. */
6357 +/* Definitions to generate Intel SVR4-like core files. These mostly
6358 + have the same names as the SVR4 types with "elf_" tacked on the
6359 + front to prevent clashes with Linux definitions, and the typedef
6360 + forms have been avoided. This is mostly like the SVR4 structure,
6361 + but more Linuxy, with things that Linux does not support and which
6362 + GDB doesn't really use excluded. */
6364 +struct elf_prstatus
6366 + struct elf_siginfo pr_info; /* Info associated with signal. */
6367 + short int pr_cursig; /* Current signal. */
6368 + unsigned long int pr_sigpend; /* Set of pending signals. */
6369 + unsigned long int pr_sighold; /* Set of held signals. */
6374 + struct timeval pr_utime; /* User time. */
6375 + struct timeval pr_stime; /* System time. */
6376 + struct timeval pr_cutime; /* Cumulative user time. */
6377 + struct timeval pr_cstime; /* Cumulative system time. */
6378 + elf_gregset_t pr_reg; /* GP registers. */
6379 + int pr_fpvalid; /* True if math copro being used. */
6383 +#define ELF_PRARGSZ (80) /* Number of chars for args. */
6385 +struct elf_prpsinfo
6387 + char pr_state; /* Numeric process state. */
6388 + char pr_sname; /* Char for pr_state. */
6389 + char pr_zomb; /* Zombie. */
6390 + char pr_nice; /* Nice val. */
6391 + unsigned long int pr_flag; /* Flags. */
6392 + unsigned short int pr_uid;
6393 + unsigned short int pr_gid;
6394 + int pr_pid, pr_ppid, pr_pgrp, pr_sid;
6395 + /* Lots missing */
6396 + char pr_fname[16]; /* Filename of executable. */
6397 + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
6400 +/* The rest of this file provides the types for emulation of the
6401 + Solaris <proc_service.h> interfaces that should be implemented by
6402 + users of libthread_db. */
6405 +typedef void *psaddr_t;
6407 +/* Register sets. Linux has different names. */
6408 +typedef elf_gregset_t prgregset_t;
6409 +typedef elf_fpregset_t prfpregset_t;
6411 +/* We don't have any differences between processes and threads,
6412 + therefore have only one PID type. */
6413 +typedef __pid_t lwpid_t;
6415 +/* Process status and info. In the end we do provide typedefs for them. */
6416 +typedef struct elf_prstatus prstatus_t;
6417 +typedef struct elf_prpsinfo prpsinfo_t;
6421 +#endif /* sys/procfs.h */
6422 diff -Nrup a/libc/sysdeps/linux/avr32/sys/ucontext.h b/libc/sysdeps/linux/avr32/sys/ucontext.h
6423 --- a/libc/sysdeps/linux/avr32/sys/ucontext.h 1969-12-31 19:00:00.000000000 -0500
6424 +++ b/libc/sysdeps/linux/avr32/sys/ucontext.h 2008-02-28 19:02:10.000000000 -0500
6426 +/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
6427 + This file is part of the GNU C Library.
6429 + The GNU C Library is free software; you can redistribute it and/or
6430 + modify it under the terms of the GNU Lesser General Public
6431 + License as published by the Free Software Foundation; either
6432 + version 2.1 of the License, or (at your option) any later version.
6434 + The GNU C Library is distributed in the hope that it will be useful,
6435 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6436 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6437 + Lesser General Public License for more details.
6439 + You should have received a copy of the GNU Lesser General Public
6440 + License along with the GNU C Library; if not, write to the Free
6441 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6442 + 02111-1307 USA. */
6444 +/* Linux/AVR32 ABI compliant context switching support. */
6446 +#ifndef _SYS_UCONTEXT_H
6447 +#define _SYS_UCONTEXT_H 1
6449 +#include <features.h>
6450 +#include <signal.h>
6451 +#include <sys/procfs.h>
6452 +#include <bits/sigcontext.h>
6454 +typedef int greg_t;
6456 +/* Number of general registers. */
6459 +/* Container for all general registers. */
6460 +typedef elf_gregset_t gregset_t;
6462 +/* Number of each register is the `gregset_t' array. */
6499 +/* Structure to describe FPU registers. */
6500 +typedef elf_fpregset_t fpregset_t;
6502 +/* Context to describe whole processor state. */
6506 + fpregset_t fpregs;
6509 +/* Userlevel context. */
6510 +typedef struct ucontext
6512 + unsigned long uc_flags;
6513 + struct ucontext *uc_link;
6515 + struct sigcontext uc_mcontext;
6516 + sigset_t uc_sigmask; /* mask last for extensibility */
6519 +#endif /* sys/ucontext.h */
6520 diff -Nrup a/libc/sysdeps/linux/avr32/sys/user.h b/libc/sysdeps/linux/avr32/sys/user.h
6521 --- a/libc/sysdeps/linux/avr32/sys/user.h 1969-12-31 19:00:00.000000000 -0500
6522 +++ b/libc/sysdeps/linux/avr32/sys/user.h 2008-02-28 19:02:10.000000000 -0500
6524 +#ifndef _SYS_USER_H
6525 +#define _SYS_USER_H
6538 + unsigned long r12;
6539 + unsigned long r11;
6540 + unsigned long r10;
6551 + unsigned long r12_orig;
6556 + struct user_regs regs; /* general registers */
6557 + size_t u_tsize; /* text size (pages) */
6558 + size_t u_dsize; /* data size (pages) */
6559 + size_t u_ssize; /* stack size (pages) */
6560 + unsigned long start_code; /* text starting address */
6561 + unsigned long start_data; /* data starting address */
6562 + unsigned long start_stack; /* stack starting address */
6563 + long int signal; /* signal causing core dump */
6564 + struct user_regs * u_ar0; /* help gdb find registers */
6565 + unsigned long magic; /* identifies a core file */
6566 + char u_comm[32]; /* user command name */
6569 +#endif /* _SYS_USER_H */
6570 diff -Nrup a/libc/sysdeps/linux/avr32/syscall.S b/libc/sysdeps/linux/avr32/syscall.S
6571 --- a/libc/sysdeps/linux/avr32/syscall.S 1969-12-31 19:00:00.000000000 -0500
6572 +++ b/libc/sysdeps/linux/avr32/syscall.S 2008-02-28 19:02:10.000000000 -0500
6575 + * syscall for AVR32/uClibc
6577 + * Copyright (C) 2004 Atmel Norway
6579 + * This program is free software; you can redistribute it and/or modify it
6580 + * under the terms of the GNU Library General Public License as published by
6581 + * the Free Software Foundation; either version 2 of the License, or (at your
6582 + * option) any later version.
6584 + * This program is distributed in the hope that it will be useful, but WITHOUT
6585 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6586 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
6587 + * for more details.
6589 + * You should have received a copy of the GNU Library General Public License
6590 + * along with this program; if not, write to the Free Software Foundation,
6591 + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6593 +#include <features.h>
6598 + * long int syscall(long int sysno, ...)
6601 + .type syscall, @function
6604 + stm --sp, r3,r5,lr
6607 + ldm lr, r3,r5,r9-r12
6616 +# ifdef __UCLIBC_HAS_THREADS__
6618 + mcall r5[__errno_location@got]
6621 + ld.w r3, r5[errno@got]
6625 +# ifdef __UCLIBC_HAS_THREADS__
6627 + mcall .Lerrno_location
6637 + ldm sp++, r3,r5,pc
6642 + .long .Lgotcalc - _GLOBAL_OFFSET_TABLE_
6644 +# ifdef __UCLIBC_HAS_THREADS__
6646 + .long __errno_location
6654 + .size syscall, . - syscall
6655 diff -Nrup a/libc/sysdeps/linux/avr32/vfork.S b/libc/sysdeps/linux/avr32/vfork.S
6656 --- a/libc/sysdeps/linux/avr32/vfork.S 1969-12-31 19:00:00.000000000 -0500
6657 +++ b/libc/sysdeps/linux/avr32/vfork.S 2008-02-28 19:02:10.000000000 -0500
6660 + * vfork for uClibc
6662 + * Copyright (C) 2005 Atmel Norway
6666 + * Clone the process without copying the address space. The
6667 + * calling process is suspended until the child either exits
6668 + * or calls execve.
6670 + * This all means that we cannot rely on the stack to store
6671 + * away registers, since they will be overwritten by the child
6672 + * as soon as it makes another function call (e.g. execve()).
6673 + * Fortunately, the Linux kernel preserves LR across system calls.
6675 +#include <features.h>
6676 +#include <sys/syscall.h>
6679 + .type __vfork,@function
6682 + mov r8, __NR_vfork
6687 + /* vfork failed, so we may use the stack freely */
6694 + mcall r6[__errno_location@got]
6697 + mcall .L__errno_location
6700 + popm r4-r7,pc,r12=-1
6705 + .long .L_RGOT - _GLOBAL_OFFSET_TABLE_
6707 +.L__errno_location:
6708 + .long __errno_location
6710 + .size __vfork, . - __vfork
6714 diff -Nrup a/libc/sysdeps/linux/common/create_module.c b/libc/sysdeps/linux/common/create_module.c
6715 --- a/libc/sysdeps/linux/common/create_module.c 2004-03-11 19:21:20.000000000 -0500
6716 +++ b/libc/sysdeps/linux/common/create_module.c 2008-02-28 19:02:10.000000000 -0500
6717 @@ -61,7 +61,8 @@ unsigned long create_module(const char *
6719 return __create_module(name, size, 0, 0);
6722 +/* create_module is obsolete in Linux 2.6, so AVR32 doesn't have it */
6723 +#elif !defined(__avr32__)
6724 /* Sparc, MIPS, etc don't mistake return values for errors. */
6725 _syscall2(unsigned long, create_module, const char *, name, size_t, size);
6727 diff -Nrup a/libc/sysdeps/linux/common/getrusage.c b/libc/sysdeps/linux/common/getrusage.c
6728 --- a/libc/sysdeps/linux/common/getrusage.c 2005-01-05 18:11:28.000000000 -0500
6729 +++ b/libc/sysdeps/linux/common/getrusage.c 2008-02-28 19:02:10.000000000 -0500
6731 #include "syscalls.h"
6734 -_syscall2(int, getrusage, int, who, struct rusage *, usage);
6735 +_syscall2(int, getrusage, __rusage_who_t, who, struct rusage *, usage);
6736 diff -Nrup a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c
6737 --- a/libc/sysdeps/linux/common/open64.c 2002-10-31 13:20:21.000000000 -0500
6738 +++ b/libc/sysdeps/linux/common/open64.c 2008-02-28 19:02:10.000000000 -0500
6742 #ifdef __UCLIBC_HAS_LFS__
6743 -extern int __libc_open (__const char *file, int oflag, mode_t mode);
6744 +extern int __libc_open (__const char *file, int oflag, ...);
6746 /* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
6747 a third argument is the file protection. */
6748 diff -Nrup a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c
6749 --- a/libc/sysdeps/linux/common/__syscall_fcntl.c 2005-07-30 10:02:24.000000000 -0400
6750 +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c 2008-02-28 19:02:10.000000000 -0500
6754 #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
6755 -extern int __libc_fcntl64(int fd, int cmd, long arg);
6756 +extern int __libc_fcntl64(int fd, int cmd, ...);
6759 #define __NR___syscall_fcntl __NR_fcntl
6760 diff -Nrup a/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h b/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h
6761 --- a/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h 1969-12-31 19:00:00.000000000 -0500
6762 +++ b/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h 2008-02-28 19:02:10.000000000 -0500
6764 +/* Machine-dependent pthreads configuration and inline functions.
6766 + Copyright (C) 2005 Atmel Norway
6767 + This file is part of the GNU C Library.
6769 + The GNU C Library is free software; you can redistribute it and/or
6770 + modify it under the terms of the GNU Lesser General Public License as
6771 + published by the Free Software Foundation; either version 2.1 of the
6772 + License, or (at your option) any later version.
6774 + The GNU C Library is distributed in the hope that it will be useful,
6775 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6776 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6777 + Lesser General Public License for more details.
6779 + You should have received a copy of the GNU Lesser General Public
6780 + License along with the GNU C Library; see the file COPYING.LIB. If not,
6781 + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
6782 + Boston, MA 02111-1307, USA. */
6784 +#ifndef _PT_MACHINE_H
6785 +#define _PT_MACHINE_H 1
6787 +#include <features.h>
6790 +_test_and_set (int *p, int v) __THROW
6794 + __asm__ __volatile__(
6795 + "/* Inline test and set */\n"
6800 + " stcond %1, %3\n"
6803 + : "=&r"(result), "=m"(*p)
6805 + : "memory", "cc");
6811 +# define PT_EI extern inline
6814 +extern long int testandset (int *spinlock);
6815 +extern int __compare_and_swap (long int *p, long int oldval, long int newval);
6817 +/* Spinlock implementation; required. */
6819 +testandset (int *spinlock)
6821 + return _test_and_set(spinlock, 1);
6825 +/* Get some notion of the current stack. Need not be exactly the top
6826 + of the stack, just something somewhere in the current frame. */
6827 +#define CURRENT_STACK_FRAME stack_pointer
6828 +register char * stack_pointer __asm__ ("sp");
6830 +/* Compare-and-swap for semaphores. */
6832 +#define HAS_COMPARE_AND_SWAP
6834 +__compare_and_swap(long int *p, long int oldval, long int newval)
6836 + long int result, tmp;
6838 + __asm__ __volatile__(
6839 + "/* Inline compare and swap */\n"
6845 + " stcond %2, %4\n"
6848 + : "=&r"(result), "=&r"(tmp), "=m"(*p)
6849 + : "m"(*p), "r"(newval), "r"(oldval)
6850 + : "cc", "memory");
6855 +#endif /* pt-machine.h */
6856 diff -Nrup a/Makefile b/Makefile
6857 --- a/Makefile 2007-02-01 21:24:29.000000000 -0500
6858 +++ b/Makefile 2008-02-28 19:02:10.000000000 -0500
6859 @@ -163,7 +163,7 @@ install_dev:
6861 extra_exclude="" ; \
6863 - tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \
6864 + tar -chf - --exclude .svn --exclude CVS $$extra_exclude include \
6865 | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
6866 echo '/* Dont use _syscall#() macros; use the syscall() function */' > \
6867 $(PREFIX)$(DEVEL_PREFIX)include/bits/syscalls.h
6868 diff -Nrup a/Makefile.orig b/Makefile.orig
6869 --- a/Makefile.orig 1969-12-31 19:00:00.000000000 -0500
6870 +++ b/Makefile.orig 2007-02-01 21:24:29.000000000 -0500
6872 +# Makefile for uClibc
6874 +# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
6876 +# This program is free software; you can redistribute it and/or
6877 +# modify it under the terms of the GNU Library General Public
6878 +# License as published by the Free Software Foundation; either
6879 +# version 2 of the License, or (at your option) any later
6882 +# This program is distributed in the hope that it will be useful,
6883 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
6884 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6885 +# GNU Library General Public License for more details.
6887 +# You should have received a copy of the GNU Library General
6888 +# Public License along with this program; if not, write to the
6889 +# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
6890 +# Boston, MA 02111-1307 USA
6893 +#--------------------------------------------------------------
6894 +# You shouldn't need to mess with anything beyond this point...
6895 +#--------------------------------------------------------------
6896 +noconfig_targets := menuconfig config oldconfig randconfig \
6897 + defconfig allyesconfig allnoconfig clean distclean \
6902 +DIRS = ldso libc libcrypt libresolv libnsl libutil libm libpthread librt
6903 +ifeq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
6907 +ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
6909 +all: headers pregen subdirs shared finished
6911 +# In this section, we need .config
6912 +-include .config.cmd
6915 +ifeq ($(strip $(HAVE_SHARED)),y)
6917 + $(SECHO) Building shared libraries ...
6919 + @$(MAKE) -C libc shared
6920 + @$(MAKE) -C ldso shared
6921 + @$(MAKE) -C libcrypt shared
6922 + @$(MAKE) -C libresolv shared
6923 + @$(MAKE) -C libnsl shared
6924 + @$(MAKE) -C libutil shared
6925 + @$(MAKE) -C libm shared
6926 + @$(MAKE) -C libpthread shared
6927 + @$(MAKE) -C librt shared
6928 +ifeq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
6929 + @$(MAKE) -C libintl shared
6933 + $(SECHO) Not building shared libraries ...
6939 + $(SECHO) Finally finished compiling ...
6942 +include/bits/uClibc_config.h: .config
6943 + @if [ ! -x ./extra/config/conf ] ; then \
6944 + $(MAKE) -C extra/config conf; \
6946 + $(RM) -r include/bits
6947 + $(INSTALL) -d include/bits
6948 + @./extra/config/conf -o extra/Configs/Config.in
6950 +# For the moment, we have to keep re-running this target
6951 +# because the fix includes scripts rely on pre-processers
6952 +# in order to generate the headers correctly :(. That
6953 +# means we can't use the $(HOSTCC) in order to get the
6955 +ifeq ($(strip $(ARCH_HAS_MMU)),y)
6956 +export header_extra_args =
6958 +export header_extra_args = -n
6960 +headers: include/bits/uClibc_config.h
6961 + @$(SHELL_SET_X); \
6962 + ./extra/scripts/fix_includes.sh \
6963 + -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) \
6964 + $(header_extra_args)
6965 + @cd include/bits; \
6967 + for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \
6968 + $(LN) -fs $$i .; \
6970 + if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits ] ; then \
6971 + for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h` ; do \
6972 + $(LN) -fs $$i .; \
6975 + @cd include/sys; \
6977 + for i in `ls ../../libc/sysdeps/linux/common/sys/*.h` ; do \
6978 + $(LN) -fs $$i .; \
6980 + if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
6981 + for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h` ; do \
6982 + $(LN) -fs $$i .; \
6988 + TOPDIR=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \
6989 + if cmp include/bits/sysnum.h include/bits/sysnum.h.new >/dev/null 2>&1; then \
6990 + $(RM) include/bits/sysnum.h.new; \
6992 + mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \
6994 + $(MAKE) -C libc/sysdeps/linux/common headers
6995 + $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
6997 +# Command used to download source code
6998 +WGET:=wget --passive-ftp
7000 +LOCALE_DATA_FILENAME:=uClibc-locale-030818.tgz
7003 +ifeq ($(strip $(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA)),y)
7004 + (cd extra/locale; \
7005 + if [ ! -f $(LOCALE_DATA_FILENAME) ] ; then \
7006 + $(WGET) http://www.uclibc.org/downloads/$(LOCALE_DATA_FILENAME) ; \
7009 +ifeq ($(strip $(UCLIBC_PREGENERATED_LOCALE_DATA)),y)
7010 + (cd extra/locale; zcat $(LOCALE_DATA_FILENAME) | tar -xvf -)
7011 + $(MAKE) -C extra/locale pregen
7015 +subdirs: $(patsubst %, _dir_%, $(DIRS))
7016 +$(patsubst %, _dir_%, $(DIRS)): headers
7017 + $(MAKE) -C $(patsubst _dir_%, %, $@)
7022 +install: install_runtime install_dev finished2
7025 +RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
7027 +# Installs header files and development library links.
7029 + $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
7030 + $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
7031 + -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
7032 + if [ "$(KERNEL_SOURCE)" = "$(DEVEL_PREFIX)" ] ; then \
7033 + extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \
7035 + extra_exclude="" ; \
7037 + tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \
7038 + | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
7039 + echo '/* Dont use _syscall#() macros; use the syscall() function */' > \
7040 + $(PREFIX)$(DEVEL_PREFIX)include/bits/syscalls.h
7041 +ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y)
7042 + # Remove floating point related headers since float support is disabled.
7043 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
7044 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
7045 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
7046 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
7047 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
7049 +ifneq ($(strip $(UCLIBC_HAS_WCHAR)),y)
7050 + # Remove wide char headers since wide char support is disabled.
7051 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
7052 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
7054 +ifneq ($(strip $(UCLIBC_HAS_LOCALE)),y)
7055 + # Remove iconv header since locale support is disabled.
7056 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
7058 +ifneq ($(strip $(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF)),y)
7059 + # Remove printf header since custom print specifier support is disabled.
7060 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
7062 +ifneq ($(strip $(UCLIBC_HAS_XLOCALE)),y)
7063 + # Remove xlocale header since extended locale support is disabled.
7064 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
7066 +ifneq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
7067 + # Remove libintl header since gettext support is disabled.
7068 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
7070 +ifneq ($(strip $(UCLIBC_HAS_REGEX)),y)
7071 + # Remove regex headers since regex support is disabled.
7072 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
7073 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
7075 +ifneq ($(strip $(UCLIBC_HAS_WORDEXP)),y)
7076 + # Remove wordexp header since wordexp support is disabled.
7077 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
7079 +ifneq ($(strip $(UCLIBC_HAS_FTW)),y)
7080 + # Remove ftw header since ftw support is disabled.
7081 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
7083 +ifneq ($(strip $(UCLIBC_HAS_GLOB)),y)
7084 + # Remove glob header since glob support is disabled.
7085 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
7087 +ifneq ($(strip $(UCLIBC_HAS_GNU_GETOPT)),y)
7088 + # Remove getopt header since gnu getopt support is disabled.
7089 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
7091 +ifneq ($(strip $(HAS_SHADOW)),y)
7092 + # Remove getopt header since shadow password support is disabled.
7093 + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
7095 + -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
7096 + chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \
7098 + -find $(PREFIX)$(DEVEL_PREFIX) -name .svn | xargs $(RM) -r;
7099 + -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1:\2/'` $(PREFIX)$(DEVEL_PREFIX)
7100 +ifeq ($(strip $(HAVE_SHARED)),y)
7101 + for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
7102 + sed -e 's/lib\///'` ; do \
7103 + $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
7104 + $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
7106 +ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
7107 + $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
7108 + $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
7110 +# # If we build shared libraries then the static libs are PIC...
7111 +# # Make _pic.a symlinks to make mklibs.py and similar tools happy.
7112 + for i in `find lib/ -type f -name '*.a' | sed -e 's/lib\///'` ; do \
7113 + $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
7114 + | sed -e 's/\.a$$/_pic.a/'`; \
7116 + # Ugh!!! Remember that libdl.a and libdl_pic.a are different. Since
7117 + # libdl is pretty small, and not likely to benefit from mklibs.py and
7118 + # similar, lets just remove libdl_pic.a and avoid the issue
7119 + rm -f $(PREFIX)$(DEVEL_PREFIX)lib/libdl_pic.a
7123 +# Installs run-time libraries
7125 +ifeq ($(strip $(HAVE_SHARED)),y)
7126 + $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
7127 + $(INSTALL) -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
7128 + $(PREFIX)$(RUNTIME_PREFIX)lib
7129 + cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
7130 + @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
7133 + $(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
7134 + $(PREFIX)$(RUNTIME_PREFIX)lib; \
7139 +ifeq ($(strip $(HAVE_SHARED)),y)
7141 + $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
7146 +# Installs helper applications, such as 'ldd' and 'ldconfig'
7147 +install_utils: utils
7148 + $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils install
7149 +#ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)
7150 +# @$(MAKE) -C libc/misc/wchar iconv.target
7151 +# $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)/usr/bin;
7152 +# $(INSTALL) -m 755 libc/misc/wchar/iconv.target $(PREFIX)$(RUNTIME_PREFIX)/usr/bin/iconv
7157 + $(SECHO) Finished installing ...
7160 +else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
7165 +# ---------------------------------------------------------------------------
7167 + $(MAKE) -C extra/config conf
7169 +extra/config/mconf:
7170 + $(MAKE) -C extra/config ncurses mconf
7172 +menuconfig: extra/config/mconf
7173 + $(RM) -r include/bits
7174 + $(INSTALL) -d include/bits
7175 + @./extra/config/mconf extra/Configs/Config.in
7177 +config: extra/config/conf
7178 + $(RM) -r include/bits
7179 + $(INSTALL) -d include/bits
7180 + @./extra/config/conf extra/Configs/Config.in
7182 +oldconfig: extra/config/conf
7183 + $(RM) -r include/bits
7184 + $(INSTALL) -d include/bits
7185 + @./extra/config/conf -o extra/Configs/Config.in
7187 +randconfig: extra/config/conf
7188 + $(RM) -r include/bits
7189 + $(INSTALL) -d include/bits
7190 + @./extra/config/conf -r extra/Configs/Config.in
7192 +allyesconfig: extra/config/conf
7193 + $(RM) -r include/bits
7194 + $(INSTALL) -d include/bits
7195 + @./extra/config/conf -y extra/Configs/Config.in
7196 + sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
7197 + sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
7198 + sed -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
7199 + sed -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
7200 + sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
7201 + @./extra/config/conf -o extra/Configs/Config.in
7203 +allnoconfig: extra/config/conf
7204 + $(RM) -r include/bits
7205 + $(INSTALL) -d include/bits
7206 + @./extra/config/conf -n extra/Configs/Config.in
7208 +defconfig: extra/config/conf
7209 + $(RM) -r include/bits
7210 + $(INSTALL) -d include/bits
7211 + @./extra/config/conf -d extra/Configs/Config.in
7214 + - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core -o -name .\#\* \) -exec $(RM) {} \;
7215 + @$(RM) -r tmp lib include/bits libc/tmp _install
7216 + $(RM) libc/obj.* headers
7217 + $(MAKE) -C test clean
7218 + $(MAKE) -C ldso clean
7219 + $(MAKE) -C libc/misc/internals clean
7220 + $(MAKE) -C libc/misc/wchar clean
7221 + $(MAKE) -C libc/unistd clean
7222 + $(MAKE) -C libc/sysdeps/linux/common clean
7223 + $(MAKE) -C extra/locale clean
7224 + $(MAKE) -C utils clean
7226 + for i in `(cd $(TOPDIR)/libc/sysdeps/linux/common/sys; ls *.h)` ; do \
7227 + $(RM) include/sys/$$i; \
7229 + if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
7230 + for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
7231 + $(RM) include/sys/$$i; \
7234 + @$(RM) include/linux include/asm*
7235 + @if [ -d libc/sysdeps/linux/$(TARGET_ARCH) ]; then \
7236 + $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean; \
7240 + $(RM) .config .config.old .config.cmd
7241 + $(MAKE) -C extra clean
7244 + $(RM) -r ../uClibc-$(VERSION) ../uClibc-$(VERSION).tar.bz2
7245 + svn -q export . ../uClibc-$(VERSION)
7246 + tar cjf ../uClibc-$(VERSION).tar.bz2 -C .. uClibc-$(VERSION)
7247 + du -b ../uClibc-$(VERSION).tar.bz2
7249 +endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
7254 +.PHONY: dummy subdirs release distclean clean config oldconfig menuconfig
7255 diff -Nrup a/Rules.mak b/Rules.mak
7256 --- a/Rules.mak 2007-02-28 16:12:06.000000000 -0500
7257 +++ b/Rules.mak 2008-02-28 19:02:10.000000000 -0500
7258 @@ -234,6 +234,12 @@ ifeq ($(strip $(TARGET_ARCH)),frv)
7262 +ifeq ($(strip $(TARGET_ARCH)),avr32)
7263 + CPU_CFLAGS-$(CONFIG_AP7000) += -mcpu=ap7000
7264 + CPU_CFLAGS-$(LINKRELAX) += -masm-addr-pseudos -Wa,--pic,--linkrelax
7265 + CPU_LDFLAGS-$(LINKRELAX) += --relax
7268 # Keep the check_gcc from being needlessly executed
7270 ifneq ($(UCLIBC_BUILD_PIE),y)
7271 diff -Nrup a/Rules.mak.orig b/Rules.mak.orig
7272 --- a/Rules.mak.orig 1969-12-31 19:00:00.000000000 -0500
7273 +++ b/Rules.mak.orig 2008-02-28 19:02:10.000000000 -0500
7275 +# Rules.make for uClibc
7277 +# Copyright (C) 2000 by Lineo, inc.
7278 +# Copyright (C) 2000-2002 Erik Andersen <andersen@uclibc.org>
7280 +# This program is free software; you can redistribute it and/or modify it under
7281 +# the terms of the GNU Library General Public License as published by the Free
7282 +# Software Foundation; either version 2 of the License, or (at your option) any
7285 +# This program is distributed in the hope that it will be useful, but WITHOUT
7286 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
7287 +# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
7290 +# You should have received a copy of the GNU Library General Public License
7291 +# along with this program; if not, write to the Free Software Foundation, Inc.,
7292 +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7295 +#-----------------------------------------------------------
7296 +# This file contains rules which are shared between multiple
7297 +# Makefiles. All normal configuration options live in the
7298 +# file named ".config". Don't mess with this file unless
7299 +# you know what you are doing.
7302 +#-----------------------------------------------------------
7303 +# If you are running a cross compiler, you will want to set
7304 +# 'CROSS' to something more interesting ... Target
7305 +# architecture is determined by asking the CC compiler what
7306 +# arch it compiles things for, so unless your compiler is
7307 +# broken, you should not need to specify TARGET_ARCH.
7309 +# Most people will set this stuff on the command line, i.e.
7310 +# make CROSS=arm-linux-
7311 +# will build uClibc for 'arm'.
7320 +RANLIB = $(CROSS)ranlib
7321 +STRIPTOOL = $(CROSS)strip
7327 +# Select the compiler needed to build binaries for your development system
7329 +HOSTCFLAGS = -O2 -Wall
7332 +#---------------------------------------------------------
7333 +# Nothing beyond this point should ever be touched by mere
7334 +# mortals. Unless you hang out with the gods, you should
7335 +# probably leave all this stuff alone.
7340 +VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).$(EXTRAVERSION)
7341 +# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
7343 +export MAJOR_VERSION MINOR_VERSION SUBLEVEL VERSION LC_ALL
7345 +SHARED_FULLNAME:=libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
7346 +SHARED_MAJORNAME:=libc.so.$(MAJOR_VERSION)
7347 +UCLIBC_LDSO:=ld-uClibc.so.$(MAJOR_VERSION)
7349 +LIBC:=$(TOPDIR)libc/$(LIBNAME)
7351 +# Make sure DESTDIR and PREFIX can be used to install
7352 +# PREFIX is a uClibcism while DESTDIR is a common GNUism
7354 +PREFIX = $(DESTDIR)
7357 +# Pull in the user's uClibc configuration
7358 +ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
7359 +-include $(TOPDIR).config
7363 +CROSS=$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
7366 +# A nifty macro to make testing gcc features easier
7367 +check_gcc=$(shell \
7368 + if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
7369 + then echo "$(1)"; else echo "$(2)"; fi)
7371 + if $(CC) -Wa,$(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; \
7372 + then echo "-Wa,$(1)"; fi)
7374 +# Setup some shortcuts so that silent mode is silent like it should be
7375 +ifeq ($(subst s,,$(MAKEFLAGS)),$(MAKEFLAGS))
7376 +export MAKE_IS_SILENT=n
7380 +export MAKE_IS_SILENT=y
7385 +# Make certain these contain a final "/", but no "//"s.
7386 +TARGET_ARCH:=$(shell grep -s ^TARGET_ARCH $(TOPDIR)/.config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
7387 +RUNTIME_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(subst ",, $(strip $(RUNTIME_PREFIX))))))
7388 +DEVEL_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(subst ",, $(strip $(DEVEL_PREFIX))))))
7389 +export RUNTIME_PREFIX DEVEL_PREFIX
7395 +PIEFLAG_NAME:=-fPIE
7397 +# Some nice CPU specific optimizations
7398 +ifeq ($(strip $(TARGET_ARCH)),i386)
7399 + OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,)
7400 + OPTIMIZATION+=$(call check_gcc,-falign-jumps=0 -falign-loops=0,-malign-jumps=0 -malign-loops=0)
7401 + CPU_CFLAGS-$(CONFIG_386)+=-march=i386
7402 + CPU_CFLAGS-$(CONFIG_486)+=-march=i486
7403 + CPU_CFLAGS-$(CONFIG_ELAN)+=-march=i486
7404 + CPU_CFLAGS-$(CONFIG_586)+=-march=i586
7405 + CPU_CFLAGS-$(CONFIG_586MMX)+=$(call check_gcc,-march=pentium-mmx,-march=i586)
7406 + CPU_CFLAGS-$(CONFIG_686)+=-march=i686
7407 + CPU_CFLAGS-$(CONFIG_PENTIUMII)+=$(call check_gcc,-march=pentium2,-march=i686)
7408 + CPU_CFLAGS-$(CONFIG_PENTIUMIII)+=$(call check_gcc,-march=pentium3,-march=i686)
7409 + CPU_CFLAGS-$(CONFIG_PENTIUM4)+=$(call check_gcc,-march=pentium4,-march=i686)
7410 + CPU_CFLAGS-$(CONFIG_K6)+=$(call check_gcc,-march=k6,-march=i586)
7411 + CPU_CFLAGS-$(CONFIG_K7)+=$(call check_gcc,-march=athlon,-malign-functions=4 -march=i686)
7412 + CPU_CFLAGS-$(CONFIG_CRUSOE)+=-march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
7413 + CPU_CFLAGS-$(CONFIG_WINCHIPC6)+=$(call check_gcc,-march=winchip-c6,-march=i586)
7414 + CPU_CFLAGS-$(CONFIG_WINCHIP2)+=$(call check_gcc,-march=winchip2,-march=i586)
7415 + CPU_CFLAGS-$(CONFIG_CYRIXIII)+=$(call check_gcc,-march=c3,-march=i486) -malign-functions=0 -malign-jumps=0 -malign-loops=0
7416 + CPU_CFLAGS-$(CONFIG_NEHEMIAH)+=$(call check_gcc,-march=c3-2,-march=i686)
7419 +ifeq ($(strip $(TARGET_ARCH)),arm)
7420 + OPTIMIZATION+=-fstrict-aliasing
7421 + CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN)+=-EL
7422 + CPU_LDFLAGS-$(ARCH_BIG_ENDIAN)+=-EB
7423 + CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-mlittle-endian
7424 + CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mbig-endian
7425 + CPU_CFLAGS-$(CONFIG_GENERIC_ARM)+=
7426 + CPU_CFLAGS-$(CONFIG_ARM610)+=-mtune=arm610 -march=armv3
7427 + CPU_CFLAGS-$(CONFIG_ARM710)+=-mtune=arm710 -march=armv3
7428 + CPU_CFLAGS-$(CONFIG_ARM720T)+=-mtune=arm7tdmi -march=armv4
7429 + CPU_CFLAGS-$(CONFIG_ARM920T)+=-mtune=arm9tdmi -march=armv4
7430 + CPU_CFLAGS-$(CONFIG_ARM922T)+=-mtune=arm9tdmi -march=armv4
7431 + CPU_CFLAGS-$(CONFIG_ARM926T)+=-mtune=arm9tdmi -march=armv5
7432 + CPU_CFLAGS-$(CONFIG_ARM1136JF_S)+=-mtune=arm1136jf-s -march=armv6
7433 + CPU_CFLAGS-$(CONFIG_ARM_SA110)+=-mtune=strongarm110 -march=armv4
7434 + CPU_CFLAGS-$(CONFIG_ARM_SA1100)+=-mtune=strongarm1100 -march=armv4
7435 + CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=$(call check_gcc,-mtune=xscale,-mtune=strongarm110)
7436 + CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=-march=armv4 -Wa,-mcpu=xscale
7439 +ifeq ($(strip $(TARGET_ARCH)),mips)
7440 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_1)+=-mips1
7441 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_2)+=-mips2 -mtune=mips2
7442 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_3)+=-mips3 -mtune=mips3
7443 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_4)+=-mips4 -mtune=mips4
7444 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32
7445 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32
7448 +ifeq ($(strip $(TARGET_ARCH)),sh)
7449 + OPTIMIZATION+=-fstrict-aliasing
7450 + OPTIMIZATION+= $(call check_gcc,-mprefergot,)
7451 + CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN)+=-EL
7452 + CPU_LDFLAGS-$(ARCH_BIG_ENDIAN)+=-EB
7453 + CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-ml
7454 + CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mb
7455 + CPU_CFLAGS-$(CONFIG_SH2)+=-m2
7456 + CPU_CFLAGS-$(CONFIG_SH3)+=-m3
7457 +ifeq ($(strip $(UCLIBC_HAS_FLOATS)),y)
7458 + CPU_CFLAGS-$(CONFIG_SH2A)+=-m2a
7459 + CPU_CFLAGS-$(CONFIG_SH4)+=-m4
7461 + CPU_CFLAGS-$(CONFIG_SH2A)+=-m2a-nofpu
7462 + CPU_CFLAGS-$(CONFIG_SH4)+=-m4-nofpu
7466 +ifeq ($(strip $(TARGET_ARCH)),sh64)
7467 + OPTIMIZATION+=-fstrict-aliasing
7468 + CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN):=-EL
7469 + CPU_LDFLAGS-$(ARCH_BIG_ENDIAN):=-EB
7470 + CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN):=-ml
7471 + CPU_CFLAGS-$(ARCH_BIG_ENDIAN):=-mb
7472 + CPU_CFLAGS-$(CONFIG_SH5)+=-m5-32media
7475 +ifeq ($(strip $(TARGET_ARCH)),h8300)
7476 + CPU_LDFLAGS-$(CONFIG_H8300H)+= -ms8300h
7477 + CPU_LDFLAGS-$(CONFIG_H8S) += -ms8300s
7478 + CPU_CFLAGS-$(CONFIG_H8300H) += -mh -mint32 -fsigned-char
7479 + CPU_CFLAGS-$(CONFIG_H8S) += -ms -mint32 -fsigned-char
7482 +ifeq ($(strip $(TARGET_ARCH)),cris)
7483 + CPU_LDFLAGS-$(CONFIG_CRIS)+=-mcrislinux
7484 + CPU_CFLAGS-$(CONFIG_CRIS)+=-mlinux
7486 + PIEFLAG_NAME:=-fpie
7489 +ifeq ($(strip $(TARGET_ARCH)),powerpc)
7490 +# PowerPC can hold 8192 entries in its GOT with -fpic which is more than
7491 +# enough. Therefore use -fpic which will reduce code size and generates
7494 + PIEFLAG_NAME:=-fpie
7495 + PPC_HAS_REL16:=$(shell echo -e "\t.text\n\taddis 11,30,_GLOBAL_OFFSET_TABLE_-.@ha" | $(CC) -c -x assembler -o /dev/null - 2> /dev/null && echo -n y || echo -n n)
7496 + CPU_CFLAGS-$(PPC_HAS_REL16)+= -DHAVE_ASM_PPC_REL16
7499 +ifeq ($(strip $(TARGET_ARCH)),frv)
7500 + CPU_LDFLAGS-$(CONFIG_FRV)+=-melf32frvfd
7501 + CPU_CFLAGS-$(CONFIG_FRV)+=-mfdpic
7502 + # Using -pie causes the program to have an interpreter, which is
7503 + # forbidden, so we must make do with -shared. Unfortunately,
7504 + # -shared by itself would get us global function descriptors
7505 + # and calls through PLTs, dynamic resolution of symbols, etc,
7506 + # which would break as well, but -Bsymbolic comes to the rescue.
7507 + export LDPIEFLAG:=-shared -Bsymbolic
7508 + UCLIBC_LDSO=ld.so.1
7511 +ifeq ($(strip $(TARGET_ARCH)),avr32)
7512 + CPU_CFLAGS-$(CONFIG_AP7000) += -mcpu=ap7000
7515 +# Keep the check_gcc from being needlessly executed
7517 +ifneq ($(UCLIBC_BUILD_PIE),y)
7520 +export PIEFLAG:=$(call check_gcc,$(PIEFLAG_NAME),$(PICFLAG))
7523 +# We need to keep track of both the CC PIE flag (above) as
7524 +# well as the LD PIE flag (below) because we can't rely on
7525 +# gcc passing -pie if we used -fPIE
7527 +ifneq ($(UCLIBC_BUILD_PIE),y)
7530 +export LDPIEFLAG:=$(shell $(LD) --help | grep -q pie && echo "-Wl,-pie")
7534 +# Use '-Os' optimization if available, else use -O2, allow Config to override
7535 +OPTIMIZATION+=$(call check_gcc,-Os,-O2)
7536 +# Use the gcc 3.4 -funit-at-a-time optimization when available
7537 +OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
7539 +# Add a bunch of extra pedantic annoyingly strict checks
7540 +XWARNINGS=$(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
7541 +XARCH_CFLAGS=$(subst ",, $(strip $(ARCH_CFLAGS)))
7542 +CPU_CFLAGS=$(subst ",, $(strip $(CPU_CFLAGS-y)))
7545 +ifeq ($(strip $(UCLIBC_HAS_SOFT_FLOAT)),y)
7546 +# Add -msoft-float to the CPU_FLAGS since ldso and libdl ignore CFLAGS.
7547 +# If -msoft-float isn't supported, we want an error anyway.
7548 +# Hmm... might need to revisit this for arm since it has 2 different
7549 +# soft float encodings.
7550 + CPU_CFLAGS += -msoft-float
7551 +ifeq ($(strip $(TARGET_ARCH)),arm)
7552 +# No longer needed with current toolchains, but leave it here for now.
7553 +# If anyone is actually still using gcc 2.95 (say), they can uncomment it.
7554 +# LDADD_LIBFLOAT=-lfloat
7558 +SSP_DISABLE_FLAGS:=$(call check_gcc,-fno-stack-protector,)
7559 +ifeq ($(UCLIBC_BUILD_SSP),y)
7560 +SSP_CFLAGS:=$(call check_gcc,-fno-stack-protector-all,)
7561 +SSP_CFLAGS+=$(call check_gcc,-fstack-protector,)
7562 +SSP_ALL_CFLAGS:=$(call check_gcc,-fstack-protector-all,)
7564 +SSP_CFLAGS:=$(SSP_DISABLE_FLAGS)
7567 +# Some nice CFLAGS to work with
7568 +CFLAGS:=$(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) \
7569 + -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)include -I.
7570 +LDFLAGS_NOSTRIP:=$(CPU_LDFLAGS-y) -shared --warn-common --warn-once -z combreloc -z defs
7572 +ifeq ($(DODEBUG),y)
7575 + LDFLAGS := $(LDFLAGS_NOSTRIP)
7576 + STRIPTOOL:= true -Since_we_are_debugging
7578 + CFLAGS += $(OPTIMIZATION) $(XARCH_CFLAGS)
7579 + LDFLAGS := $(LDFLAGS_NOSTRIP) -s
7582 +ifeq ($(UCLIBC_BUILD_RELRO),y)
7586 +ifeq ($(UCLIBC_BUILD_NOW),y)
7590 +# Sigh, some stupid versions of gcc can't seem to cope with '-iwithprefix include'
7591 +#CFLAGS+=-iwithprefix include
7592 +CFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
7594 +ifneq ($(DOASSERTS),y)
7595 + CFLAGS += -DNDEBUG
7598 +CFLAGS_NOPIC:=$(CFLAGS)
7600 + CFLAGS += $(PICFLAG)
7603 +ifeq ($(DL_FINI_CRT_COMPAT),y)
7604 +CFLAGS += -D_DL_FINI_CRT_COMPAT
7607 +# Keep the check_as from being needlessly executed
7608 +ASFLAGS = $(CFLAGS)
7609 +ifndef ASFLAGS_NOEXEC
7610 +ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
7611 +export ASFLAGS_NOEXEC := $(call check_as,--noexecstack)
7613 +export ASFLAGS_NOEXEC :=
7616 +ASFLAGS += $(ASFLAGS_NOEXEC)
7618 +LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y)
7619 +LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)
7620 +LIBGCC_DIR:=$(dir $(LIBGCC))
7622 +########################################
7624 +# uClinux shared lib support
7627 +ifeq ($(CONFIG_BINFMT_SHARED_FLAT),y)
7628 + # For the shared version of this, we specify no stack and its library ID
7631 + export LIBID FLTFLAGS
7632 + SHARED_TARGET = lib/libc
7635 +TARGET_ARCH:=$(strip $(subst ",, $(strip $(TARGET_ARCH))))
7636 diff -Nrup a/utils/ldd.c b/utils/ldd.c
7637 --- a/utils/ldd.c 2004-10-06 03:34:17.000000000 -0400
7638 +++ b/utils/ldd.c 2008-02-28 19:02:10.000000000 -0500
7640 #define ELFCLASSM ELFCLASS32
7643 +#if defined(__avr32__)
7644 +#define MATCH_MACHINE(x) (x == EM_AVR32)
7645 +#define ELFCLASSM ELFCLASS32
7648 #if defined(__s390__)
7649 #define MATCH_MACHINE(x) (x == EM_S390)
7650 #define ELFCLASSM ELFCLASS32