From b1e37cc9ebd572c536fdb24919a7690c0034eef4 Mon Sep 17 00:00:00 2001 From: Frans Meulenbroeks Date: Tue, 6 Jul 2010 21:31:20 +0200 Subject: glibc 2.5: added support for nios2 added support for nios2. These are changes lifted from the windriver toolchain see http://www.nioswiki.com/Build_the_gcc4_toolchain. As there are no changes for non nios2 systems no PR bump is needed. patches are only applied in case machine is nios2. Signed-off-by: Frans Meulenbroeks --- recipes/glibc/glibc-2.5/nios2-elf.patch | 87 + recipes/glibc/glibc-2.5/nios2-iconv.patch | 85 + recipes/glibc/glibc-2.5/nios2-ld-collate.patch | 308 ++ recipes/glibc/glibc-2.5/sysdeps-nios2.patch | 4028 ++++++++++++++++++++++++ recipes/glibc/glibc_2.5.bb | 9 + 5 files changed, 4517 insertions(+) create mode 100644 recipes/glibc/glibc-2.5/nios2-elf.patch create mode 100644 recipes/glibc/glibc-2.5/nios2-iconv.patch create mode 100644 recipes/glibc/glibc-2.5/nios2-ld-collate.patch create mode 100644 recipes/glibc/glibc-2.5/sysdeps-nios2.patch diff --git a/recipes/glibc/glibc-2.5/nios2-elf.patch b/recipes/glibc/glibc-2.5/nios2-elf.patch new file mode 100644 index 0000000000..240bbeca8a --- /dev/null +++ b/recipes/glibc/glibc-2.5/nios2-elf.patch @@ -0,0 +1,87 @@ +*** glibc-2.5/elf/elf.h 2010-05-31 16:05:58.000000000 +0200 +--- glibc-2.5-/elf/elf.h 2008-12-19 00:35:12.000000000 +0100 +*************** +*** 250,255 **** +--- 250,257 ---- + #define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ + #define EM_NUM 95 + ++ #define EM_ALTERA_NIOS2 113 /* Altera Nios II */ ++ + /* If it is necessary to assign new unofficial EM_* values, please + pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the + chances of collision with official or non-GNU unofficial values. */ +*************** +*** 1511,1518 **** + #define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ + #define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ + #define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ + /* Keep this the last entry. */ +! #define R_MIPS_NUM 51 + + /* Legal values for p_type field of Elf32_Phdr. */ + +--- 1513,1521 ---- + #define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ + #define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ + #define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ ++ #define R_MIPS_GLOB_DAT 51 + /* Keep this the last entry. */ +! #define R_MIPS_NUM 52 + + /* Legal values for p_type field of Elf32_Phdr. */ + +*************** +*** 2602,2607 **** +--- 2605,2655 ---- + #define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */ + #define R_M32R_NUM 256 /* Keep this the last entry. */ + ++ /* Legal values for d_tag (dynamic entry type). */ ++ #define DT_NIOS2_GP 0x70000002 /* Address of _gp. */ ++ ++ /* Nios II relocs. */ ++ #define R_NIOS2_NONE 0 /* No reloc. */ ++ #define R_NIOS2_S16 1 /* Direct signed 16 bit. */ ++ #define R_NIOS2_U16 2 /* Direct unsigned 16 bit. */ ++ #define R_NIOS2_PCREL16 3 /* PC relative 16 bit. */ ++ #define R_NIOS2_CALL26 4 ++ #define R_NIOS2_IMM5 5 ++ #define R_NIOS2_CACHE_OPX 6 ++ #define R_NIOS2_IMM6 7 ++ #define R_NIOS2_IMM8 8 ++ #define R_NIOS2_HI16 9 ++ #define R_NIOS2_LO16 10 ++ #define R_NIOS2_HIADJ16 11 ++ #define R_NIOS2_BFD_RELOC_32 12 ++ #define R_NIOS2_BFD_RELOC_16 13 ++ #define R_NIOS2_BFD_RELOC_8 14 ++ #define R_NIOS2_GPREL 15 ++ #define R_NIOS2_GNU_VTINHERIT 16 ++ #define R_NIOS2_GNU_VTENTRY 17 ++ #define R_NIOS2_UJMP 18 ++ #define R_NIOS2_CJMP 19 ++ #define R_NIOS2_CALLR 20 ++ #define R_NIOS2_ALIGN 21 ++ #define R_NIOS2_GOT16 22 ++ #define R_NIOS2_CALL16 23 ++ #define R_NIOS2_GOTOFF_LO 24 ++ #define R_NIOS2_GOTOFF_HA 25 ++ #define R_NIOS2_PCREL_LO 26 ++ #define R_NIOS2_PCREL_HA 27 ++ #define R_NIOS2_TLS_GD16 28 ++ #define R_NIOS2_TLS_LDM16 29 ++ #define R_NIOS2_TLS_LDO16 30 ++ #define R_NIOS2_TLS_IE16 31 ++ #define R_NIOS2_TLS_LE16 32 ++ #define R_NIOS2_TLS_DTPMOD 33 ++ #define R_NIOS2_TLS_DTPREL 34 ++ #define R_NIOS2_TLS_TPREL 35 ++ #define R_NIOS2_COPY 36 ++ #define R_NIOS2_GLOB_DAT 37 ++ #define R_NIOS2_JUMP_SLOT 38 ++ #define R_NIOS2_RELATIVE 39 ++ #define R_NIOS2_GOTOFF 40 + + __END_DECLS + diff --git a/recipes/glibc/glibc-2.5/nios2-iconv.patch b/recipes/glibc/glibc-2.5/nios2-iconv.patch new file mode 100644 index 0000000000..7aa574816f --- /dev/null +++ b/recipes/glibc/glibc-2.5/nios2-iconv.patch @@ -0,0 +1,85 @@ +*** glibc-2.5/iconv/iconvconfig.c 2006-09-21 05:57:30.000000000 +0200 +--- /home/frans/workspace/nios2/wrs-linux-4.1-176-nios2-wrs-linux-gnu/glibc-2.5/iconv/iconvconfig.c 2008-11-18 18:43:02.000000000 +0100 +*************** +*** 1011,1016 **** +--- 1011,1045 ---- + module name offset + (following last entry with step count 0) + */ ++ ++ struct hash_entry *hash_table; ++ size_t hash_size; ++ ++ /* Function to insert the names. */ ++ static void ++ name_insert (const void *nodep, VISIT value, int level) ++ { ++ struct name *name; ++ unsigned int idx; ++ unsigned int hval2; ++ ++ if (value != leaf && value != postorder) ++ return; ++ ++ name = *(struct name **) nodep; ++ idx = name->hashval % hash_size; ++ hval2 = 1 + name->hashval % (hash_size - 2); ++ ++ while (hash_table[idx].string_offset != 0) ++ if ((idx += hval2) >= hash_size) ++ idx -= hash_size; ++ ++ hash_table[idx].string_offset = strtaboffset (name->strent); ++ ++ assert (name->module_idx != -1); ++ hash_table[idx].module_idx = name->module_idx; ++ } ++ + static int + write_output (void) + { +*************** +*** 1018,1025 **** + char *string_table; + size_t string_table_size; + struct gconvcache_header header; +- struct hash_entry *hash_table; +- size_t hash_size; + struct module_entry *module_table; + char *extra_table; + char *cur_extra_table; +--- 1047,1052 ---- +*************** +*** 1032,1062 **** + char tmpfname[(output_file == NULL ? sizeof finalname : output_file_len + 1) + + strlen (".XXXXXX")]; + +- /* Function to insert the names. */ +- auto void +- name_insert (const void *nodep, VISIT value, int level) +- { +- struct name *name; +- unsigned int idx; +- unsigned int hval2; +- +- if (value != leaf && value != postorder) +- return; +- +- name = *(struct name **) nodep; +- idx = name->hashval % hash_size; +- hval2 = 1 + name->hashval % (hash_size - 2); +- +- while (hash_table[idx].string_offset != 0) +- if ((idx += hval2) >= hash_size) +- idx -= hash_size; +- +- hash_table[idx].string_offset = strtaboffset (name->strent); +- +- assert (name->module_idx != -1); +- hash_table[idx].module_idx = name->module_idx; +- } +- + /* Open the output file. */ + if (output_file == NULL) + { +--- 1059,1064 ---- diff --git a/recipes/glibc/glibc-2.5/nios2-ld-collate.patch b/recipes/glibc/glibc-2.5/nios2-ld-collate.patch new file mode 100644 index 0000000000..abdc7d9667 --- /dev/null +++ b/recipes/glibc/glibc-2.5/nios2-ld-collate.patch @@ -0,0 +1,308 @@ +*** glibc-2.5/./locale/programs/ld-collate.c- 2006-09-21 05:57:30.000000000 +0200 +--- glibc-2.5/./locale/programs/ld-collate.c 2010-06-01 10:00:50.000000000 +0200 +*************** +*** 1934,1945 **** + return retval | ((elem->section->ruleidx & 0x7f) << 24); + } + + + void + collate_output (struct localedef_t *locale, const struct charmap_t *charmap, + const char *output_path) + { +- struct locale_collate_t *collate = locale->categories[LC_COLLATE].collate; + const size_t nelems = _NL_ITEM_INDEX (_NL_NUM_LC_COLLATE); + struct iovec iov[2 + nelems]; + struct locale_file data; +--- 1934,2066 ---- + return retval | ((elem->section->ruleidx & 0x7f) << 24); + } + ++ /* If localedef is every threaded, these would need to be __thread var. */ ++ struct obstack weightpool; ++ struct obstack extrapool; ++ struct obstack indirectpool; ++ struct collidx_table tablewc; ++ struct locale_collate_t *collate; ++ ++ static void ++ add_to_tablewc (uint32_t ch, struct element_t *runp) ++ { ++ if (runp->wcnext == NULL && runp->nwcs == 1) ++ { ++ int32_t weigthidx = output_weightwc (&weightpool, collate, runp); ++ collidx_table_add (&tablewc, ch, weigthidx); ++ } ++ else ++ { ++ /* As for the singlebyte table, we recognize sequences and ++ compress them. */ ++ struct element_t *lastp; ++ ++ collidx_table_add (&tablewc, ch, ++ -(obstack_object_size (&extrapool) / sizeof (uint32_t))); ++ ++ do ++ { ++ /* Store the current index in the weight table. We know that ++ the current position in the `extrapool' is aligned on a ++ 32-bit address. */ ++ int32_t weightidx; ++ int added; ++ ++ /* Find out wether this is a single entry or we have more than ++ one consecutive entry. */ ++ if (runp->wcnext != NULL ++ && runp->nwcs == runp->wcnext->nwcs ++ && wmemcmp ((wchar_t *) runp->wcs, ++ (wchar_t *)runp->wcnext->wcs, ++ runp->nwcs - 1) == 0 ++ && (runp->wcs[runp->nwcs - 1] ++ == runp->wcnext->wcs[runp->nwcs - 1] + 1)) ++ { ++ int i; ++ struct element_t *series_startp = runp; ++ struct element_t *curp; ++ ++ /* Now add first the initial byte sequence. */ ++ added = (1 + 1 + 2 * (runp->nwcs - 1)) * sizeof (int32_t); ++ if (sizeof (int32_t) == sizeof (int)) ++ obstack_make_room (&extrapool, added); ++ ++ /* More than one consecutive entry. We mark this by having ++ a negative index into the indirect table. */ ++ obstack_int32_grow_fast (&extrapool, ++ -(obstack_object_size (&indirectpool) ++ / sizeof (int32_t))); ++ obstack_int32_grow_fast (&extrapool, runp->nwcs - 1); ++ ++ do ++ runp = runp->wcnext; ++ while (runp->wcnext != NULL ++ && runp->nwcs == runp->wcnext->nwcs ++ && wmemcmp ((wchar_t *) runp->wcs, ++ (wchar_t *)runp->wcnext->wcs, ++ runp->nwcs - 1) == 0 ++ && (runp->wcs[runp->nwcs - 1] ++ == runp->wcnext->wcs[runp->nwcs - 1] + 1)); ++ ++ /* Now walk backward from here to the beginning. */ ++ curp = runp; ++ ++ for (i = 1; i < runp->nwcs; ++i) ++ obstack_int32_grow_fast (&extrapool, curp->wcs[i]); ++ ++ /* Now find the end of the consecutive sequence and ++ add all the indeces in the indirect pool. */ ++ do ++ { ++ weightidx = output_weightwc (&weightpool, collate, ++ curp); ++ obstack_int32_grow (&indirectpool, weightidx); ++ ++ curp = curp->wclast; ++ } ++ while (curp != series_startp); ++ ++ /* Add the final weight. */ ++ weightidx = output_weightwc (&weightpool, collate, curp); ++ obstack_int32_grow (&indirectpool, weightidx); ++ ++ /* And add the end byte sequence. Without length this ++ time. */ ++ for (i = 1; i < curp->nwcs; ++i) ++ obstack_int32_grow (&extrapool, curp->wcs[i]); ++ } ++ else ++ { ++ /* A single entry. Simply add the index and the length and ++ string (except for the first character which is already ++ tested for). */ ++ int i; ++ ++ /* Output the weight info. */ ++ weightidx = output_weightwc (&weightpool, collate, runp); ++ ++ added = (1 + 1 + runp->nwcs - 1) * sizeof (int32_t); ++ if (sizeof (int) == sizeof (int32_t)) ++ obstack_make_room (&extrapool, added); ++ ++ obstack_int32_grow_fast (&extrapool, weightidx); ++ obstack_int32_grow_fast (&extrapool, runp->nwcs - 1); ++ for (i = 1; i < runp->nwcs; ++i) ++ obstack_int32_grow_fast (&extrapool, runp->wcs[i]); ++ } ++ ++ /* Next entry. */ ++ lastp = runp; ++ runp = runp->wcnext; ++ } ++ while (runp != NULL); ++ } ++ } + + void + collate_output (struct localedef_t *locale, const struct charmap_t *charmap, + const char *output_path) + { + const size_t nelems = _NL_ITEM_INDEX (_NL_NUM_LC_COLLATE); + struct iovec iov[2 + nelems]; + struct locale_file data; +*************** +*** 1947,1962 **** + size_t cnt; + size_t ch; + int32_t tablemb[256]; +- struct obstack weightpool; +- struct obstack extrapool; +- struct obstack indirectpool; + struct section_list *sect; +- struct collidx_table tablewc; + uint32_t elem_size; + uint32_t *elem_table; + int i; + struct element_t *runp; + + data.magic = LIMAGIC (LC_COLLATE); + data.n = nelems; + iov[0].iov_base = (void *) &data; +--- 2068,2080 ---- + size_t cnt; + size_t ch; + int32_t tablemb[256]; + struct section_list *sect; + uint32_t elem_size; + uint32_t *elem_table; + int i; + struct element_t *runp; + ++ collate = locale->categories[LC_COLLATE].collate; + data.magic = LIMAGIC (LC_COLLATE); + data.n = nelems; + iov[0].iov_base = (void *) &data; +*************** +*** 2292,2414 **** + the table. In case we have more than one sequence starting with + the same byte we have to use extra indirection. */ + { +- auto void add_to_tablewc (uint32_t ch, struct element_t *runp); +- +- void add_to_tablewc (uint32_t ch, struct element_t *runp) +- { +- if (runp->wcnext == NULL && runp->nwcs == 1) +- { +- int32_t weigthidx = output_weightwc (&weightpool, collate, runp); +- collidx_table_add (&tablewc, ch, weigthidx); +- } +- else +- { +- /* As for the singlebyte table, we recognize sequences and +- compress them. */ +- struct element_t *lastp; +- +- collidx_table_add (&tablewc, ch, +- -(obstack_object_size (&extrapool) / sizeof (uint32_t))); +- +- do +- { +- /* Store the current index in the weight table. We know that +- the current position in the `extrapool' is aligned on a +- 32-bit address. */ +- int32_t weightidx; +- int added; +- +- /* Find out wether this is a single entry or we have more than +- one consecutive entry. */ +- if (runp->wcnext != NULL +- && runp->nwcs == runp->wcnext->nwcs +- && wmemcmp ((wchar_t *) runp->wcs, +- (wchar_t *)runp->wcnext->wcs, +- runp->nwcs - 1) == 0 +- && (runp->wcs[runp->nwcs - 1] +- == runp->wcnext->wcs[runp->nwcs - 1] + 1)) +- { +- int i; +- struct element_t *series_startp = runp; +- struct element_t *curp; +- +- /* Now add first the initial byte sequence. */ +- added = (1 + 1 + 2 * (runp->nwcs - 1)) * sizeof (int32_t); +- if (sizeof (int32_t) == sizeof (int)) +- obstack_make_room (&extrapool, added); +- +- /* More than one consecutive entry. We mark this by having +- a negative index into the indirect table. */ +- obstack_int32_grow_fast (&extrapool, +- -(obstack_object_size (&indirectpool) +- / sizeof (int32_t))); +- obstack_int32_grow_fast (&extrapool, runp->nwcs - 1); +- +- do +- runp = runp->wcnext; +- while (runp->wcnext != NULL +- && runp->nwcs == runp->wcnext->nwcs +- && wmemcmp ((wchar_t *) runp->wcs, +- (wchar_t *)runp->wcnext->wcs, +- runp->nwcs - 1) == 0 +- && (runp->wcs[runp->nwcs - 1] +- == runp->wcnext->wcs[runp->nwcs - 1] + 1)); +- +- /* Now walk backward from here to the beginning. */ +- curp = runp; +- +- for (i = 1; i < runp->nwcs; ++i) +- obstack_int32_grow_fast (&extrapool, curp->wcs[i]); +- +- /* Now find the end of the consecutive sequence and +- add all the indeces in the indirect pool. */ +- do +- { +- weightidx = output_weightwc (&weightpool, collate, +- curp); +- obstack_int32_grow (&indirectpool, weightidx); +- +- curp = curp->wclast; +- } +- while (curp != series_startp); +- +- /* Add the final weight. */ +- weightidx = output_weightwc (&weightpool, collate, curp); +- obstack_int32_grow (&indirectpool, weightidx); +- +- /* And add the end byte sequence. Without length this +- time. */ +- for (i = 1; i < curp->nwcs; ++i) +- obstack_int32_grow (&extrapool, curp->wcs[i]); +- } +- else +- { +- /* A single entry. Simply add the index and the length and +- string (except for the first character which is already +- tested for). */ +- int i; +- +- /* Output the weight info. */ +- weightidx = output_weightwc (&weightpool, collate, runp); +- +- added = (1 + 1 + runp->nwcs - 1) * sizeof (int32_t); +- if (sizeof (int) == sizeof (int32_t)) +- obstack_make_room (&extrapool, added); +- +- obstack_int32_grow_fast (&extrapool, weightidx); +- obstack_int32_grow_fast (&extrapool, runp->nwcs - 1); +- for (i = 1; i < runp->nwcs; ++i) +- obstack_int32_grow_fast (&extrapool, runp->wcs[i]); +- } +- +- /* Next entry. */ +- lastp = runp; +- runp = runp->wcnext; +- } +- while (runp != NULL); +- } +- } +- + tablewc.p = 6; + tablewc.q = 10; + collidx_table_init (&tablewc); +--- 2410,2415 ---- diff --git a/recipes/glibc/glibc-2.5/sysdeps-nios2.patch b/recipes/glibc/glibc-2.5/sysdeps-nios2.patch new file mode 100644 index 0000000000..9d54a806e1 --- /dev/null +++ b/recipes/glibc/glibc-2.5/sysdeps-nios2.patch @@ -0,0 +1,4028 @@ +Index: glibc-2.5/sysdeps/nios2/Implies +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/Implies 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,4 @@ ++wordsize-32 ++ieee754/dbl-64 ++ieee754/flt-32 ++nios2/soft-fp +Index: glibc-2.5/sysdeps/nios2/Makefile +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/Makefile 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,33 @@ ++# Copyright (C) 1993, 1994, 1996, 1997, 2003, 2008 Free Software Foundation, ++# Inc. ++# This file is part of the GNU C Library. ++ ++# The GNU C Library is free software; you can redistribute it and/or ++# modify it under the terms of the GNU Lesser General Public ++# License as published by the Free Software Foundation; either ++# version 2.1 of the License, or (at your option) any later version. ++ ++# The GNU C Library is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# Lesser General Public License for more details. ++ ++# You should have received a copy of the GNU Lesser General Public ++# License along with the GNU C Library; if not, write to the Free ++# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++# 02111-1307 USA. ++ ++pic-ccflag = -fpic ++ ++ifeq ($(subdir),elf) ++CFLAGS-rtld.c += -mhw-div ++endif ++ ++ifeq ($(subdir),soft-fp) ++sysdep_routines += $(filter-out sqrtsf2,$(gcc-single-routines)) \ ++ $(filter-out sqrtdf2,$(gcc-double-routines)) ++endif ++ ++ifeq ($(subdir),csu) ++gen-as-const-headers += tcb-offsets.sym ++endif +Index: glibc-2.5/sysdeps/nios2/Subdirs +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/Subdirs 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1 @@ ++soft-fp +Index: glibc-2.5/sysdeps/nios2/Versions +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/Versions 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,12 @@ ++libc { ++ GLIBC_2.10 { ++ __adddf3; __addsf3; __divdf3; __divsf3; __eqdf2; __eqsf2; __extendsfdf2; ++ __fixdfdi; __fixdfsi; __fixsfdi; __fixsfsi; ++ __fixunsdfdi; __fixunsdfsi; __fixunssfdi; __fixunssfsi; ++ __floatdidf; __floatdisf; __floatsidf; __floatsisf; ++ __floatundidf; __floatundisf; __floatunsidf; __floatunsisf; ++ __gedf2; __gesf2; __gtdf2; __gtsf2; __ledf2; __lesf2; __ltdf2; __ltsf2; ++ __muldf3; __mulsf3; __nedf2; __nesf2; __negdf2; __negsf2; ++ __subdf3; __subsf3; __truncdfsf2; __unorddf2; __unordsf2; ++ } ++} +Index: glibc-2.5/sysdeps/nios2/__longjmp.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/__longjmp.c 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,41 @@ ++/* Copyright (C) 1991, 92, 93, 94, 95, 97, 2008 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++ ++/* Jump to the position specified by ENV, causing the ++ setjmp call there to return VAL, or 1 if VAL is 0. */ ++void ++__longjmp (__jmp_buf env, int val) ++{ ++ if (val == 0) ++ val = 1; ++ __asm__ volatile ("mov r2, %0" : : "r" (val)); ++ __asm__ volatile ("ldw r16, %0" : : "m" (env[0].__regs[0])); ++ __asm__ volatile ("ldw r17, %0" : : "m" (env[0].__regs[1])); ++ __asm__ volatile ("ldw r18, %0" : : "m" (env[0].__regs[2])); ++ __asm__ volatile ("ldw r19, %0" : : "m" (env[0].__regs[3])); ++ __asm__ volatile ("ldw r20, %0" : : "m" (env[0].__regs[4])); ++ __asm__ volatile ("ldw r21, %0" : : "m" (env[0].__regs[5])); ++ __asm__ volatile ("ldw r22, %0" : : "m" (env[0].__regs[6])); ++ __asm__ volatile ("ldw r23, %0" : : "m" (env[0].__regs[7])); ++ __asm__ volatile ("ldw sp, %0" : : "m" (env[0].__regs[8])); ++ __asm__ volatile ("ldw fp, %0" : : "m" (env[0].__regs[9])); ++ __asm__ volatile ("ldw ra, %0" : : "m" (env[0].__regs[10])); ++} +Index: glibc-2.5/sysdeps/nios2/bits/endian.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/bits/endian.h 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,12 @@ ++/* The Nios II architecture has selectable endianness. */ ++ ++#ifndef _ENDIAN_H ++# error "Never use directly; include instead." ++#endif ++ ++#ifdef __nios2_big_endian__ ++# define __BYTE_ORDER __BIG_ENDIAN ++#endif ++#ifdef __nios2_little_endian__ ++# define __BYTE_ORDER __LITTLE_ENDIAN ++#endif +Index: glibc-2.5/sysdeps/nios2/bits/link.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/bits/link.h 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,54 @@ ++/* Copyright (C) 2009 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#ifndef _LINK_H ++# error "Never include directly; use instead." ++#endif ++ ++/* Registers for entry into PLT on Nios II. */ ++typedef struct La_nios2_regs ++{ ++ uint32_t lr_reg[4]; /* r4 through r7 */ ++ uint32_t lr_ra; ++ uint32_t lr_sp; ++} La_nios2_regs; ++ ++/* Return values for calls from PLT on Nios II. */ ++typedef struct La_nios2_retval ++{ ++ uint32_t lrv_r2; ++ uint32_t lrv_r3; ++} La_nios2_retval; ++ ++__BEGIN_DECLS ++ ++extern Elf32_Addr la_nios2_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx, ++ uintptr_t *__refcook, ++ uintptr_t *__defcook, ++ La_nios2_regs *__regs, ++ unsigned int *__flags, ++ const char *__symname, ++ long int *__framesizep); ++extern unsigned int la_nios2_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx, ++ uintptr_t *__refcook, ++ uintptr_t *__defcook, ++ const La_nios2_regs *__inregs, ++ La_nios2_retval *__outregs, ++ const char *symname); ++ ++__END_DECLS +Index: glibc-2.5/sysdeps/nios2/bits/setjmp.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/bits/setjmp.h 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,35 @@ ++/* Define the machine-dependent type `jmp_buf'. Nios II version. ++ Copyright (C) 1992,1993,1995,1997,2000,2002,2003,2004,2005,2006,2008 ++ Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#ifndef _NIOS2_BITS_SETJMP_H ++#define _NIOS2_BITS_SETJMP_H 1 ++ ++#if !defined(_SETJMP_H) && !defined(_PTHREAD_H) ++# error "Never include directly; use instead." ++#endif ++ ++typedef struct ++ { ++ /* r16,r17,r18,r19,r20,r21,r22,r23,sp,fp,ra */ ++ int __regs[11]; ++ ++ } __jmp_buf[1]; ++ ++#endif /* _NIOS2_BITS_SETJMP_H */ +Index: glibc-2.5/sysdeps/nios2/bsd-_setjmp.S +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/bsd-_setjmp.S 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,40 @@ ++/* BSD `_setjmp' entry point to `sigsetjmp (..., 1)'. NIOS2 version. ++ Copyright (C) 1996, 1997, 2000, 2008 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++/* This just does a tail-call to `__sigsetjmp (ARG, 1)'. ++ We cannot do it in C because it must be a tail-call, so frame-unwinding ++ in setjmp doesn't clobber the state restored by longjmp. */ ++ ++#include ++ ++ENTRY (_setjmp) ++ movi r5, 0 /* Pass a second argument of zero. */ ++#if defined (__PIC__) || defined (PIC) ++ nextpc r2 ++1: movhi r3, %hiadj(_GLOBAL_OFFSET_TABLE_ - 1b) ++ addi r3, r3, %lo(_GLOBAL_OFFSET_TABLE_ - 1b) ++ add r2, r2, r3 ++ ldw r2, %call(C_SYMBOL_NAME(__sigsetjmp))(r2) ++ jmp r2 ++#else ++ jmpi C_SYMBOL_NAME (__sigsetjmp) ++#endif ++ .size setjmp, . - setjmp ++ ++libc_hidden_def (_setjmp) +Index: glibc-2.5/sysdeps/nios2/bsd-setjmp.S +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/bsd-setjmp.S 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,38 @@ ++/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. NIOS2 version. ++ Copyright (C) 1996, 1997, 2000, 2008 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++/* This just does a tail-call to `__sigsetjmp (ARG, 1)'. ++ We cannot do it in C because it must be a tail-call, so frame-unwinding ++ in setjmp doesn't clobber the state restored by longjmp. */ ++ ++#include ++ ++ENTRY (setjmp) ++ movi r5, 1 /* Pass a second argument of one. */ ++#if defined (__PIC__) || defined (PIC) ++ nextpc r2 ++1: movhi r3, %hiadj(_GLOBAL_OFFSET_TABLE_ - 1b) ++ addi r3, r3, %lo(_GLOBAL_OFFSET_TABLE_ - 1b) ++ add r2, r2, r3 ++ ldw r2, %call(C_SYMBOL_NAME(__sigsetjmp))(r2) ++ jmp r2 ++#else ++ jmpi C_SYMBOL_NAME (__sigsetjmp) ++#endif ++ .size setjmp, . - setjmp +Index: glibc-2.5/sysdeps/nios2/dl-init.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/dl-init.c 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,30 @@ ++/* Copyright (C) 2008 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++ ++unsigned int ++internal_function ++_dl_nios2_get_gp_value (struct link_map *main_map) ++{ ++ ElfW(Dyn)* dyn = main_map->l_ld; ++ for (dyn = main_map->l_ld; dyn->d_tag != DT_NULL; ++dyn) ++ if (dyn->d_tag == DT_NIOS2_GP) ++ return (unsigned int)(dyn->d_un.d_ptr); ++ return 0; ++} +Index: glibc-2.5/sysdeps/nios2/dl-machine.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/dl-machine.h 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,332 @@ ++/* Machine-dependent ELF dynamic relocation inline functions. Nios II version. ++ Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2005 ++ Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#ifndef dl_machine_h ++#define dl_machine_h ++ ++#define ELF_MACHINE_NAME "nios2" ++ ++#include ++#include ++#include ++ ++/* Return nonzero iff ELF header is compatible with the running host. */ ++static inline int ++elf_machine_matches_host (const Elf32_Ehdr *ehdr) ++{ ++ return ehdr->e_machine == EM_ALTERA_NIOS2; ++} ++ ++ ++/* Return the link-time address of _DYNAMIC. Conveniently, this is the ++ first element of the GOT. */ ++static inline Elf32_Addr ++elf_machine_dynamic (void) ++{ ++ Elf32_Addr *dynamic; ++ int tmp; ++ asm("nextpc\t%0\n\t" ++ "1: movhi\t%1, %%hiadj(_GLOBAL_OFFSET_TABLE_ - 1b)\n\t" ++ "addi\t%1, %1, %%lo( _GLOBAL_OFFSET_TABLE_ - 1b)\n\t" ++ "add\t%0, %0, %1\n" ++ : "=r" (dynamic), "=r" (tmp)); ++ return *dynamic; ++} ++ ++ ++/* Return the run-time load address of the shared object. */ ++static inline Elf32_Addr ++elf_machine_load_address (void) ++{ ++ Elf32_Addr result; ++ int tmp; ++ asm("nextpc\t%0\n\t" ++ "1: movhi\t%1, %%hiadj(1b)\n\t" ++ "addi\t%1, %1, %%lo(1b)\n\t" ++ "sub\t%0, %0, %1\n" ++ : "=r" (result), "=r" (tmp)); ++ return result; ++} ++ ++/* Set up the loaded object described by L so its unrelocated PLT ++ entries will jump to the on-demand fixup code in dl-runtime.c. */ ++ ++static inline int ++elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) ++{ ++ extern void _dl_runtime_resolve (Elf32_Word); ++ ++ if (lazy) ++ { ++ /* The GOT entries for functions in the PLT have not yet been filled ++ in. Their initial contents will arrange when called to load r15 with ++ an offset into the .got section, load r14 with ++ _GLOBAL_OFFSET_TABLE_[1], and then jump to _GLOBAL_OFFSET_TABLE[2]. ++ */ ++ Elf32_Addr *got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]); ++ got[1] = (Elf32_Addr) l; /* Identify this shared object. */ ++ ++ /* This function will get called to fix up the GOT entry indicated by ++ the offset on the stack, and then jump to the resolved address. */ ++ got[2] = (Elf32_Addr) &_dl_runtime_resolve; ++ } ++ ++ return lazy; ++} ++ ++/* Initial entry point code for the dynamic linker. ++ The C function `_dl_start' is the real entry point; ++ its return value is the user program's entry point. */ ++ ++#define RTLD_START asm("\ ++.text\n\ ++.globl _start\n\ ++.type _start, %function\n\ ++_start:\n\ ++ /* At start time, all the args are on the stack. */\n\ ++ mov r4, sp\n\ ++\n\ ++ /* Start the calculation of the GOT pointer. */\n\ ++ nextpc r22\n\ ++1: movhi r8, %hiadj(_GLOBAL_OFFSET_TABLE_ - 1b)\n\ ++ addi r8, r8, %lo(_GLOBAL_OFFSET_TABLE_ - 1b)\n\ ++\n\ ++ /* Figure out where _dl_start will need to return to. */\n\ ++ movhi ra, %hiadj(2f - 1b)\n\ ++ addi ra, ra, %lo(2f - 1b)\n\ ++ add ra, ra, r22\n\ ++\n\ ++ /* Finish the calculation of the GOT pointer. */\n\ ++ add r22, r22, r8\n\ ++\n\ ++ br _dl_start\n\ ++\n\ ++ /* Save the returned user entry point. */\n\ ++2: mov r16, r2\n\ ++\n\ ++ /* Initialize gp. */\n\ ++ ldw r4, %got(_rtld_local)(r22)\n\ ++ ldw r4, 0(r4)\n\ ++ ldw r8, %call(_dl_nios2_get_gp_value)(r22)\n\ ++ callr r8\n\ ++ mov gp, r2\n\ ++\n\ ++ /* Find the number of arguments to skip. */\n\ ++ ldw r8, %got(_dl_skip_args)(r22)\n\ ++ ldw r8, 0(r8)\n\ ++\n\ ++ /* Find the main_map from the GOT. */\n\ ++ ldw r4, %got(_rtld_local)(r22)\n\ ++ ldw r4, 0(r4)\n\ ++\n\ ++ /* Find argc. */\n\ ++ ldw r5, 0(sp)\n\ ++ sub r5, r5, r8\n\ ++ stw r5, 0(sp)\n\ ++\n\ ++ /* Find the first unskipped argument. */\n\ ++ slli r8, r8, 2\n\ ++ addi r6, sp, 4\n\ ++ add r9, r6, r8\n\ ++ mov r10, r6\n\ ++\n\ ++ /* Shuffle argv down. */\n\ ++3: ldw r11, 0(r9)\n\ ++ stw r11, 0(r10)\n\ ++ addi r9, r9, 4\n\ ++ addi r10, r10, 4\n\ ++ bne r11, zero, 3b\n\ ++\n\ ++ /* Shuffle envp down. */\n\ ++ mov r7, r10\n\ ++4: ldw r11, 0(r9)\n\ ++ stw r11, 0(r10)\n\ ++ addi r9, r9, 4\n\ ++ addi r10, r10, 4\n\ ++ bne r11, zero, 4b\n\ ++\n\ ++ /* Shuffle auxv down. */\n\ ++5: ldw r11, 4(r9)\n\ ++ stw r11, 4(r10)\n\ ++ ldw r11, 0(r9)\n\ ++ stw r11, 0(r10)\n\ ++ addi r9, r9, 8\n\ ++ addi r10, r10, 8\n\ ++ bne r11, zero, 5b\n\ ++\n\ ++ /* Update _dl_argv. */\n\ ++ ldw r2, %got(_dl_argv)(r22)\n\ ++ stw r6, 0(r2)\n\ ++\n\ ++ /* Call _dl_init through the PLT. */\n\ ++ ldw r8, %call(_dl_init)(r22)\n\ ++ callr r8\n\ ++\n\ ++ /* Find the finalization function. */\n\ ++ ldw r4, %got(_dl_fini)(r22)\n\ ++\n\ ++ /* Jump to the user's entry point. */\n\ ++ jmp r16\n\ ++"); ++ ++/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so ++ PLT entries should not be allowed to define the value. ++ ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one ++ of the main executable's symbols, as for a COPY reloc. */ ++#define elf_machine_type_class(type) \ ++ ((((type) == R_NIOS2_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT) \ ++ | (((type) == R_NIOS2_COPY) * ELF_RTYPE_CLASS_COPY)) ++ ++/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ ++#define ELF_MACHINE_JMP_SLOT R_NIOS2_JUMP_SLOT ++ ++/* The Nios II never uses Elf32_Rel relocations. */ ++#define ELF_MACHINE_NO_REL 1 ++ ++/* Fixup a PLT entry to bounce directly to the function at VALUE. */ ++ ++static inline Elf32_Addr ++elf_machine_fixup_plt (struct link_map *map, lookup_t t, ++ const Elf32_Rel *reloc, ++ Elf32_Addr *reloc_addr, Elf32_Addr value) ++{ ++ return *reloc_addr = value; ++} ++ ++/* Return the final value of a plt relocation. */ ++static inline Elf32_Addr ++elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, ++ Elf32_Addr value) ++{ ++ return value; ++} ++ ++/* Names of the architecture-specific auditing callback functions. */ ++#define ARCH_LA_PLTENTER nios2_gnu_pltenter ++#define ARCH_LA_PLTEXIT nios2_gnu_pltexit ++ ++#endif /* dl_machine_h */ ++ ++#ifdef RESOLVE_MAP ++ ++/* Perform the relocation specified by RELOC and SYM (which is fully resolved). ++ LOADADDR is the load address of the object; INFO is an array indexed ++ by DT_* of the .dynamic section info. */ ++ ++auto inline void __attribute__ ((always_inline)) ++elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, ++ const ElfW(Sym) *sym, const struct r_found_version *version, ++ void *const reloc_addr_arg) ++{ ++ Elf32_Addr *const reloc_addr = reloc_addr_arg; ++ const unsigned int r_type = ELF32_R_TYPE (reloc->r_info); ++ ++ if (__builtin_expect (r_type == R_NIOS2_RELATIVE, 0)) ++ *reloc_addr = map->l_addr + reloc->r_addend; ++ else if (__builtin_expect (r_type == R_NIOS2_NONE, 0)) ++ return; ++ else ++ { ++ const Elf32_Sym *const refsym = sym; ++ struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); ++ Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; ++ ++ switch (r_type) ++ { ++ case R_NIOS2_COPY: ++ if (sym == NULL) ++ /* This can happen in trace mode if an object could not be ++ found. */ ++ break; ++ if (sym->st_size > refsym->st_size ++ || (sym->st_size < refsym->st_size && GLRO(dl_verbose))) ++ { ++ const char *strtab; ++ ++ strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]); ++ _dl_error_printf ("\ ++%s: Symbol `%s' has different size in shared object, consider re-linking\n", ++ rtld_progname ?: "", ++ strtab + refsym->st_name); ++ } ++ memcpy (reloc_addr_arg, (void *) value, ++ MIN (sym->st_size, refsym->st_size)); ++ break; ++ case R_NIOS2_GLOB_DAT: ++ case R_NIOS2_JUMP_SLOT: ++# ifdef RTLD_BOOTSTRAP ++ /* Fix weak undefined references. */ ++ if (sym != NULL && sym->st_value == 0) ++ *reloc_addr = 0; ++ else ++# endif ++ *reloc_addr = value; ++ break; ++#if defined USE_TLS && !defined RTLD_BOOTSTRAP ++ case R_NIOS2_TLS_DTPMOD: ++ /* Get the information from the link map returned by the ++ resolv function. */ ++ if (sym_map != NULL) ++ *reloc_addr = sym_map->l_tls_modid; ++ break; ++ ++ case R_NIOS2_TLS_DTPREL: ++ *reloc_addr = reloc->r_addend + TLS_DTPREL_VALUE(sym); ++ break; ++ ++ case R_NIOS2_TLS_TPREL: ++ if (sym != NULL) ++ { ++ CHECK_STATIC_TLS (map, sym_map); ++ *reloc_addr = reloc->r_addend + TLS_TPREL_VALUE(sym_map, sym); ++ } ++ break; ++#endif ++ case R_NIOS2_BFD_RELOC_32: ++ *reloc_addr = value + reloc->r_addend; ++ break; ++ ++ default: ++ _dl_reloc_bad_type (map, r_type, 0); ++ break; ++ } ++ } ++} ++ ++auto inline void __attribute__((always_inline)) ++ elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, ++ void *const reloc_addr_arg) ++{ ++ Elf32_Addr *const reloc_addr = reloc_addr_arg; ++ *reloc_addr = l_addr + reloc->r_addend; ++} ++ ++auto inline void __attribute__((always_inline)) ++ elf_machine_lazy_rel (struct link_map *map, ++ ElfW(Addr) l_addr, const ElfW(Rela) *reloc) ++{ ++ Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset); ++ if (ELF32_R_TYPE (reloc->r_info) == R_NIOS2_JUMP_SLOT) ++ *reloc_addr += l_addr; ++ else ++ _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1); ++} ++ ++#endif /* RESOLVE_MAP */ +Index: glibc-2.5/sysdeps/nios2/dl-sysdep.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/dl-sysdep.h 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,24 @@ ++/* System-specific settings for dynamic linker code. Nios II version. ++ Copyright (C) 2009 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include_next ++ ++/* _dl_argv cannot be attribute_relro, because _dl_start_user ++ might write into it after _dl_start returns. */ ++#define DL_ARGV_NOT_RELRO 1 +Index: glibc-2.5/sysdeps/nios2/dl-tls.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/dl-tls.h 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,46 @@ ++/* Thread-local storage handling in the ELF dynamic linker. Nios II version. ++ Copyright (C) 2005 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++ ++/* Type used for the representation of TLS information in the GOT. */ ++typedef struct ++{ ++ unsigned long int ti_module; ++ unsigned long int ti_offset; ++} tls_index; ++ ++/* The thread pointer points 0x7000 past the first static TLS block. */ ++#define TLS_TP_OFFSET 0x7000 ++ ++/* Dynamic thread vector pointers point 0x8000 past the start of each ++ TLS block. */ ++#define TLS_DTV_OFFSET 0x8000 ++ ++/* Compute the value for a GOTTPREL reloc. */ ++#define TLS_TPREL_VALUE(sym_map, sym) \ ++ ((sym_map)->l_tls_offset + (sym)->st_value - TLS_TP_OFFSET) ++ ++/* Compute the value for a DTPREL reloc. */ ++#define TLS_DTPREL_VALUE(sym) \ ++ ((sym)->st_value - TLS_DTV_OFFSET) ++ ++extern void *__tls_get_addr (tls_index *ti); ++ ++# define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET) ++# define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET) +Index: glibc-2.5/sysdeps/nios2/dl-trampoline.S +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/dl-trampoline.S 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,80 @@ ++/* PLT trampolines. Nios II version. ++ Copyright (C) 2005 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++ ++ .text ++ .globl _dl_runtime_resolve ++ cfi_startproc ++_dl_runtime_resolve: ++/* The runtime resolver receives the original function arguments in r4 ++ through r7, the shared library identifier from GOT[1]? in r14, and the ++ relocation index times four in r15. It updates the corresponding PLT GOT ++ entry so that the PLT entry will transfer control directly to the target ++ in the future, and then transfers control to the target. */ ++ /* Save arguments and return address. */ ++ subi sp, sp, 28 ++ cfi_adjust_cfa_offset (28) ++ stw r22, 24(sp) ++ cfi_rel_offset (r22, 24) ++ stw r8, 20(sp) /* save r8, because this might be a call to mcount */ ++ cfi_rel_offset (r8, 20) ++ stw r7, 16(sp) ++ cfi_rel_offset (r7, 16) ++ stw r6, 12(sp) ++ cfi_rel_offset (r6, 12) ++ stw r5, 8(sp) ++ cfi_rel_offset (r5, 8) ++ stw r4, 4(sp) ++ cfi_rel_offset (r4, 4) ++ stw ra, 0(sp) ++ cfi_rel_offset (ra, 0) ++ ++ /* Get pointer to linker struct. */ ++ mov r4, r14 ++ ++ /* Get the relocation offset. We're given a multiple of 4 and ++ need a multiple of 12, so multiply by 3. */ ++ slli r5, r15, 1 ++ add r5, r5, r15 ++ ++ /* Call the fixup routine. */ ++ nextpc r22 ++1: movhi r2, %hiadj(_GLOBAL_OFFSET_TABLE_ - 1b) ++ addi r2, r2, %lo(_GLOBAL_OFFSET_TABLE_ - 1b) ++ add r22, r22, r2 ++ ldw r2, %call(_dl_fixup)(r22) ++ callr r2 ++ ++ /* Restore the arguments and return address. */ ++ ldw ra, 0(sp) ++ ldw r4, 4(sp) ++ ldw r5, 8(sp) ++ ldw r6, 12(sp) ++ ldw r7, 16(sp) ++ ldw r8, 20(sp) ++ ldw r22, 24(sp) ++ addi sp, sp, 28 ++ cfi_adjust_cfa_offset (-28) ++ ++ /* Jump to the newly found address. */ ++ jmp r2 ++ ++ cfi_endproc +Index: glibc-2.5/sysdeps/nios2/elf/start.S +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/elf/start.S 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,132 @@ ++/* Startup code for Nios II ++ Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002, 2005 ++ Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ In addition to the permissions in the GNU Lesser General Public ++ License, the Free Software Foundation gives you unlimited ++ permission to link the compiled version of this file with other ++ programs, and to distribute those programs without any restriction ++ coming from the use of this file. (The GNU Lesser General Public ++ License restrictions do apply in other respects; for example, they ++ cover modification of the file, and distribution when not linked ++ into another program.) ++ ++ Note that people who make modified versions of this file are not ++ obligated to grant this special exception for their modified ++ versions; it is their choice whether to do so. The GNU Lesser ++ General Public License gives permission to release a modified ++ version without this exception; this exception also makes it ++ possible to release a modified version which carries forward this ++ exception. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++/* This is the canonical entry point, usually the first thing in the text ++ segment. ++ ++ Note that the code in the .init section has already been run. ++ This includes _init and _libc_init ++ ++ The stack pointer, sp, will point to the argument count on the stack. ++ The initial state of the stack when a userspace process is started is: ++ ++ Purpose Start Address Length ++ Unspecified High Addresses ++ Referenced strings, etc. Varies ++ Unspecified ++ Null auxilliary vector entry 4bytes ++ Auxilliary vector entries 8bytes each ++ NULL terminator for envp 4bytes ++ Environment pointers sp+8+4*argc 4bytes each ++ NULL terminator for argv sp+4+4*argc 4bytes ++ Argument pointers sp+4 4bytes each ++ Argument count sp 4bytes ++ Unspecified Low Addresses ++ ++ If the application should register a destructor function with atexit, ++ the pointer will be placed in r4. Otherwise r4 will be zero. ++ ++ The contents of all other registers are unspecified. User code should ++ set fp to zero to mark the end of the frame chain. ++ ++ The auxilliary vector is a series of pairs of 32-bit tag and 32-bit ++ value, terminated by an AT_NULL tag. ++*/ ++ ++ .text ++ .globl _start ++_start: ++ /* Set up the global pointer. */ ++ movhi gp, %hiadj(_gp) ++ addi gp, gp, %lo(_gp) ++ ++ /* Save the stack pointer. */ ++ mov r2, sp ++ ++ /* Create room on the stack for the fini, rtld_fini and stack_end args ++ to __libc_start_main. */ ++ subi sp, sp, 12 ++ ++ /* Push stack_end */ ++ stw r2, 8(sp) ++ ++ /* Push rtld_fini */ ++ stw r4, 4(sp) ++ ++ /* Set up the GOT pointer. */ ++ nextpc r22 ++1: movhi r2, %hiadj(_GLOBAL_OFFSET_TABLE_ - 1b) ++ addi r2, r2, %lo(_GLOBAL_OFFSET_TABLE_ - 1b) ++ add r22, r22, r2 ++ ++ /* Push fini */ ++ ldw r8, %call(__libc_csu_fini)(r22) ++ stw r8, 0(sp) ++ ++ /* r7 == init */ ++ ldw r7, %call(__libc_csu_init)(r22) ++ ++ /* r6 == argv */ ++ addi r6, sp, 16 ++ ++ /* r5 == argc */ ++ ldw r5, 12(sp) ++ ++ /* r4 == main */ ++ ldw r4, %call(main)(r22) ++ ++ /* fp == 0 */ ++ mov fp, zero ++ ++ /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, ++ stack_end) */ ++ ++ /* Let the libc call main and exit with its return code. */ ++ ldw r2, %call(__libc_start_main)(r22) ++ callr r2 ++ ++ /* should never get here....*/ ++ ldw r2, %call(abort)(r22) ++ callr r2 ++ ++/* Define a symbol for the first piece of initialized data. */ ++ .data ++ .globl __data_start ++__data_start: ++ .long 0 ++ .weak data_start ++ data_start = __data_start +Index: glibc-2.5/sysdeps/nios2/jmpbuf-offsets.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/jmpbuf-offsets.h 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,20 @@ ++/* Private macros for accessing __jmp_buf contents. Nios II version. ++ Copyright (C) 2006, 2008 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#define __JMP_BUF_SP 8 +Index: glibc-2.5/sysdeps/nios2/jmpbuf-unwind.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/jmpbuf-unwind.h 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,36 @@ ++/* Copyright (C) 2005,2006 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++/* Test if longjmp to JMPBUF would unwind the frame ++ containing a local variable at ADDRESS. */ ++#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ ++ ((void *) (address) < (void *) demangle ((jmpbuf)->__regs[__JMP_BUF_SP])) ++ ++#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ ++ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) ++ ++#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ ++ ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)->__regs[__JMP_BUF_SP] - (_adj)) ++ ++/* We use the normal longjmp for unwinding. */ ++#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) +Index: glibc-2.5/sysdeps/nios2/ldsodefs.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/ldsodefs.h 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,42 @@ ++/* Run-time dynamic linker data structures for loaded ELF shared objects. ++ Copyright (C) 2000, 2002, 2003, 2006, 2007 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#ifndef _NIOS2_LDSODEFS_H ++#define _NIOS2_LDSODEFS_H 1 ++ ++struct La_nios2_regs; ++struct La_nios2_retval; ++ ++#define ARCH_PLTENTER_MEMBERS \ ++ Elf32_Addr (*nios2_gnu_pltenter) (Elf32_Sym *, unsigned int, \ ++ uintptr_t *, uintptr_t *, \ ++ const struct La_nios2_regs *, \ ++ unsigned int *, const char *name, \ ++ long int *framesizep); ++ ++#define ARCH_PLTEXIT_MEMBERS \ ++ unsigned int (*nios2_gnu_pltexit) (Elf64_Sym *, unsigned int, \ ++ uintptr_t *, uintptr_t *, \ ++ const struct La_nios2_regs *, \ ++ struct La_nios2_retval *, \ ++ const char *); ++ ++#include_next ++ ++#endif +Index: glibc-2.5/sysdeps/nios2/libc-tls.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/libc-tls.c 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,37 @@ ++/* Thread-local storage handling in the ELF dynamic linker. Nios II version. ++ Copyright (C) 2005, 2008 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++ ++#if USE_TLS ++ ++/* On Nios II, linker optimizations are not required, so __tls_get_addr ++ can be called even in statically linked binaries. In this case module ++ must be always 1 and PT_TLS segment exist in the binary, otherwise it ++ would not link. */ ++ ++void * ++__tls_get_addr (tls_index *ti) ++{ ++ dtv_t *dtv = THREAD_DTV (); ++ return (char *) dtv[1].pointer.val + GET_ADDR_OFFSET; ++} ++ ++#endif +Index: glibc-2.5/sysdeps/nios2/machine-gmon.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/machine-gmon.h 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,67 @@ ++/* Machine-dependent definitions for profiling support. Nios II version. ++ Copyright (C) 1996, 1997, 1998, 2008 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++ ++#define _MCOUNT_DECL(frompc, selfpc) \ ++static void __attribute_used__ mcount_internal (u_long frompc, u_long selfpc) ++ ++/* This macro/func MUST save r4, r5, r6, r7 and r8 because the compiler inserts ++ blind calls to mcount(), ignoring the fact that mcount may clobber ++ registers; therefore, mcount may NOT clobber registers. */ ++ ++#if defined(__PIC__) || defined(PIC) ++#define NIOS2_MCOUNT_CALL \ ++ "nextpc r3\n\t" \ ++ "1: movhi r2, %hiadj(_GLOBAL_OFFSET_TABLE_ - 1b)\n\t" \ ++ "addi r2, r2, %lo(_GLOBAL_OFFSET_TABLE_ - 1b)\n\t" \ ++ "add r2, r2, r3\n\t" \ ++ "ldw r2, %call(mcount_internal)(r2)\n\t" \ ++ "callr r2\n\t" ++#else ++#define NIOS2_MCOUNT_CALL \ ++ "call\tmcount_internal\n\t" ++#endif ++ ++#define MCOUNT \ ++asm( \ ++ ".globl _mcount\n\t" \ ++ ".type _mcount,@function\n\t" \ ++ "_mcount:\n\t" \ ++ "subi sp, sp, 24\n\t" \ ++ "stw ra, 20(sp)\n\t" \ ++ "stw r8, 16(sp)\n\t" \ ++ "stw r7, 12(sp)\n\t" \ ++ "stw r6, 8(sp)\n\t" \ ++ "stw r5, 4(sp)\n\t" \ ++ "stw r4, 0(sp)\n\t" \ ++ "mov r4, r8\n\t" \ ++ "mov r5, ra\n\t" \ ++ NIOS2_MCOUNT_CALL \ ++ "ldw ra, 20(sp)\n\t" \ ++ "ldw r8, 16(sp)\n\t" \ ++ "ldw r7, 12(sp)\n\t" \ ++ "ldw r6, 8(sp)\n\t" \ ++ "ldw r5, 4(sp)\n\t" \ ++ "ldw r4, 0(sp)\n\t" \ ++ "addi sp, sp, 24\n\t" \ ++ "ret\n\t" \ ++ ".size _mcount, . - _mcount\n\t" \ ++); ++ +Index: glibc-2.5/sysdeps/nios2/memusage.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.5/sysdeps/nios2/memusage.h 2010-05-31 08:56:05.000000000 +0200 +@@ -0,0 +1,24 @@ ++/* Copyright (C) 2000 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++