]> git.pld-linux.org Git - packages/uClibc.git/blob - uClibc-sparc-ldso.patch
- ops, cleanup.
[packages/uClibc.git] / uClibc-sparc-ldso.patch
1 --- uClibc-0.9.26/ldso/include/ld_string.h.orig 2003-09-29 21:46:00.000000000 +0000
2 +++ uClibc-0.9.26/ldso/include/ld_string.h      2004-05-27 20:47:48.000000000 +0000
3 @@ -215,11 +215,13 @@
4  static inline char *_dl_simple_ltoa(char * local, unsigned long i)
5  {
6         /* 21 digits plus null terminator, good for 64-bit or smaller ints */
7 -       char *p = &local[22];
8 +       char *p = &local[21];
9         *p-- = '\0';
10         do {
11 -               *p-- = '0' + i % 10;
12 -               i /= 10;
13 +               char temp;
14 +               do_rem(temp, i, 10);
15 +               *p-- = '0' + temp;
16 +               i /= 10; /* XXX: .udiv() on sparc! */
17         } while (i > 0);
18         return p + 1;
19  }
20 @@ -227,15 +229,15 @@
21  static inline char *_dl_simple_ltoahex(char * local, unsigned long i)
22  {
23         /* 21 digits plus null terminator, good for 64-bit or smaller ints */
24 -       char *p = &local[22];
25 +       char *p = &local[21];
26         *p-- = '\0';
27         do {
28 -               char temp = i % 0x10;
29 +               char temp = i & 0xf; /* % 0x10, to be sure .urem is not used */
30                 if (temp <= 0x09)
31                     *p-- = '0' + temp;
32                 else
33                     *p-- = 'a' - 0x0a + temp;
34 -               i /= 0x10;
35 +               i >>= 4; /* /= 0x10, to be sure .udiv is not used */
36         } while (i > 0);
37         *p-- = 'x';
38         *p-- = '0';
39 --- uClibc-0.9.26/ldso/include/ld_syscall.h.orig        2003-08-19 06:05:30.000000000 +0000
40 +++ uClibc-0.9.26/ldso/include/ld_syscall.h     2004-05-25 22:20:36.000000000 +0000
41 @@ -50,7 +50,7 @@
42  static inline _syscall1(int, _dl_close, int, fd);
43  
44  
45 -#if defined(__powerpc__) || defined(__mips__) || defined(__sh__)
46 +#if defined(__powerpc__) || defined(__mips__) || defined(__sh__) || defined(__sparc__)
47  /* PowerPC, MIPS and SuperH have a different calling convention for mmap(). */
48  #define __NR__dl_mmap __NR_mmap
49  static inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
50 --- uClibc-0.9.26/ldso/ldso/sparc/ld_syscalls.h.orig    2004-05-25 19:03:47.000000000 +0000
51 +++ uClibc-0.9.26/ldso/ldso/sparc/ld_syscalls.h 2004-05-25 22:41:08.000000000 +0000
52 @@ -154,3 +154,29 @@
53  /*errno = -__res; */\
54  return -1; \
55  }
56 +
57 +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
58 +         type5,arg5,type6,arg6) \
59 +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
60 +{ \
61 +long __res; \
62 +register long __g1 __asm__ ("g1") = __NR_##name; \
63 +register long __o0 __asm__ ("o0") = (long)(arg1); \
64 +register long __o1 __asm__ ("o1") = (long)(arg2); \
65 +register long __o2 __asm__ ("o2") = (long)(arg3); \
66 +register long __o3 __asm__ ("o3") = (long)(arg4); \
67 +register long __o4 __asm__ ("o4") = (long)(arg5); \
68 +register long __o5 __asm__ ("o5") = (long)(arg6); \
69 +__asm__ __volatile__ ("t 0x10\n\t" \
70 +                     "bcc 1f\n\t" \
71 +                     "mov %%o0, %0\n\t" \
72 +                     "sub %%g0, %%o0, %0\n\t" \
73 +                     "1:\n\t" \
74 +                     : "=r" (__res), "=&r" (__o0) \
75 +                     : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__o5), "r" (__g1) \
76 +                     : "cc"); \
77 +if (__res < -255 || __res>=0) \
78 +       return (type) __res; \
79 +/*errno = -__res; */\
80 +return -1; \
81 +}
82 --- uClibc-0.9.26/ldso/ldso/sparc/ld_sysdep.h.orig      2003-12-17 08:05:44.000000000 +0000
83 +++ uClibc-0.9.26/ldso/ldso/sparc/ld_sysdep.h   2004-05-27 19:41:50.000000000 +0000
84 @@ -95,9 +95,51 @@
85  /*
86   * Define this if you want a dynamic loader that works on Solaris.
87   */
88 +#ifndef __linux__
89  #define SOLARIS_COMPATIBLE
90 +#endif
91 +
92 +#ifndef COMPILE_ASM
93 +/* Cheap modulo implementation, taken from arm/ld_sysdep.h. */
94 +static inline unsigned long
95 +sparc_mod(unsigned long m, unsigned long p)
96 +{
97 +       unsigned long i, t, inc;
98 +
99 +       i = p;
100 +       t = 0;
101 +
102 +       while (!(i & (1 << 31))) {
103 +               i <<= 1;
104 +               t++;
105 +       }
106 +
107 +       t--;
108 +
109 +       for (inc = t; inc > 2; inc--) {
110 +               i = p << inc;
111 +
112 +               if (i & (1 << 31))
113 +                       break;
114 +
115 +               while (m >= i) {
116 +                       m -= i;
117 +                       i <<= 1;
118 +                       if (i & (1 << 31))
119 +                               break;
120 +                       if (i < p)
121 +                               break;
122 +               }
123 +       }
124 +
125 +       while (m >= p)
126 +               m -= p;
127 +
128 +       return m;
129 +}
130  
131 -#define do_rem(result, n, base)            result = (n % base)
132 +#define do_rem(result, n, base) result = sparc_mod(n, base);
133 +#endif
134  
135  /*
136   * dbx wants the binder to have a specific name.  Mustn't disappoint it.
137 @@ -107,6 +149,7 @@
138  #endif
139  
140  /* 4096 bytes alignment */
141 -#define PAGE_ALIGN 0xfffff000
142 -#define ADDR_ALIGN 0xfff
143 -#define OFFS_ALIGN 0x7ffff000
144 +/* ...but 8192 is required for mmap() on sparc64 kernel */
145 +#define PAGE_ALIGN 0xffffe000
146 +#define ADDR_ALIGN 0x1fff
147 +#define OFFS_ALIGN 0x7fffe000
148 --- uClibc-0.9.26/ldso/ldso/sparc/elfinterp.c.orig      2004-05-25 19:03:47.000000000 +0000
149 +++ uClibc-0.9.26/ldso/ldso/sparc/elfinterp.c   2004-05-27 19:16:15.000000000 +0000
150 @@ -72,7 +72,7 @@
151    /*
152     * Generate the correct relocation index into the .rela.plt section.
153     */
154 -  reloc_entry = (reloc_entry >> 12) - 0xc;
155 +  reloc_entry = (reloc_entry >> 10) - 0xc;
156  
157    this_reloc = (Elf32_Rela *) ((char *) rel_addr + reloc_entry);
158  
159 @@ -82,10 +82,14 @@
160    symtab =  (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
161    strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
162  
163 +#ifdef __SUPPORT_LD_DEBUG__
164 +  if (_dl_debug_symbols) {
165    _dl_dprintf(2, "tpnt = %x\n", tpnt);
166    _dl_dprintf(2, "reloc = %x\n", this_reloc);
167    _dl_dprintf(2, "symtab = %x\n", symtab);
168    _dl_dprintf(2, "strtab = %x\n", strtab);
169 +  }
170 +#endif
171  
172  
173    if (reloc_type != R_SPARC_JMP_SLOT) {
174 @@ -98,10 +102,10 @@
175    instr_addr  = ((int)this_reloc->r_offset  + (int)tpnt->loadaddr);
176    got_addr = (char **) instr_addr;
177  
178 -  _dl_dprintf(2, "symtab_index %d\n", symtab_index);
179 -
180  #ifdef __SUPPORT_LD_DEBUG__
181    if (_dl_debug_symbols) {
182 +  _dl_dprintf(2, "symtab_index %x\n", symtab_index);
183 +
184           _dl_dprintf(2, "Resolving symbol %s\n",
185                           strtab + symtab[symtab_index].st_name);
186    }
187 --- uClibc-0.9.26/ldso/ldso/ldso.c.orig 2004-05-25 19:03:47.000000000 +0000
188 +++ uClibc-0.9.26/ldso/ldso/ldso.c      2004-05-25 21:27:59.000000000 +0000
189 @@ -253,7 +253,7 @@
190         /* Check the ELF header to make sure everything looks ok.  */
191         if (!header || header->e_ident[EI_CLASS] != ELFCLASS32 ||
192                 header->e_ident[EI_VERSION] != EV_CURRENT
193 -#if !defined(__powerpc__) && !defined(__mips__) && !defined(__sh__)
194 +#if !defined(__powerpc__) && !defined(__mips__) && !defined(__sh__) && !defined(__sparc__)
195                 || _dl_strncmp((void *) header, ELFMAGIC, SELFMAG) != 0
196  #else
197                 || header->e_ident[EI_MAG0] != ELFMAG0
198 --- uClibc-0.9.26/ldso/ldso/readelflib1.c.orig  2003-12-17 18:34:15.000000000 +0000
199 +++ uClibc-0.9.26/ldso/ldso/readelflib1.c       2004-05-27 20:41:34.000000000 +0000
200 @@ -725,7 +725,7 @@
201                 _dl_dprintf(2, "\n\tfile='%s';  generating link map\n", libname);
202                 _dl_dprintf(2, "\t\tdynamic: %x  base: %x   size: %x\n", 
203                                 dynamic_addr, libaddr, dynamic_size);
204 -               _dl_dprintf(2, "\t\t  entry: %x  phdr: %x  phnum: %d\n\n", 
205 +               _dl_dprintf(2, "\t\t  entry: %x  phdr: %x  phnum: %x\n\n", 
206                                 epnt->e_entry + libaddr, tpnt->ppnt, tpnt->n_phent);
207  
208         }
This page took 0.036566 seconds and 3 git commands to generate.