Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/glibc/2.14.1: 1200_all_glibc-2.14.1-x32.patch README.history
Date: Tue, 29 Nov 2011 16:01:09
Message-Id: 20111129160043.BB91A2004B@flycatcher.gentoo.org
1 vapier 11/11/29 16:00:43
2
3 Modified: README.history
4 Added: 1200_all_glibc-2.14.1-x32.patch
5 Log:
6 add experimental x32 patch
7
8 Revision Changes Path
9 1.3 src/patchsets/glibc/2.14.1/README.history
10
11 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.14.1/README.history?rev=1.3&view=markup
12 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.14.1/README.history?rev=1.3&content-type=text/plain
13 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.14.1/README.history?r1=1.2&r2=1.3
14
15 Index: README.history
16 ===================================================================
17 RCS file: /var/cvsroot/gentoo/src/patchsets/glibc/2.14.1/README.history,v
18 retrieving revision 1.2
19 retrieving revision 1.3
20 diff -u -r1.2 -r1.3
21 --- README.history 29 Nov 2011 15:59:31 -0000 1.2
22 +++ README.history 29 Nov 2011 16:00:43 -0000 1.3
23 @@ -1,5 +1,6 @@
24 -2 [pending]
25 +2 29 Nov 2011
26 + 0052_all_glibc-2.14-resolv-hp-assert.patch
27 + + 1200_all_glibc-2.14.1-x32.patch
28
29 1 07 Nov 2011
30 + 0020_all_glibc-tweak-rfc1918-lookup.patch
31
32
33
34 1.1 src/patchsets/glibc/2.14.1/1200_all_glibc-2.14.1-x32.patch
35
36 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.14.1/1200_all_glibc-2.14.1-x32.patch?rev=1.1&view=markup
37 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.14.1/1200_all_glibc-2.14.1-x32.patch?rev=1.1&content-type=text/plain
38
39 Index: 1200_all_glibc-2.14.1-x32.patch
40 ===================================================================
41 add x32 support; patch from https://github.com/hjl-tools/glibc
42
43 diff --git a/ChangeLog.backport b/ChangeLog.backport
44 new file mode 100644
45 index 0000000..9e2ce2b
46 --- /dev/null
47 +++ b/ChangeLog.backport
48 @@ -0,0 +1,33 @@
49 +2011-10-08 Roland McGrath <roland@×××××××××.com>
50 +
51 + * sysdeps/unix/sysv/linux/x86_64/time.c: Move #include <dl-vdso.h>
52 + inside [SHARED], where it is used.
53 +
54 +2011-09-06 Andreas Schwab <schwab@××××××.com>
55 +
56 + * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c [!SHARED]: Include
57 + <errno.h>.
58 +
59 +2011-09-06 Ulrich Drepper <drepper@×××××.com>
60 +
61 + * sysdeps/unix/sysv/linux/kernel-features.h: Add entry for getcpu
62 + syscall on x86-64.
63 + * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c [!SHARED]: Use real
64 + syscall.
65 + * sysdeps/unix/sysv/linux/x86_64/time.c: Likewise.
66 + * sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S [!SHARED]: Use real
67 + syscall if possible.
68 +
69 +2011-08-21 Ulrich Drepper <drepper@×××××.com>
70 +
71 + * sysdeps/unix/sysv/linux/x86_64/gettimeofday.S: Removed.
72 + * sysdeps/unix/sysv/linux/x86_64/time.S: Removed.
73 + * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c: New file.
74 + * sysdeps/unix/sysv/linux/x86_64/time.c: New file.
75 + * sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h: Remove declaration
76 + of __vdso_gettimeofday.
77 + * sysdeps/unix/sysv/linux/x86_64/init-first.c: Remove definition of
78 + __vdso_gettimeofday and __vdso_time. Define __vdso_getcpu with
79 + attribute_hidden.
80 + (_libc_vdso_platform_setup): Remove initialization of
81 + __vdso_gettimeofday and __vdso_time.
82 diff --git a/ChangeLog.x32 b/ChangeLog.x32
83 new file mode 100644
84 index 0000000..7a23b1b
85 --- /dev/null
86 +++ b/ChangeLog.x32
87 @@ -0,0 +1,568 @@
88 +2011-11-22 H.J. Lu <hongjiu.lu@×××××.com>
89 +
90 + * sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h: Support
91 + !USE___THREAD.
92 +
93 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
94 +
95 + PR libc/12495
96 + * malloc/malloc.c (sYSMALLOc): Don't update correction with
97 + front_misalign.
98 +
99 +2007-11-30 Daniel Jacobowitz <dan@××××××××××××.com>
100 +
101 + PR libc/12495
102 + * malloc/malloc.c (MALLOC_ALIGNMENT): Use __alignof__ (long double).
103 + (SMALLBIN_CORRECTION): New.
104 + (MIN_LARGE_SIZE, smallbin_index): Use it to handle 16-byte alignment.
105 + (largebin_index_32_big): New.
106 + (largebin_index): Use it for 16-byte alignment.
107 + (sYSMALLOc): Handle MALLOC_ALIGNMENT > 2 * SIZE_SZ.
108 +
109 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
110 +
111 + * stdio-common/_itoa.c (_itoa_base_table): Don't define if
112 + PREFER_LONG_LONG is defined.
113 + (_itoa): Use long long if PREFER_LONG_LONG is defined.
114 + * stdio-common/_itowa.c (_itowa): Likewise.
115 +
116 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
117 +
118 + * sysdeps/x86_64/x32/dl-machine.h: New.
119 +
120 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
121 +
122 + * sysdeps/x86_64/x32/Makefile: New.
123 +
124 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
125 +
126 + * sysdeps/x86_64/x32/divdi3.c: New.
127 + * sysdeps/x86_64/x32/ffs.c: Likewise.
128 + * sysdeps/x86_64/x32/gmp-mparam.h: Likewise.
129 + * sysdeps/x86_64/x32/symbol-hacks.h: Likewise.
130 +
131 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
132 +
133 + * sysdeps/x86_64/stackinfo.h (stackinfo_get_sp): Use RSP_LP.
134 + (stackinfo_sub_sp): Likewise.
135 +
136 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
137 +
138 + * elf/tst-auditmod1.c: Support la_x32_gnu_pltenter and
139 + la_x32_gnu_pltexit.
140 + (pltexit): Cast int_retval to ptrdiff_t.
141 + * elf/tst-auditmod3b.c: Likewise.
142 + * elf/tst-auditmod4b.c: Likewise.
143 + * elf/tst-auditmod5b.c: Likewise.
144 + * elf/tst-auditmod6b.c: Likewise.
145 + * elf/tst-auditmod6c.c: Likewise.
146 + * elf/tst-auditmod7b.c: Likewise.
147 +
148 + * sysdeps/generic/ldsodefs.h (audit_ifaces): Add x32_gnu_pltenter
149 + and x32_gnu_pltexit.
150 +
151 + * sysdeps/x86_64/bits/link.h: Check __x86_64__ instead of
152 + __ELF_NATIVE_CLASS.
153 + (la_x32_gnu_pltenter): New.
154 + (la_x32_gnu_pltexit): Likewise.
155 +
156 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
157 +
158 + * sysdeps/x86_64/dl-machine.h: Replace Elf64_XXX with ElfW(XXX).
159 + Replace ELF64_R_TYPE with ELF32_R_TYPE.
160 + (elf_machine_load_address): Use ASM_ADDR.
161 + (elf_machine_rela): Handle R_X86_64_RELATIVE64 for x32. For x32,
162 + sign extend relocation result to 64bit for R_X86_64_DTPOFF64
163 + and R_X86_64_TPOFF64, and don't process R_X86_64_64.
164 +
165 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
166 +
167 + * sysdeps/x86_64/dl-irel.h: Replace Elf64_XXX with ElfW(XXX).
168 + Replace ELF64_R_TYPE with ELF32_R_TYPE.
169 +
170 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
171 +
172 + * sysdeps/x86_64/dl-tls.h (dl_tls_index): Replace long with
173 + long long.
174 +
175 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
176 +
177 + * sysdeps/x86_64/dl-tlsdesc.h (tlsdesc): Pad for x32.
178 + (dl_tls_index): Replace long with long long.
179 +
180 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
181 +
182 + * sysdeps/x86_64/dl-trampoline.S: Check if RTLD_SAVESPACE_SSE
183 + is 32byte aligned.
184 +
185 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
186 +
187 + * sysdeps/x86_64/fpu/bits/mathinline.h: Don't include
188 + <bits/wordsize.h>.
189 + (__signbitf): Check __x86_64__ instead of __WORDSIZE.
190 + (__signbit): Likwise.
191 +
192 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
193 +
194 + * sysdeps/x86_64/fpu/math_private.h (EXTRACT_WORDS64): Use
195 + long long int instead of long int.
196 + (INSERT_WORDS64): Likwise.
197 +
198 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
199 +
200 + * sysdeps/x86_64/jmpbuf-unwind.h (_JMPBUF_CFA_UNWINDS_ADJ): Cast
201 + _Unwind_GetCFA return to _Unwind_Ptr first.
202 +
203 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
204 +
205 + * sysdeps/x86_64/bits/mathdef.h: Don't include <bits/wordsize.h>.
206 + Check __x86_64__ instead of __WORDSIZE.
207 + * sysdeps/x86_64/bits/setjmp.h: Likewise.
208 + * sysdeps/x86_64/fpu/bits/fenv.h: Likewise.
209 +
210 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
211 +
212 + * sysdeps/x86_64/bits/byteswap.h: Don't include
213 + <bits/wordsize.h>.
214 + (__bswap_32): Check __x86_64__ instead of __WORDSIZE. Also
215 + check __corei7__.
216 + (__bswap_64): Check __x86_64__ instead of __WORDSIZE.
217 +
218 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
219 +
220 + * sysdeps/x86_64/bits/atomic.h (__arch_compare_and_exchange_val_64_acq):
221 + Use long long on 64bit integer.
222 + (__arch_c_compare_and_exchange_val_64_acq): Likewise.
223 + (atomic_exchange_acq): Likewise.
224 + (__arch_exchange_and_add_body): Likewise.
225 + (__arch_add_body): Likewise.
226 + (atomic_add_negative): Likewise.
227 + (atomic_add_zero): Likewise.
228 +
229 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
230 +
231 + * sysdeps/x86_64/multiarch/strcmp.S: Use RXX_LP.
232 +
233 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
234 +
235 + * sysdeps/x86_64/multiarch/memcpy-ssse3.S: Use RXX_LP.
236 +
237 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
238 +
239 + * sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Use RXX_LP.
240 +
241 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
242 +
243 + * sysdeps/x86_64/multiarch/memcmp-sse4.S: Use RXX_LP.
244 +
245 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
246 +
247 + * x86_64/dl-trampoline.h: Use R10_LP to load frame size.
248 +
249 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
250 +
251 + * sysdeps/x86_64/strcmp.S: Use RXX_LP.
252 +
253 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
254 +
255 + * sysdeps/x86_64/memcpy.S: Use RXX_LP.
256 +
257 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
258 +
259 + * sysdeps/x86_64/elf/start.S: Include <sysdep.h>. Simulate
260 + popping 4byte argument count for x32. Use RXX_LP.
261 +
262 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
263 +
264 + * sysdeps/x86_64/__longjmp.S: Use RXX_LP.
265 + * sysdeps/x86_64/setjmp.S: Likewise.
266 +
267 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
268 +
269 + * sysdeps/unix/sysv/linux/x86_64/x32/sysctl.c: New.
270 +
271 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
272 +
273 + * sysdeps/unix/sysv/linux/x86_64/x32/sendfile64.c: New.
274 +
275 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
276 +
277 + * sysdeps/unix/sysv/linux/x86_64/x32/pselect.c: New.
278 +
279 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
280 +
281 + * sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list: New.
282 +
283 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
284 +
285 + * sysdeps/unix/sysv/linux/x86_64/x32/init-first.c: New.
286 +
287 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
288 +
289 + * sysdeps/unix/sysv/linux/x86_64/x32/getdents.c: New.
290 + * sysdeps/unix/sysv/linux/x86_64/x32/llseek.S: Likewise.
291 +
292 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
293 +
294 + * sysdeps/unix/sysv/linux/x86_64/x32/gettimeofday.c: New.
295 + * sysdeps/unix/sysv/linux/x86_64/x32/time.c: Likewise.
296 +
297 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
298 +
299 + * sysdeps/unix/sysv/linux/x86_64/x32/preadv.c: New.
300 + * sysdeps/unix/sysv/linux/x86_64/x32/pwritev.c: Likewise.
301 +
302 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
303 +
304 + * sysdeps/unix/sysv/linux/x86_64/x32/Makefile: New.
305 + * sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c: Likewise.
306 + * sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c:
307 + Likewise.
308 + * sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S: Likewise.
309 +
310 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
311 +
312 + * sysdeps/unix/sysv/linux/x86_64/x32/fallocate.c: New.
313 + * sysdeps/unix/sysv/linux/x86_64/x32/posix_fadvise.c: Likewise.
314 + * sysdeps/unix/sysv/linux/x86_64/x32/posix_fallocate.c: Likewise.
315 +
316 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
317 +
318 + * sysdeps/unix/sysv/linux/x86_64/x32/alphasort.c: New.
319 + * sysdeps/unix/sysv/linux/x86_64/x32/alphasort64.c: Likewise.
320 + * sysdeps/unix/sysv/linux/x86_64/x32/fseeko.c: Likewise.
321 + * sysdeps/unix/sysv/linux/x86_64/x32/fseeko64.c: Likewise.
322 + * sysdeps/unix/sysv/linux/x86_64/x32/ftello.c: Likewise.
323 + * sysdeps/unix/sysv/linux/x86_64/x32/ftello64.c: Likewise.
324 + * sysdeps/unix/sysv/linux/x86_64/x32/ftw.c: Likewise.
325 + * sysdeps/unix/sysv/linux/x86_64/x32/ftw64.c: Likewise.
326 + * sysdeps/unix/sysv/linux/x86_64/x32/glob.c: Likewise.
327 + * sysdeps/unix/sysv/linux/x86_64/x32/iofgetpos.c: Likewise.
328 + * sysdeps/unix/sysv/linux/x86_64/x32/iofgetpos64.c: Likewise.
329 + * sysdeps/unix/sysv/linux/x86_64/x32/iofopen.c: Likewise.
330 + * sysdeps/unix/sysv/linux/x86_64/x32/iofopen64.c: Likewise.
331 + * sysdeps/unix/sysv/linux/x86_64/x32/iofsetpos.c: Likewise.
332 + * sysdeps/unix/sysv/linux/x86_64/x32/iofsetpos64.c: Likewise.
333 + * sysdeps/unix/sysv/linux/x86_64/x32/lockf.c: Likewise.
334 + * sysdeps/unix/sysv/linux/x86_64/x32/lockf64.c: Likewise.
335 + * sysdeps/unix/sysv/linux/x86_64/x32/mkostemp.c: Likewise.
336 + * sysdeps/unix/sysv/linux/x86_64/x32/mkostemp64.c: Likewise.
337 + * sysdeps/unix/sysv/linux/x86_64/x32/mkstemp.c: Likewise.
338 + * sysdeps/unix/sysv/linux/x86_64/x32/mkstemp64.c: Likewise.
339 + * sysdeps/unix/sysv/linux/x86_64/x32/scandir.c: Likewise.
340 + * sysdeps/unix/sysv/linux/x86_64/x32/scandir64.c: Likewise.
341 + * sysdeps/unix/sysv/linux/x86_64/x32/scandirat.c: Likewise.
342 + * sysdeps/unix/sysv/linux/x86_64/x32/scandirat64.c: Likewise.
343 + * sysdeps/unix/sysv/linux/x86_64/x32/tmpfile.c: Likewise.
344 + * sysdeps/unix/sysv/linux/x86_64/x32/tmpfile64.c: Likewise.
345 + * sysdeps/unix/sysv/linux/x86_64/x32/versionsort.c: Likewise.
346 + * sysdeps/unix/sysv/linux/x86_64/x32/versionsort64.c: Likewise.
347 +
348 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
349 +
350 + * sysdeps/unix/sysv/linux/x86_64/x32/dl-cache.h: New.
351 +
352 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
353 +
354 + * sysdeps/unix/sysv/linux/x86_64/sigaction.c (RESTORE2): Replace
355 + 8byte data alignment with LP_SIZE alignment.
356 +
357 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
358 +
359 + * sysdeps/unix/sysv/linux/x86_64/clone.S: Load pointer to TID
360 + into R10_LP.
361 +
362 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
363 +
364 + * sysdeps/unix/sysv/linux/x86_64/Makefile (gen-as-const-headers):
365 + Add sigaltstack.sym.
366 +
367 + * sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: Include
368 + "sigaltstack.h".
369 + (____longjmp_chk): Use RXX_LP, sizeSS, oSS_FLAGS, oSS_SP and
370 + oSS_SIZE for alternate signal stack.
371 +
372 + * sysdeps/unix/sysv/linux/x86_64/sigaltstack.sym: New.
373 +
374 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
375 +
376 + * sysdeps/unix/sysv/linux/x86_64/makecontext.c (__makecontext):
377 + Use "unsigned long long int" instead of "unsigned long int".
378 +
379 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
380 +
381 + * sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h: Include
382 + <stdint.h>.
383 + (GET_PC): Cast to uintptr_t first.
384 + (GET_FRAME): Likewise.
385 + (GET_STACK): Likewise.
386 +
387 + * sysdeps/unix/sysv/linux/x86_64/sys/debugreg.h: Don't include
388 + <bits/wordsize.h>. Check __x86_64__ instead of __WORDSIZE.
389 + (DR_CONTROL_RESERVED): Use ULL instead of UL suffix.
390 +
391 + * sysdeps/unix/sysv/linux/x86_64/sys/procfs.h (elf_greg_t): Use
392 + "unsigned long long int" if __x86_64__ is defined.
393 + Check __x86_64__ instead of __WORDSIZE.
394 + (elf_prstatus): Use "unsigned long long int" instead of
395 + "unsigned long int" if __x86_64__ is defined.
396 +
397 + * sysdeps/unix/sysv/linux/x86_64/sys/reg.h: Don't
398 + include <bits/wordsize.h>. Check __x86_64__ instead of
399 + __WORDSIZE.
400 +
401 + * sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h: Don't
402 + include <bits/wordsize.h>. Check __x86_64__ instead of
403 + __WORDSIZE.
404 + (greg_t): Use "long long int" if __x86_64__ is defined.
405 + (mcontext_t): Replace "unsigned long" with "unsigned long long".
406 + (ucontext_t): Likewise.
407 +
408 + * sysdeps/unix/sysv/linux/x86_64/sys/user.h: Don't
409 + include <bits/wordsize.h>. Check __x86_64__ instead of
410 + __WORDSIZE.
411 + (user_regs_struct): Use "unsigned long long" instead of
412 + "unsigned long" if __x86_64__ is defined.
413 + (user): Likewise. Pad if __LP64__ isn't defined.
414 +
415 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
416 +
417 + * sysdeps/unix/sysv/linux/x86_64/sys/msg.h: New.
418 +
419 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
420 +
421 + * sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed: Support x32.
422 +
423 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
424 +
425 + * sysdeps/x86_64/bits/wordsize.h: Moved to ...
426 + * sysdeps/x86_64/64/bits/wordsize.h: Here.
427 + (__WORDSIZE_COMPAT32): Removed.
428 +
429 + * sysdeps/x86_64/x32/bits/wordsize.h: New.
430 +
431 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
432 +
433 + * sysdeps/unix/sysv/linux/x86_64/Implies: Moved to ...
434 + * sysdeps/unix/sysv/linux/x86_64/64/Implies: Here.
435 +
436 + * sysdeps/x86_64/Implies: Moved to ...
437 + * sysdeps/x86_64/64/Implies: Here. Prepend x86_64/fpu.
438 +
439 + * sysdeps/unix/sysv/linux/x86_64/x32/Implies: New.
440 + * sysdeps/x86_64/x32/Implies: Likewise.
441 +
442 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
443 +
444 + * sysdeps/unix/sysv/linux/x86_64/bits/a.out.h: Don't include
445 + <bits/wordsize.h>. Check __x86_64__ instead of __WORDSIZE.
446 + * sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: Likewise.
447 +
448 + * sysdeps/unix/sysv/linux/x86_64/bits/msq.h: Don't include
449 + <bits/wordsize.h>.
450 + (msgqnum_t): Use __UNATIVE_LONG_TYPE.
451 + (msglen_t): Likewise.
452 + (msqid_ds): Check __x86_64__ instead of __WORDSIZE. Use
453 + __UNATIVE_LONG_TYPE.
454 +
455 + * sysdeps/unix/sysv/linux/x86_64/bits/sem.h (semid_ds): Use
456 + __UNATIVE_LONG_TYPE.
457 +
458 + * sysdeps/unix/sysv/linux/x86_64/bits/shm.h (shmatt_t): Use
459 + __UNATIVE_LONG_TYPE.
460 + (shmid_ds): Add __unused1 and __unused2 only if __x86_64__ isn't
461 + defined. Use __UNATIVE_LONG_TYPE.
462 + (shminfo): Use __UNATIVE_LONG_TYPE.
463 + (shm_info): Likewise.
464 +
465 + * sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h: Don't
466 + include <bits/wordsize.h>. Check __x86_64__ instead of
467 + __WORDSIZE.
468 + (sigcontext): Use "unsigned long long int" instead of
469 + "unsigned long int" if __x86_64__ is defined. Pad if __LP64__
470 + isn't defined.
471 +
472 + * sysdeps/unix/sysv/linux/x86_64/bits/stat.h (_STAT_VER_SVR4):
473 + Check __x86_64__ instead of __WORDSIZE.
474 + (_STAT_VER_LINUX): Likewise.
475 + (stat): Check __x86_64__ instead of __WORDSIZE. Use
476 + __UNATIVE_LONG_TYPE.
477 + (stat64): Likewise.
478 +
479 + * sysdeps/unix/sysv/linux/x86_64/bits/ipc.h: New.
480 + * sysdeps/unix/sysv/linux/x86_64/bits/ipctypes.h: Likewise.
481 + * sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h: Likewise.
482 + * sysdeps/unix/sysv/linux/x86_64/bits/resource.h: Likewise.
483 + * sysdeps/unix/sysv/linux/x86_64/bits/statfs.h: Likewise.
484 + * sysdeps/unix/sysv/linux/x86_64/bits/statvfs.h: Likewise.
485 + * sysdeps/unix/sysv/linux/x86_64/bits/timex.h: Likewise.
486 + * sysdeps/unix/sysv/linux/x86_64/bits/utmp.h: Likewise.
487 + * sysdeps/unix/sysv/linux/x86_64/bits/utmpx.h: Likewise.
488 +
489 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
490 +
491 + * elf/tls-macros.h (TLS_LE): Use mov instead of movq to load
492 + thread pointer.
493 + (TLS_IE): Use mov/add instead of movq/addq to load thread
494 + pointer.
495 + (TLS_GD_PREFIX): New.
496 + (TLS_GD): Use it.
497 +
498 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
499 +
500 + * elf/stackguard-macros.h (STACK_CHK_GUARD): Add x32 version.
501 +
502 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
503 +
504 + * elf/cache.c (print_entry): Handle FLAG_X8664_LIBX32.
505 +
506 + * sysdeps/generic/ldconfig.h (FLAG_X8664_LIBX32): New.
507 +
508 + * sysdeps/unix/sysv/linux/i386/readelflib.c (process_elf_file):
509 + Handle x32 libraries.
510 + * sysdeps/unix/sysv/linux/x86_64/readelflib.c (process_elf_file):
511 + Likewise.
512 +
513 + * sysdeps/unix/sysv/linux/x86_64/dl-cache.h (add_system_dir): New
514 + Don't include <sysdeps/unix/sysv/linux/sparc/dl-cache.h>.
515 +
516 + * sysdeps/unix/sysv/linux/x86_64/ldconfig.h
517 + (SYSDEP_KNOWN_INTERPRETER_NAMES): Add /libx32/ld-linux-x32.so.2.
518 +
519 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
520 +
521 + * stdlib/longlong.h (count_leading_zeros): Use long long builtin
522 + for x86-64.
523 + (count_trailing_zeros): Likewise.
524 +
525 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
526 +
527 + * elf/elf.h (R_X86_64_RELATIVE64): New.
528 + (R_X86_64_NUM): Updated.
529 +
530 +2011-11-18 H.J. Lu <hongjiu.lu@×××××.com>
531 +
532 + * sysdeps/x86_64/ffsll.c: Add ffsl alias only if __LP64__ is
533 + defined.
534 +
535 +2011-11-18 H.J. Lu <hongjiu.lu@×××××.com>
536 +
537 + * sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Moved to ...
538 + * sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c: This. Updated.
539 +
540 + * sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Empty file.
541 +
542 +2011-11-18 H.J. Lu <hongjiu.lu@×××××.com>
543 +
544 + * time/mktime.c (ydhms_diff): Check TIME_T_MAX instead of
545 + LONG_MAX.
546 +
547 + * time/offtime.c (__offtime): Add more overflow check.
548 +
549 +2011-11-18 H.J. Lu <hongjiu.lu@×××××.com>
550 +
551 + * bits/types.h (__snseconds_t): New.
552 + * bits/typesizes.h (__SNSECONDS_T_TYPE): Likewise.
553 + * sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h (__SNSECONDS_T_TYPE):
554 + Likewise.
555 + * sysdeps/unix/sysv/linux/s390/bits/typesizes.h (__SNSECONDS_T_TYPE):
556 + Likewise.
557 + * sysdeps/unix/sysv/linux/sparc/bits/typesizes.h (__SNSECONDS_T_TYPE):
558 + Likewise.
559 +
560 + * time/time.h (timespec): Use __snseconds_t on tv_nsec.
561 +
562 +2011-11-18 H.J. Lu <hongjiu.lu@×××××.com>
563 +
564 + * sysdeps/unix/sysv/linux/x86_64/sysdep.h
565 + (VSYSCALL_ADDR_vgettimeofday): New.
566 + (VSYSCALL_ADDR_vtime): Likewise.
567 + (VSYSCALL_ADDR_vgetcpu): Likewise.
568 +
569 + * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
570 + (VSYSCALL_ADDR_vgettimeofday): Removed.
571 + * sysdeps/unix/sysv/linux/x86_64/init-first.c
572 + (VSYSCALL_ADDR_vgetcpu): Likewise.
573 + * sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
574 + (VSYSCALL_ADDR_vgetcpu): Likewise.
575 + * sysdeps/unix/sysv/linux/x86_64/time.c (VSYSCALL_ADDR_vtime):
576 + Likewise.
577 +
578 + * sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h: New.
579 + * sysdeps/x86_64/x32/sysdep.h: Likewise.
580 +
581 + * sysdeps/x86_64/sysdep.h (LP_SIZE): New.
582 + (MOVE_LP): Likewise.
583 + (ADD_LP): Likewise.
584 + (SUB_LP): Likewise.
585 + (CMP_LP): Likewise.
586 + (ASM_ADDR): Likewise.
587 + (RAX_LP): New.
588 + (RBP_LP): Likewise.
589 + (RBX_LP): Likewise.
590 + (RCX_LP): Likewise.
591 + (RDI_LP): Likewise.
592 + (RSI_LP): Likewise.
593 + (RSP_LP): Likewise.
594 + (R8_LP): Likewise.
595 + (R9_LP): Likewise.
596 + (R10_LP): Likewise.
597 + (R10_LP): Likewise.
598 + (R11_LP): Likewise.
599 + (R12_LP): Likewise.
600 + (R13_LP): Likewise.
601 + (R14_LP): Likewise.
602 + (R15_LP): Likewise.
603 +
604 +2011-11-18 H.J. Lu <hongjiu.lu@×××××.com>
605 +
606 + * shlib-versions: Move ld name for x86_64-.*-linux.* to ...
607 + * sysdeps/x86_64/64/shlib-versions: Here. New.
608 +
609 + * sysdeps/x86_64/x32/shlib-versions: New.
610 +
611 +2011-11-18 H.J. Lu <hongjiu.lu@×××××.com>
612 +
613 + * Makeconfig ($(common-objpfx)gnu/lib-names.stmp): Depend on
614 + $(lib-names_awk) instead of scripts/lib-names.awk.
615 +
616 + * Makefile ($(inst_includedir)/gnu/stubs.h): Depend on
617 + $(stubs-biarch_h) instead of include/stubs-biarch.h.
618 + (data-machine): New.
619 + (check-data): Use it.
620 +
621 + * config.make.in (data-machine): New.
622 + (stubs-biarch_h): Likewise.
623 + (lib-names_awk): Likewise.
624 + (use-default-syscall-macros): Likewise.
625 +
626 + * configure.in: Add sysdeps preconfigure fragment support.
627 + (data_machine): Substitute.
628 + (stubs_biarch_h): Set to include/stubs-biarch.h if not set.
629 + Substitute.
630 + (lib_names_awk): Set to scripts/lib-names.awk if not set.
631 + Substitute.
632 + (use_default_syscall_macros): Set to yes if not set.
633 + Substitute.
634 + * configure: Regenerated.
635 +
636 + * scripts/data/c++-types-x32-linux-gnu.data: New.
637 + * sysdeps/unix/sysv/linux/x86_64/stubs-triarch.h: Likewise.
638 + * sysdeps/x86_64/lib-names.awk: Likewise.
639 + * sysdeps/x86_64/preconfigure: Likewise.
640 + * sysdeps/x86_64/stubs-biarch.h: Likewise.
641 +
642 + * sysdeps/unix/sysv/linux/Makefile ($(objpfx)syscall-%.h
643 + $(objpfx)syscall-%.d): Defined only if
644 + $(use-default-syscall-macros) is set to yes.
645 +
646 + * sysdeps/unix/sysv/linux/configure.in: Require kernel 2.6.35
647 + or above for x32. Check x86_64/x64 instead of x86_64.
648 + * sysdeps/unix/sysv/linux/configure: Regenerated.
649 +
650 + * sysdeps/x86_64/preconfigure (stubs_biarch_h): Set to
651 + sysdeps/x86_64/stubs-biarch.h.
652 +
653 + * sysdeps/unix/sysv/linux/x86_64/Makefile (64bit-predefine): Add
654 + __LP64__.
655 + ($(objpfx)syscall-%.h $(objpfx)syscall-%.d): New.
656 diff --git a/Makeconfig b/Makeconfig
657 index b34cacf..ad6354b 100644
658 --- a/Makeconfig
659 +++ b/Makeconfig
660 @@ -885,7 +885,7 @@ postclean-generated += soversions.mk soversions.i \
661 before-compile += $(common-objpfx)gnu/lib-names.h
662 ifeq ($(soversions.mk-done),t)
663 $(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @:
664 -$(common-objpfx)gnu/lib-names.stmp: $(..)scripts/lib-names.awk \
665 +$(common-objpfx)gnu/lib-names.stmp: $(..)$(lib-names_awk) \
666 $(common-objpfx)soversions.i
667 $(make-target-directory)
668 @rm -f ${@:stmp=T} $@
669 diff --git a/Makefile b/Makefile
670 index ea7a5b5..7c57213 100644
671 --- a/Makefile
672 +++ b/Makefile
673 @@ -178,7 +178,7 @@ installed-stubs = $(inst_includedir)/gnu/stubs.h
674 else
675 installed-stubs = $(inst_includedir)/gnu/stubs-$(biarch).h
676
677 -$(inst_includedir)/gnu/stubs.h: include/stubs-biarch.h $(+force)
678 +$(inst_includedir)/gnu/stubs.h: $(stubs-biarch_h) $(+force)
679 $(make-target-directory)
680 $(INSTALL_DATA) $< $@
681
682 @@ -260,13 +260,15 @@ tests-clean:
683
684 tests: $(objpfx)c++-types-check.out $(objpfx)check-local-headers.out
685 ifneq ($(CXX),no)
686 +ifeq ($(data-machine),)
687 +data-machine = $(config-machine) $(base-machine)
688 +endif
689 check-data := $(firstword $(wildcard \
690 $(foreach D,$(add-ons) scripts,\
691 $(patsubst %,$D/data/c++-types-%.data,\
692 $(abi-name) \
693 $(addsuffix -$(config-os),\
694 - $(config-machine) \
695 - $(base-machine))))))
696 + $(data-machine))))))
697 ifneq (,$(check-data))
698 $(objpfx)c++-types-check.out: $(check-data) scripts/check-c++-types.sh
699 scripts/check-c++-types.sh $< $(CXX) $(filter-out -std=gnu99 -Wstrict-prototypes,$(CFLAGS)) $(CPPFLAGS) > $@
700 diff --git a/bits/types.h b/bits/types.h
701 index 3ebe82f..d6915d7 100644
702 --- a/bits/types.h
703 +++ b/bits/types.h
704 @@ -149,6 +149,7 @@ __STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */
705 __STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */
706 __STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */
707 __STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */
708 +__STD_TYPE __SNSECONDS_T_TYPE __snseconds_t; /* Signed count of nanoseconds. */
709
710 __STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */
711 __STD_TYPE __SWBLK_T_TYPE __swblk_t; /* Type of a swap block maybe? */
712 diff --git a/bits/typesizes.h b/bits/typesizes.h
713 index e9226c4..63ef936 100644
714 --- a/bits/typesizes.h
715 +++ b/bits/typesizes.h
716 @@ -1,5 +1,6 @@
717 /* bits/typesizes.h -- underlying types for *_t. Generic version.
718 - Copyright (C) 2002, 2003 Free Software Foundation, Inc.
719 + Copyright (C) 2002, 2003, 2011
720 + Free Software Foundation, Inc.
721 This file is part of the GNU C Library.
722
723 The GNU C Library is free software; you can redistribute it and/or
724 @@ -58,6 +59,7 @@
725 #define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
726 #define __FSID_T_TYPE struct { int __val[2]; }
727 #define __SSIZE_T_TYPE __SWORD_TYPE
728 +#define __SNSECONDS_T_TYPE __SLONGWORD_TYPE
729
730 /* Number of descriptors that can fit in an `fd_set'. */
731 #define __FD_SETSIZE 1024
732 diff --git a/config.make.in b/config.make.in
733 index d722a8b..3656be3 100644
734 --- a/config.make.in
735 +++ b/config.make.in
736 @@ -28,6 +28,7 @@ ldd-rewrite-script = @ldd_rewrite_script@
737 # System configuration.
738 config-machine = @host_cpu@
739 base-machine = @base_machine@
740 +data-machine = @data_machine@
741 config-vendor = @host_vendor@
742 config-os = @host_os@
743 config-sysdirs = @sysnames@
744 @@ -78,6 +79,10 @@ no-whole-archive = @no_whole_archive@
745 exceptions = @exceptions@
746 multi-arch = @multi_arch@
747
748 +stubs-biarch_h = @stubs_biarch_h@
749 +lib-names_awk = @lib_names_awk@
750 +use-default-syscall-macros = @use_default_syscall_macros@
751 +
752 mach-interface-list = @mach_interface_list@
753
754 have-bash2 = @libc_cv_have_bash2@
755 diff --git a/configure b/configure
756 index 6cf85e5..91a514d 100755
757 --- a/configure
758 +++ b/configure
759 @@ -599,6 +599,9 @@ ac_subst_vars='LTLIBOBJS
760 LIBOBJS
761 RELEASE
762 VERSION
763 +use_default_syscall_macros
764 +lib_names_awk
765 +stubs_biarch_h
766 mach_interface_list
767 DEFINES
768 nopic_initfini
769 @@ -679,6 +682,7 @@ sysdeps_add_ons
770 sysnames
771 submachine
772 multi_arch
773 +data_machine
774 base_machine
775 add_on_subdirs
776 add_ons
777 @@ -4106,6 +4110,17 @@ if test "$base_machine" = "i386"; then
778
779 fi
780
781 +# Now run sysdeps preconfigure fragment.
782 +preconfigure=$srcdir/sysdeps/$base_machine/preconfigure
783 +if test -r $preconfigure; then
784 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: running preconfigure fragment for $base_machine" >&5
785 +$as_echo "running preconfigure fragment for $base_machine" >&6; }
786 + . $preconfigure
787 +fi
788 +
789 +# sysdeps preconfigure fragment may set data_machine.
790 +
791 +
792 # For the multi-arch option we need support in the assembler.
793 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler gnu_indirect_function symbol type support" >&5
794 $as_echo_n "checking for assembler gnu_indirect_function symbol type support... " >&6; }
795 @@ -7732,6 +7747,21 @@ $as_echo "$libc_cv_pic_default" >&6; }
796
797
798
799 +if test -z "${stubs_biarch_h}"; then
800 + stubs_biarch_h=include/stubs-biarch.h
801 +fi
802 +
803 +
804 +if test -z "${lib_names_awk}"; then
805 + lib_names_awk=scripts/lib-names.awk
806 +fi
807 +
808 +
809 +if test -z "${use_default_syscall_macros}"; then
810 + use_default_syscall_macros=yes
811 +fi
812 +
813 +
814 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
815 config_makefile=
816 else
817 diff --git a/configure.in b/configure.in
818 index fbc64b9..3744d5c 100644
819 --- a/configure.in
820 +++ b/configure.in
821 @@ -600,6 +600,16 @@ if test "$base_machine" = "i386"; then
822 AC_DEFINE(USE_REGPARMS)
823 fi
824
825 +# Now run sysdeps preconfigure fragment.
826 +preconfigure=$srcdir/sysdeps/$base_machine/preconfigure
827 +if test -r $preconfigure; then
828 + AC_MSG_RESULT(running preconfigure fragment for $base_machine)
829 + . $preconfigure
830 +fi
831 +
832 +# sysdeps preconfigure fragment may set data_machine.
833 +AC_SUBST(data_machine)
834 +
835 # For the multi-arch option we need support in the assembler.
836 AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support],
837 libc_cv_asm_gnu_indirect_function, [dnl
838 @@ -2266,6 +2276,21 @@ AC_SUBST(DEFINES)
839 dnl See sysdeps/mach/configure.in for this variable.
840 AC_SUBST(mach_interface_list)
841
842 +if test -z "${stubs_biarch_h}"; then
843 + stubs_biarch_h=include/stubs-biarch.h
844 +fi
845 +AC_SUBST(stubs_biarch_h)
846 +
847 +if test -z "${lib_names_awk}"; then
848 + lib_names_awk=scripts/lib-names.awk
849 +fi
850 +AC_SUBST(lib_names_awk)
851 +
852 +if test -z "${use_default_syscall_macros}"; then
853 + use_default_syscall_macros=yes
854 +fi
855 +AC_SUBST(use_default_syscall_macros)
856 +
857 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
858 config_makefile=
859 else
860 diff --git a/elf/cache.c b/elf/cache.c
861 index 0988593..8881ccc 100644
862 --- a/elf/cache.c
863 +++ b/elf/cache.c
864 @@ -91,6 +91,10 @@ print_entry (const char *lib, int flag, unsigned int osversion,
865 break;
866 case FLAG_MIPS64_LIBN64:
867 fputs (",64bit", stdout);
868 + break;
869 + case FLAG_X8664_LIBX32:
870 + fputs (",x32", stdout);
871 + break;
872 case 0:
873 break;
874 default:
875 diff --git a/elf/elf.h b/elf/elf.h
876 index ca5abbf..0f87b4e 100644
877 --- a/elf/elf.h
878 +++ b/elf/elf.h
879 @@ -2712,8 +2712,9 @@ typedef Elf32_Addr Elf32_Conflict;
880 descriptor. */
881 #define R_X86_64_TLSDESC 36 /* TLS descriptor. */
882 #define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */
883 +#define R_X86_64_RELATIVE64 38 /* 64bit adjust by program base */
884
885 -#define R_X86_64_NUM 38
886 +#define R_X86_64_NUM 39
887
888
889 /* AM33 relocations. */
890 diff --git a/elf/stackguard-macros.h b/elf/stackguard-macros.h
891 index 97db8bc..8b85425 100644
892 --- a/elf/stackguard-macros.h
893 +++ b/elf/stackguard-macros.h
894 @@ -4,8 +4,13 @@
895 # define STACK_CHK_GUARD \
896 ({ uintptr_t x; asm ("movl %%gs:0x14, %0" : "=r" (x)); x; })
897 #elif defined __x86_64__
898 -# define STACK_CHK_GUARD \
899 +# ifdef __LP64__
900 +# define STACK_CHK_GUARD \
901 ({ uintptr_t x; asm ("movq %%fs:0x28, %0" : "=r" (x)); x; })
902 +# else
903 +# define STACK_CHK_GUARD \
904 + ({ uintptr_t x; asm ("movl %%fs:0x18, %0" : "=r" (x)); x; })
905 +# endif
906 #elif defined __powerpc64__
907 # define STACK_CHK_GUARD \
908 ({ uintptr_t x; asm ("ld %0,-28688(13)" : "=r" (x)); x; })
909 diff --git a/elf/tls-macros.h b/elf/tls-macros.h
910 index 781256d..947e2bb 100644
911 --- a/elf/tls-macros.h
912 +++ b/elf/tls-macros.h
913 @@ -101,15 +101,15 @@
914
915 # define TLS_LE(x) \
916 ({ int *__l; \
917 - asm ("movq %%fs:0,%0\n\t" \
918 - "leaq " #x "@tpoff(%0), %0" \
919 + asm ("mov %%fs:0,%0\n\t" \
920 + "lea " #x "@tpoff(%0), %0" \
921 : "=r" (__l)); \
922 __l; })
923
924 # define TLS_IE(x) \
925 ({ int *__l; \
926 - asm ("movq %%fs:0,%0\n\t" \
927 - "addq " #x "@gottpoff(%%rip),%0" \
928 + asm ("mov %%fs:0,%0\n\t" \
929 + "add " #x "@gottpoff(%%rip),%0" \
930 : "=r" (__l)); \
931 __l; })
932
933 @@ -122,9 +122,15 @@
934 : : "rdi", "rsi", "r8", "r9", "r10", "r11"); \
935 __l; })
936
937 +# ifdef __LP64__
938 +# define TLS_GD_PREFIX ".byte 0x66\n\t"
939 +# else
940 +# define TLS_GD_PREFIX
941 +# endif
942 +
943 # define TLS_GD(x) \
944 ({ int *__l, __c, __d; \
945 - asm (".byte 0x66\n\t" \
946 + asm (TLS_GD_PREFIX \
947 "leaq " #x "@tlsgd(%%rip),%%rdi\n\t" \
948 ".word 0x6666\n\t" \
949 "rex64\n\t" \
950 diff --git a/elf/tst-auditmod1.c b/elf/tst-auditmod1.c
951 index 2d39df2..15a8e34 100644
952 --- a/elf/tst-auditmod1.c
953 +++ b/elf/tst-auditmod1.c
954 @@ -109,8 +109,13 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
955 # define La_retval La_i86_retval
956 # define int_retval lrv_eax
957 #elif defined __x86_64__
958 -# define pltenter la_x86_64_gnu_pltenter
959 -# define pltexit la_x86_64_gnu_pltexit
960 +# ifdef __LP64__
961 +# define pltenter la_x86_64_gnu_pltenter
962 +# define pltexit la_x86_64_gnu_pltexit
963 +# else
964 +# define pltenter la_x32_gnu_pltenter
965 +# define pltexit la_x32_gnu_pltexit
966 +# endif
967 # define La_regs La_x86_64_regs
968 # define La_retval La_x86_64_retval
969 # define int_retval lrv_rax
970 @@ -194,7 +199,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
971 const char *symname)
972 {
973 printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
974 - symname, (long int) sym->st_value, ndx, outregs->int_retval);
975 + symname, (long int) sym->st_value, ndx,
976 + (ptrdiff_t) outregs->int_retval);
977
978 return 0;
979 }
980 diff --git a/elf/tst-auditmod3b.c b/elf/tst-auditmod3b.c
981 index 388ed6e..d1bb9b0 100644
982 --- a/elf/tst-auditmod3b.c
983 +++ b/elf/tst-auditmod3b.c
984 @@ -105,8 +105,13 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
985 return sym->st_value;
986 }
987
988 -#define pltenter la_x86_64_gnu_pltenter
989 -#define pltexit la_x86_64_gnu_pltexit
990 +#ifdef __LP64__
991 +# define pltenter la_x86_64_gnu_pltenter
992 +# define pltexit la_x86_64_gnu_pltexit
993 +#else
994 +# define pltenter la_x32_gnu_pltenter
995 +# define pltexit la_x32_gnu_pltexit
996 +#endif
997 #define La_regs La_x86_64_regs
998 #define La_retval La_x86_64_retval
999 #define int_retval lrv_rax
1000 @@ -140,7 +145,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
1001 const char *symname)
1002 {
1003 printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
1004 - symname, (long int) sym->st_value, ndx, outregs->int_retval);
1005 + symname, (long int) sym->st_value, ndx,
1006 + (ptrdiff_t) outregs->int_retval);
1007
1008 __m128i xmm = _mm_set1_epi32 (-1);
1009 asm volatile ("movdqa %0, %%xmm0" : : "x" (xmm) : "xmm0" );
1010 diff --git a/elf/tst-auditmod4b.c b/elf/tst-auditmod4b.c
1011 index a6d3c6a..93f107f 100644
1012 --- a/elf/tst-auditmod4b.c
1013 +++ b/elf/tst-auditmod4b.c
1014 @@ -94,8 +94,13 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
1015 return sym->st_value;
1016 }
1017
1018 -#define pltenter la_x86_64_gnu_pltenter
1019 -#define pltexit la_x86_64_gnu_pltexit
1020 +#ifdef __LP64__
1021 +# define pltenter la_x86_64_gnu_pltenter
1022 +# define pltexit la_x86_64_gnu_pltexit
1023 +#else
1024 +# define pltenter la_x32_gnu_pltenter
1025 +# define pltexit la_x32_gnu_pltexit
1026 +#endif
1027 #define La_regs La_x86_64_regs
1028 #define La_retval La_x86_64_retval
1029 #define int_retval lrv_rax
1030 @@ -177,7 +182,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
1031 const char *symname)
1032 {
1033 printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
1034 - symname, (long int) sym->st_value, ndx, outregs->int_retval);
1035 + symname, (long int) sym->st_value, ndx,
1036 + (ptrdiff_t) outregs->int_retval);
1037
1038 #ifdef __AVX__
1039 if (check_avx () && strcmp (symname, "audit_test") == 0)
1040 diff --git a/elf/tst-auditmod5b.c b/elf/tst-auditmod5b.c
1041 index 7e1e941..78fe838 100644
1042 --- a/elf/tst-auditmod5b.c
1043 +++ b/elf/tst-auditmod5b.c
1044 @@ -95,8 +95,13 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
1045 return sym->st_value;
1046 }
1047
1048 -#define pltenter la_x86_64_gnu_pltenter
1049 -#define pltexit la_x86_64_gnu_pltexit
1050 +#ifdef __LP64__
1051 +# define pltenter la_x86_64_gnu_pltenter
1052 +# define pltexit la_x86_64_gnu_pltexit
1053 +#else
1054 +# define pltenter la_x32_gnu_pltenter
1055 +# define pltexit la_x32_gnu_pltexit
1056 +#endif
1057 #define La_regs La_x86_64_regs
1058 #define La_retval La_x86_64_retval
1059 #define int_retval lrv_rax
1060 @@ -150,7 +155,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
1061 const char *symname)
1062 {
1063 printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
1064 - symname, (long int) sym->st_value, ndx, outregs->int_retval);
1065 + symname, (long int) sym->st_value, ndx,
1066 + (ptrdiff_t) outregs->int_retval);
1067
1068 __m128i xmm;
1069
1070 diff --git a/elf/tst-auditmod6b.c b/elf/tst-auditmod6b.c
1071 index f756b50..048dd7a 100644
1072 --- a/elf/tst-auditmod6b.c
1073 +++ b/elf/tst-auditmod6b.c
1074 @@ -94,8 +94,13 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
1075 return sym->st_value;
1076 }
1077
1078 -#define pltenter la_x86_64_gnu_pltenter
1079 -#define pltexit la_x86_64_gnu_pltexit
1080 +#ifdef __LP64__
1081 +# define pltenter la_x86_64_gnu_pltenter
1082 +# define pltexit la_x86_64_gnu_pltexit
1083 +#else
1084 +# define pltenter la_x32_gnu_pltenter
1085 +# define pltexit la_x32_gnu_pltexit
1086 +#endif
1087 #define La_regs La_x86_64_regs
1088 #define La_retval La_x86_64_retval
1089 #define int_retval lrv_rax
1090 @@ -179,7 +184,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
1091 const char *symname)
1092 {
1093 printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
1094 - symname, (long int) sym->st_value, ndx, outregs->int_retval);
1095 + symname, (long int) sym->st_value, ndx,
1096 + (ptrdiff_t) outregs->int_retval);
1097
1098 #ifdef __AVX__
1099 if (check_avx () && strcmp (symname, "audit_test") == 0)
1100 diff --git a/elf/tst-auditmod6c.c b/elf/tst-auditmod6c.c
1101 index 49cbf05..81cbaa1 100644
1102 --- a/elf/tst-auditmod6c.c
1103 +++ b/elf/tst-auditmod6c.c
1104 @@ -94,8 +94,13 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
1105 return sym->st_value;
1106 }
1107
1108 -#define pltenter la_x86_64_gnu_pltenter
1109 -#define pltexit la_x86_64_gnu_pltexit
1110 +#ifdef __LP64__
1111 +# define pltenter la_x86_64_gnu_pltenter
1112 +# define pltexit la_x86_64_gnu_pltexit
1113 +#else
1114 +# define pltenter la_x32_gnu_pltenter
1115 +# define pltexit la_x32_gnu_pltexit
1116 +#endif
1117 #define La_regs La_x86_64_regs
1118 #define La_retval La_x86_64_retval
1119 #define int_retval lrv_rax
1120 @@ -185,7 +190,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
1121 const char *symname)
1122 {
1123 printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
1124 - symname, (long int) sym->st_value, ndx, outregs->int_retval);
1125 + symname, (long int) sym->st_value, ndx,
1126 + (ptrdiff_t) outregs->int_retval);
1127
1128 #ifdef __AVX__
1129 if (check_avx () && strcmp (symname, "audit_test") == 0)
1130 diff --git a/elf/tst-auditmod7b.c b/elf/tst-auditmod7b.c
1131 index eb23758..91c4b7a 100644
1132 --- a/elf/tst-auditmod7b.c
1133 +++ b/elf/tst-auditmod7b.c
1134 @@ -94,8 +94,13 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
1135 return sym->st_value;
1136 }
1137
1138 -#define pltenter la_x86_64_gnu_pltenter
1139 -#define pltexit la_x86_64_gnu_pltexit
1140 +#ifdef __LP64__
1141 +# define pltenter la_x86_64_gnu_pltenter
1142 +# define pltexit la_x86_64_gnu_pltexit
1143 +#else
1144 +# define pltenter la_x32_gnu_pltenter
1145 +# define pltexit la_x32_gnu_pltexit
1146 +#endif
1147 #define La_regs La_x86_64_regs
1148 #define La_retval La_x86_64_retval
1149 #define int_retval lrv_rax
1150 @@ -177,7 +182,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
1151 const char *symname)
1152 {
1153 printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
1154 - symname, (long int) sym->st_value, ndx, outregs->int_retval);
1155 + symname, (long int) sym->st_value, ndx,
1156 + (ptrdiff_t) outregs->int_retval);
1157
1158 #ifdef __AVX__
1159 if (check_avx () && strcmp (symname, "audit_test") == 0)
1160 diff --git a/malloc/malloc.c b/malloc/malloc.c
1161 index dccb6cc..66a0e09 100644
1162 --- a/malloc/malloc.c
1163 +++ b/malloc/malloc.c
1164 @@ -2157,18 +2157,23 @@ typedef struct malloc_chunk* mbinptr;
1165
1166 The bins top out around 1MB because we expect to service large
1167 requests via mmap.
1168 +
1169 + Bin 0 does not exist. Bin 1 is the unordered list; if that would be
1170 + a valid chunk size the small bins are bumped up one.
1171 */
1172
1173 #define NBINS 128
1174 #define NSMALLBINS 64
1175 #define SMALLBIN_WIDTH MALLOC_ALIGNMENT
1176 -#define MIN_LARGE_SIZE (NSMALLBINS * SMALLBIN_WIDTH)
1177 +#define SMALLBIN_CORRECTION (MALLOC_ALIGNMENT > 2 * SIZE_SZ)
1178 +#define MIN_LARGE_SIZE ((NSMALLBINS - SMALLBIN_CORRECTION) * SMALLBIN_WIDTH)
1179
1180 #define in_smallbin_range(sz) \
1181 ((unsigned long)(sz) < (unsigned long)MIN_LARGE_SIZE)
1182
1183 #define smallbin_index(sz) \
1184 - (SMALLBIN_WIDTH == 16 ? (((unsigned)(sz)) >> 4) : (((unsigned)(sz)) >> 3))
1185 + ((SMALLBIN_WIDTH == 16 ? (((unsigned)(sz)) >> 4) : (((unsigned)(sz)) >> 3)) \
1186 + + SMALLBIN_CORRECTION)
1187
1188 #define largebin_index_32(sz) \
1189 (((((unsigned long)(sz)) >> 6) <= 38)? 56 + (((unsigned long)(sz)) >> 6): \
1190 @@ -2178,6 +2183,14 @@ typedef struct malloc_chunk* mbinptr;
1191 ((((unsigned long)(sz)) >> 18) <= 2)? 124 + (((unsigned long)(sz)) >> 18): \
1192 126)
1193
1194 +#define largebin_index_32_big(sz) \
1195 +(((((unsigned long)(sz)) >> 6) <= 45)? 49 + (((unsigned long)(sz)) >> 6): \
1196 + ((((unsigned long)(sz)) >> 9) <= 20)? 91 + (((unsigned long)(sz)) >> 9): \
1197 + ((((unsigned long)(sz)) >> 12) <= 10)? 110 + (((unsigned long)(sz)) >> 12): \
1198 + ((((unsigned long)(sz)) >> 15) <= 4)? 119 + (((unsigned long)(sz)) >> 15): \
1199 + ((((unsigned long)(sz)) >> 18) <= 2)? 124 + (((unsigned long)(sz)) >> 18): \
1200 + 126)
1201 +
1202 // XXX It remains to be seen whether it is good to keep the widths of
1203 // XXX the buckets the same or whether it should be scaled by a factor
1204 // XXX of two as well.
1205 @@ -2190,7 +2203,9 @@ typedef struct malloc_chunk* mbinptr;
1206 126)
1207
1208 #define largebin_index(sz) \
1209 - (SIZE_SZ == 8 ? largebin_index_64 (sz) : largebin_index_32 (sz))
1210 + (SIZE_SZ == 8 ? largebin_index_64 (sz) \
1211 + : MALLOC_ALIGNMENT == 16 ? largebin_index_32_big (sz) \
1212 + : largebin_index_32 (sz))
1213
1214 #define bin_index(sz) \
1215 ((in_smallbin_range(sz)) ? smallbin_index(sz) : largebin_index(sz))
1216 @@ -3010,14 +3025,14 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
1217 Round up size to nearest page. For mmapped chunks, the overhead
1218 is one SIZE_SZ unit larger than for normal chunks, because there
1219 is no following chunk whose prev_size field could be used.
1220 +
1221 + See the front_misalign handling below, for glibc there is no
1222 + need for further alignments unless we have have high alignment.
1223 */
1224 -#if 1
1225 - /* See the front_misalign handling below, for glibc there is no
1226 - need for further alignments. */
1227 - size = (nb + SIZE_SZ + pagemask) & ~pagemask;
1228 -#else
1229 - size = (nb + SIZE_SZ + MALLOC_ALIGN_MASK + pagemask) & ~pagemask;
1230 -#endif
1231 + if (MALLOC_ALIGNMENT == 2 * SIZE_SZ)
1232 + size = (nb + SIZE_SZ + pagemask) & ~pagemask;
1233 + else
1234 + size = (nb + SIZE_SZ + MALLOC_ALIGN_MASK + pagemask) & ~pagemask;
1235 tried_mmap = true;
1236
1237 /* Don't try if size wraps around 0 */
1238 @@ -3035,13 +3050,16 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
1239 address argument for later munmap in free() and realloc().
1240 */
1241
1242 -#if 1
1243 - /* For glibc, chunk2mem increases the address by 2*SIZE_SZ and
1244 - MALLOC_ALIGN_MASK is 2*SIZE_SZ-1. Each mmap'ed area is page
1245 - aligned and therefore definitely MALLOC_ALIGN_MASK-aligned. */
1246 - assert (((INTERNAL_SIZE_T)chunk2mem(mm) & MALLOC_ALIGN_MASK) == 0);
1247 -#else
1248 - front_misalign = (INTERNAL_SIZE_T)chunk2mem(mm) & MALLOC_ALIGN_MASK;
1249 + if (MALLOC_ALIGNMENT == 2 * SIZE_SZ)
1250 + {
1251 + /* For glibc, chunk2mem increases the address by 2*SIZE_SZ and
1252 + MALLOC_ALIGN_MASK is 2*SIZE_SZ-1. Each mmap'ed area is page
1253 + aligned and therefore definitely MALLOC_ALIGN_MASK-aligned. */
1254 + assert (((INTERNAL_SIZE_T)chunk2mem(mm) & MALLOC_ALIGN_MASK) == 0);
1255 + front_misalign = 0;
1256 + }
1257 + else
1258 + front_misalign = (INTERNAL_SIZE_T)chunk2mem(mm) & MALLOC_ALIGN_MASK;
1259 if (front_misalign > 0) {
1260 correction = MALLOC_ALIGNMENT - front_misalign;
1261 p = (mchunkptr)(mm + correction);
1262 @@ -3049,7 +3067,6 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
1263 set_head(p, (size - correction) |IS_MMAPPED);
1264 }
1265 else
1266 -#endif
1267 {
1268 p = (mchunkptr)mm;
1269 set_head(p, size|IS_MMAPPED);
1270 @@ -3346,8 +3363,24 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
1271
1272 /* handle non-contiguous cases */
1273 else {
1274 - /* MORECORE/mmap must correctly align */
1275 - assert(((unsigned long)chunk2mem(brk) & MALLOC_ALIGN_MASK) == 0);
1276 + if (MALLOC_ALIGNMENT == 2 * SIZE_SZ)
1277 + /* MORECORE/mmap must correctly align */
1278 + assert(((unsigned long)chunk2mem(brk) & MALLOC_ALIGN_MASK) == 0);
1279 + else {
1280 + front_misalign = (INTERNAL_SIZE_T)chunk2mem(brk) & MALLOC_ALIGN_MASK;
1281 + if (front_misalign > 0) {
1282 +
1283 + /*
1284 + Skip over some bytes to arrive at an aligned position.
1285 + We don't need to specially mark these wasted front bytes.
1286 + They will never be accessed anyway because
1287 + prev_inuse of av->top (and any chunk created from its start)
1288 + is always true after initialization.
1289 + */
1290 +
1291 + aligned_brk += MALLOC_ALIGNMENT - front_misalign;
1292 + }
1293 + }
1294
1295 /* Find out current end of memory */
1296 if (snd_brk == (char*)(MORECORE_FAILURE)) {
1297 diff --git a/nptl/ChangeLog.backport b/nptl/ChangeLog.backport
1298 new file mode 100644
1299 index 0000000..dadb557
1300 --- /dev/null
1301 +++ b/nptl/ChangeLog.backport
1302 @@ -0,0 +1,28 @@
1303 +2011-10-29 Ulrich Drepper <drepper@×××××.com>
1304 +
1305 + [BZ #13358]
1306 + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
1307 + (__pthread_cond_timedwait): Initialize %r15 correctly also for code
1308 + path for kernels with FUTEX_CLOCK_REALTIME.
1309 + Debugged by H.J. Lu <hjl.tools@×××××.com>.
1310 +
1311 +2011-09-08 Ulrich Drepper <drepper@×××××.com>
1312 +
1313 + [BZ #12403]
1314 + * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
1315 + (pthread_rwlock_timedwrlock): Use correct macro in test.
1316 + Patch by H.J. Lu <hongjiu.lu@×××××.com>.
1317 +
1318 +2011-09-06 Ulrich Drepper <drepper@×××××.com>
1319 +
1320 + * sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S (sem_timedwait): Don't
1321 + use gettimeofday vsyscall, just call gettimeofday.
1322 + * sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
1323 + * sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S: Likewise.
1324 + * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S:
1325 + Likewise.
1326 + * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S:
1327 + Likewise.
1328 + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
1329 + Simplify __vdso_clock_gettime use.
1330 +
1331 diff --git a/nptl/ChangeLog.x32 b/nptl/ChangeLog.x32
1332 new file mode 100644
1333 index 0000000..12cbb53
1334 --- /dev/null
1335 +++ b/nptl/ChangeLog.x32
1336 @@ -0,0 +1,72 @@
1337 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
1338 +
1339 + * pthread_create.c (start_thread): Check __PTHREAD_MUTEX_HAVE_PREV
1340 + instead of __WORDSIZE.
1341 +
1342 + * sysdeps/pthread/pthread.h (PTHREAD_MUTEX_INITIALIZER): Check
1343 + __PTHREAD_MUTEX_HAVE_PREV instead of __WORDSIZE.
1344 + (PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP): Likewise.
1345 + (PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP): Likewise.
1346 + (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP): Likewise.
1347 + (__PTHREAD_RWLOCK_INT_FLAGS_SHARED): New.
1348 + (PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP): Check
1349 + __PTHREAD_RWLOCK_INT_FLAGS_SHARED instead of __WORDSIZE.
1350 +
1351 + * sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h: Define x32
1352 + __SIZEOF_PTHREAD_XXX_T.
1353 + (__pthread_internal_list): Check __x86_64__ instead of __WORDSIZE.
1354 + (pthread_mutex_t): Likewise.
1355 + (pthread_rwlock_t): Likewise.
1356 + (__PTHREAD_RWLOCK_INT_FLAGS_SHARED): New. Defined if __x86_64__
1357 + is defined.
1358 +
1359 + * sysdeps/x86_64/tls.h: Don't include <bits/wordsize.h>.
1360 + Check __x86_64__ instead of __WORDSIZE.
1361 + (tcbhead_t): Pad rtld_savespace_sse to 32byte aligned.
1362 + (THREAD_SETMEM): Use long long on 64bit integer.
1363 + (THREAD_SETMEM_NC): Likewise.
1364 +
1365 + * sysdeps/x86_64/x32/tls.h: New.
1366 +
1367 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
1368 +
1369 + * sysdeps/x86_64/pthreaddef.h (CURRENT_STACK_FRAME): Use
1370 + RSP_LP.
1371 +
1372 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
1373 +
1374 + * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (__NR_futex): New.
1375 + (SYS_futex): Use it.
1376 + (LLL_STUB_UNWIND_INFO_START): Align label to LP_SIZE instead
1377 + of 8.
1378 + (LLL_STUB_UNWIND_INFO_END): Likewise. Use RDX_LP.
1379 +
1380 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
1381 +
1382 + * unwind.c (unwind_stop): Cast _Unwind_GetCFA return to
1383 + _Unwind_Ptr first.
1384 +
1385 +2011-11-21 H.J. Lu <hongjiu.lu@×××××.com>
1386 +
1387 + * sysdeps/unix/sysv/linux/x86_64/cancellation.S: Use MOVE_LP
1388 + and RDI_LP.
1389 +
1390 + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Use
1391 + RXX_LP and CMP_LP.
1392 + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise.
1393 +
1394 + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Use
1395 + RXX_LP and CMP_LP. Use LP_SIZE and ASM_ADDR on
1396 + __gcc_personality_v0.
1397 + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
1398 +
1399 + * sysdeps/unix/sysv/linux/x86_64/pthread_once.S: Use LP_SIZE
1400 + and ASM_ADDR.
1401 +
1402 + * sysdeps/unix/sysv/linux/x86_64/sem_post.S: Use CMP_LP on
1403 + NWAITERS.
1404 +
1405 + * sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Use ADD_LP
1406 + and SUB_LP on NWAITERS. Use LP_SIZE and ASM_ADDR on
1407 + __gcc_personality_v0.
1408 + * sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Likewise.
1409 diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
1410 index 34d83f9..174cec8 100644
1411 --- a/nptl/pthread_create.c
1412 +++ b/nptl/pthread_create.c
1413 @@ -352,7 +352,7 @@ start_thread (void *arg)
1414
1415 #ifndef __ASSUME_SET_ROBUST_LIST
1416 /* If this thread has any robust mutexes locked, handle them now. */
1417 -# if __WORDSIZE == 64
1418 +# ifdef __PTHREAD_MUTEX_HAVE_PREV
1419 void *robust = pd->robust_head.list;
1420 # else
1421 __pthread_slist_t *robust = pd->robust_list.__next;
1422 diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h
1423 index 4c83665..d2172da 100644
1424 --- a/nptl/sysdeps/pthread/pthread.h
1425 +++ b/nptl/sysdeps/pthread/pthread.h
1426 @@ -85,7 +85,7 @@ enum
1427
1428
1429 /* Mutex initializers. */
1430 -#if __WORDSIZE == 64
1431 +#ifdef __PTHREAD_MUTEX_HAVE_PREV
1432 # define PTHREAD_MUTEX_INITIALIZER \
1433 { { 0, 0, 0, 0, 0, 0, { 0, 0 } } }
1434 # ifdef __USE_GNU
1435 @@ -120,11 +120,17 @@ enum
1436 PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
1437 };
1438
1439 +#ifndef __PTHREAD_RWLOCK_INT_FLAGS_SHARED
1440 +# if __WORDSIZE == 64
1441 +# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
1442 +# endif
1443 +#endif
1444 +
1445 /* Read-write lock initializers. */
1446 # define PTHREAD_RWLOCK_INITIALIZER \
1447 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
1448 # ifdef __USE_GNU
1449 -# if __WORDSIZE == 64
1450 +# ifdef __PTHREAD_RWLOCK_INT_FLAGS_SHARED
1451 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
1452 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
1453 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
1454 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h
1455 index 7a09c81..43e5119 100644
1456 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h
1457 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h
1458 @@ -22,16 +22,28 @@
1459
1460 #include <bits/wordsize.h>
1461
1462 -#if __WORDSIZE == 64
1463 -# define __SIZEOF_PTHREAD_ATTR_T 56
1464 -# define __SIZEOF_PTHREAD_MUTEX_T 40
1465 -# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
1466 -# define __SIZEOF_PTHREAD_COND_T 48
1467 -# define __SIZEOF_PTHREAD_CONDATTR_T 4
1468 -# define __SIZEOF_PTHREAD_RWLOCK_T 56
1469 -# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
1470 -# define __SIZEOF_PTHREAD_BARRIER_T 32
1471 -# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
1472 +#ifdef __x86_64__
1473 +# if __WORDSIZE == 64
1474 +# define __SIZEOF_PTHREAD_ATTR_T 56
1475 +# define __SIZEOF_PTHREAD_MUTEX_T 40
1476 +# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
1477 +# define __SIZEOF_PTHREAD_COND_T 48
1478 +# define __SIZEOF_PTHREAD_CONDATTR_T 4
1479 +# define __SIZEOF_PTHREAD_RWLOCK_T 56
1480 +# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
1481 +# define __SIZEOF_PTHREAD_BARRIER_T 32
1482 +# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
1483 +# else
1484 +# define __SIZEOF_PTHREAD_ATTR_T 32
1485 +# define __SIZEOF_PTHREAD_MUTEX_T 32
1486 +# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
1487 +# define __SIZEOF_PTHREAD_COND_T 48
1488 +# define __SIZEOF_PTHREAD_CONDATTR_T 4
1489 +# define __SIZEOF_PTHREAD_RWLOCK_T 44
1490 +# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
1491 +# define __SIZEOF_PTHREAD_BARRIER_T 20
1492 +# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
1493 +# endif
1494 #else
1495 # define __SIZEOF_PTHREAD_ATTR_T 36
1496 # define __SIZEOF_PTHREAD_MUTEX_T 24
1497 @@ -57,7 +69,7 @@ typedef union
1498 } pthread_attr_t;
1499
1500
1501 -#if __WORDSIZE == 64
1502 +#ifdef __x86_64__
1503 typedef struct __pthread_internal_list
1504 {
1505 struct __pthread_internal_list *__prev;
1506 @@ -80,13 +92,13 @@ typedef union
1507 int __lock;
1508 unsigned int __count;
1509 int __owner;
1510 -#if __WORDSIZE == 64
1511 +#ifdef __x86_64__
1512 unsigned int __nusers;
1513 #endif
1514 /* KIND must stay at this position in the structure to maintain
1515 binary compatibility. */
1516 int __kind;
1517 -#if __WORDSIZE == 64
1518 +#ifdef __x86_64__
1519 int __spins;
1520 __pthread_list_t __list;
1521 # define __PTHREAD_MUTEX_HAVE_PREV 1
1522 @@ -149,7 +161,7 @@ typedef int pthread_once_t;
1523 structure of the attribute type is not exposed on purpose. */
1524 typedef union
1525 {
1526 -# if __WORDSIZE == 64
1527 +# ifdef __x86_64__
1528 struct
1529 {
1530 int __lock;
1531 @@ -165,6 +177,7 @@ typedef union
1532 /* FLAGS must stay at this position in the structure to maintain
1533 binary compatibility. */
1534 unsigned int __flags;
1535 +# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
1536 } __data;
1537 # else
1538 struct
1539 @@ -217,7 +230,7 @@ typedef union
1540 #endif
1541
1542
1543 -#if __WORDSIZE == 32
1544 +#ifndef __x86_64__
1545 /* Extra attributes for the cleanup functions. */
1546 # define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
1547 #endif
1548 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S b/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
1549 index a06cd9b..fe33f69 100644
1550 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
1551 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
1552 @@ -73,10 +73,10 @@ ENTRY(__pthread_enable_asynccancel)
1553
1554 3: subq $8, %rsp
1555 cfi_adjust_cfa_offset(8)
1556 - movq $TCB_PTHREAD_CANCELED, %fs:RESULT
1557 + MOVE_LP $TCB_PTHREAD_CANCELED, %fs:RESULT
1558 lock
1559 orl $TCB_EXITING_BITMASK, %fs:CANCELHANDLING
1560 - movq %fs:CLEANUP_JMP_BUF, %rdi
1561 + mov %fs:CLEANUP_JMP_BUF, %RDI_LP
1562 #ifdef SHARED
1563 call __pthread_unwind@PLT
1564 #else
1565 @@ -107,7 +107,7 @@ ENTRY(__pthread_disable_asynccancel)
1566 /* Performance doesn't matter in this loop. We will
1567 delay until the thread is canceled. And we will unlikely
1568 enter the loop twice. */
1569 -4: movq %fs:0, %rdi
1570 +4: mov %fs:0, %RDI_LP
1571 movl $__NR_futex, %eax
1572 xorq %r10, %r10
1573 addq $CANCELHANDLING, %rdi
1574 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
1575 index 3195db2..018da0c 100644
1576 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
1577 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
1578 @@ -1,4 +1,4 @@
1579 -/* Copyright (C) 2002-2006, 2007, 2009, 2010 Free Software Foundation, Inc.
1580 +/* Copyright (C) 2002-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
1581 This file is part of the GNU C Library.
1582 Contributed by Ulrich Drepper <drepper@××××××.com>, 2002.
1583
1584 @@ -68,10 +68,6 @@
1585 #endif
1586
1587
1588 -/* For the calculation see asm/vsyscall.h. */
1589 -#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000
1590 -
1591 -
1592 .globl __lll_lock_wait_private
1593 .type __lll_lock_wait_private,@function
1594 .hidden __lll_lock_wait_private
1595 @@ -250,10 +246,9 @@ __lll_timedlock_wait:
1596 /* Get current time. */
1597 movq %rsp, %rdi
1598 xorl %esi, %esi
1599 - movq $VSYSCALL_ADDR_vgettimeofday, %rax
1600 - /* This is a regular function call, all caller-save registers
1601 - might be clobbered. */
1602 - callq *%rax
1603 + /* This call works because we directly jump to a system call entry
1604 + which preserves all the registers. */
1605 + call JUMPTARGET(__gettimeofday)
1606
1607 /* Compute relative timeout. */
1608 movq 8(%rsp), %rax
1609 @@ -402,8 +397,9 @@ __lll_timedwait_tid:
1610 /* Get current time. */
1611 2: movq %rsp, %rdi
1612 xorl %esi, %esi
1613 - movq $VSYSCALL_ADDR_vgettimeofday, %rax
1614 - callq *%rax
1615 + /* This call works because we directly jump to a system call entry
1616 + which preserves all the registers. */
1617 + call JUMPTARGET(__gettimeofday)
1618
1619 /* Compute relative timeout. */
1620 movq 8(%rsp), %rax
1621 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
1622 index 9b15bfb..023a675 100644
1623 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
1624 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
1625 @@ -44,7 +44,11 @@
1626 # endif
1627 #endif
1628
1629 -#define SYS_futex 202
1630 +#ifndef __NR_futex
1631 +# define __NR_futex 202
1632 +#endif
1633 +
1634 +#define SYS_futex __NR_futex
1635 #define FUTEX_WAIT 0
1636 #define FUTEX_WAKE 1
1637 #define FUTEX_CMP_REQUEUE 4
1638 @@ -120,7 +124,7 @@
1639 ".byte 0x12 # DW_CFA_def_cfa_sf\n\t" \
1640 ".uleb128 0x7\n\t" \
1641 ".sleb128 16\n\t" \
1642 - ".align 8\n" \
1643 + ".align " LP_SIZE "\n" \
1644 "9:\t" ".long 23f-10f # FDE Length\n" \
1645 "10:\t" ".long 10b-7b # FDE CIE offset\n\t" \
1646 ".long 1b-. # FDE initial location\n\t" \
1647 @@ -167,7 +171,7 @@
1648 ".uleb128 22f-21f\n" \
1649 "21:\t" ".byte 0x80 # DW_OP_breg16\n\t" \
1650 ".sleb128 4b-5b\n" \
1651 -"22:\t" ".align 8\n" \
1652 +"22:\t" ".align " LP_SIZE "\n" \
1653 "23:\t" ".previous\n"
1654
1655 /* Unwind info for
1656 @@ -408,7 +412,7 @@ LLL_STUB_UNWIND_INFO_END
1657 ".type _L_timedlock_%=, @function\n" \
1658 "_L_timedlock_%=:\n" \
1659 "1:\tleaq %4, %%rdi\n" \
1660 - "0:\tmovq %8, %%rdx\n" \
1661 + "0:\tmov %8, %%" RDX_LP "\n" \
1662 "2:\tsubq $128, %%rsp\n" \
1663 "3:\tcallq __lll_timedlock_wait\n" \
1664 "4:\taddq $128, %%rsp\n" \
1665 @@ -432,7 +436,7 @@ LLL_STUB_UNWIND_INFO_END
1666 ".type _L_robust_timedlock_%=, @function\n" \
1667 "_L_robust_timedlock_%=:\n" \
1668 "1:\tleaq %4, %%rdi\n" \
1669 - "0:\tmovq %8, %%rdx\n" \
1670 + "0:\tmov %8, %%" RDX_LP "\n" \
1671 "2:\tsubq $128, %%rsp\n" \
1672 "3:\tcallq __lll_robust_timedlock_wait\n" \
1673 "4:\taddq $128, %%rsp\n" \
1674 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
1675 index 5218a4f..b7b8b34 100644
1676 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
1677 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
1678 @@ -1,4 +1,4 @@
1679 -/* Copyright (C) 2002=2007, 2009, 2010 Free Software Foundation, Inc.
1680 +/* Copyright (C) 2002, 2011=2007, 2009, 2010 Free Software Foundation, Inc.
1681 This file is part of the GNU C Library.
1682 Contributed by Ulrich Drepper <drepper@××××××.com>, 2002.
1683
1684 @@ -50,9 +50,6 @@
1685 orl $FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME, reg
1686 #endif
1687
1688 -/* For the calculation see asm/vsyscall.h. */
1689 -#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000
1690 -
1691
1692 .globl __lll_robust_lock_wait
1693 .type __lll_robust_lock_wait,@function
1694 @@ -219,10 +216,9 @@ __lll_robust_timedlock_wait:
1695 /* Get current time. */
1696 movq %rsp, %rdi
1697 xorl %esi, %esi
1698 - movq $VSYSCALL_ADDR_vgettimeofday, %rax
1699 - /* This is a regular function call, all caller-save registers
1700 - might be clobbered. */
1701 - callq *%rax
1702 + /* This call works because we directly jump to a system call entry
1703 + which preserves all the registers. */
1704 + call JUMPTARGET(__gettimeofday)
1705
1706 /* Compute relative timeout. */
1707 movq 8(%rsp), %rax
1708 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
1709 index 224a560..5c89c04 100644
1710 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
1711 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
1712 @@ -60,14 +60,14 @@ __pthread_cond_broadcast:
1713 incl broadcast_seq-cond_futex(%rdi)
1714
1715 /* Get the address of the mutex used. */
1716 - movq dep_mutex-cond_futex(%rdi), %r8
1717 + mov dep_mutex-cond_futex(%rdi), %R8_LP
1718
1719 /* Unlock. */
1720 LOCK
1721 decl cond_lock-cond_futex(%rdi)
1722 jne 7f
1723
1724 -8: cmpq $-1, %r8
1725 +8: CMP_LP $-1, %R8_LP
1726 je 9f
1727
1728 /* Do not use requeue for pshared condvars. */
1729 @@ -129,7 +129,7 @@ __pthread_cond_broadcast:
1730 #if cond_lock != 0
1731 addq $cond_lock, %rdi
1732 #endif
1733 - cmpq $-1, dep_mutex-cond_lock(%rdi)
1734 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
1735 movl $LLL_PRIVATE, %eax
1736 movl $LLL_SHARED, %esi
1737 cmovne %eax, %esi
1738 @@ -141,7 +141,7 @@ __pthread_cond_broadcast:
1739
1740 /* Unlock in loop requires wakeup. */
1741 5: addq $cond_lock-cond_futex, %rdi
1742 - cmpq $-1, dep_mutex-cond_lock(%rdi)
1743 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
1744 movl $LLL_PRIVATE, %eax
1745 movl $LLL_SHARED, %esi
1746 cmovne %eax, %esi
1747 @@ -150,7 +150,7 @@ __pthread_cond_broadcast:
1748
1749 /* Unlock in loop requires wakeup. */
1750 7: addq $cond_lock-cond_futex, %rdi
1751 - cmpq $-1, %r8
1752 + CMP_LP $-1, %R8_LP
1753 movl $LLL_PRIVATE, %eax
1754 movl $LLL_SHARED, %esi
1755 cmovne %eax, %esi
1756 @@ -159,7 +159,7 @@ __pthread_cond_broadcast:
1757 jmp 8b
1758
1759 9: /* The futex requeue functionality is not available. */
1760 - cmpq $-1, %r8
1761 + CMP_LP $-1, %R8_LP
1762 movl $0x7fffffff, %edx
1763 #ifdef __ASSUME_PRIVATE_FUTEX
1764 movl $FUTEX_WAKE, %eax
1765 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
1766 index d1d83a8..9f05d28 100644
1767 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
1768 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
1769 @@ -56,14 +56,14 @@ __pthread_cond_signal:
1770 addl $1, (%rdi)
1771
1772 /* Wake up one thread. */
1773 - cmpq $-1, dep_mutex(%r8)
1774 + CMP_LP $-1, dep_mutex(%r8)
1775 movl $FUTEX_WAKE_OP, %esi
1776 movl $1, %edx
1777 movl $SYS_futex, %eax
1778 je 8f
1779
1780 /* Get the address of the mutex used. */
1781 - movq dep_mutex(%r8), %rcx
1782 + mov dep_mutex(%r8), %RCX_LP
1783 movl MUTEX_KIND(%rcx), %r11d
1784 andl $(ROBUST_BIT|PI_BIT), %r11d
1785 cmpl $PI_BIT, %r11d
1786 @@ -135,7 +135,7 @@ __pthread_cond_signal:
1787 #if cond_lock != 0
1788 addq $cond_lock, %rdi
1789 #endif
1790 - cmpq $-1, dep_mutex-cond_lock(%rdi)
1791 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
1792 movl $LLL_PRIVATE, %eax
1793 movl $LLL_SHARED, %esi
1794 cmovne %eax, %esi
1795 @@ -151,7 +151,7 @@ __pthread_cond_signal:
1796 #if cond_lock != 0
1797 addq $cond_lock, %rdi
1798 #endif
1799 - cmpq $-1, dep_mutex-cond_lock(%rdi)
1800 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
1801 movl $LLL_PRIVATE, %eax
1802 movl $LLL_SHARED, %esi
1803 cmovne %eax, %esi
1804 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
1805 index 48ea8b9..048d0ce 100644
1806 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
1807 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
1808 @@ -1,4 +1,4 @@
1809 -/* Copyright (C) 2002-2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
1810 +/* Copyright (C) 2002-2005,2007,2009,2010,2011 Free Software Foundation, Inc.
1811 This file is part of the GNU C Library.
1812 Contributed by Ulrich Drepper <drepper@××××××.com>, 2002.
1813
1814 @@ -26,9 +26,6 @@
1815
1816 #include <kernel-features.h>
1817
1818 -/* For the calculation see asm/vsyscall.h. */
1819 -#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000
1820 -
1821
1822 .text
1823
1824 @@ -93,7 +90,7 @@ __pthread_cond_timedwait:
1825 +--------------------------+
1826 */
1827
1828 - cmpq $-1, dep_mutex(%rdi)
1829 + CMP_LP $-1, dep_mutex(%rdi)
1830
1831 /* Prepare structure passed to cancellation handler. */
1832 movq %rdi, 8(%rsp)
1833 @@ -101,9 +98,11 @@ __pthread_cond_timedwait:
1834 movq %rdx, %r13
1835
1836 je 22f
1837 - movq %rsi, dep_mutex(%rdi)
1838 + mov %RSI_LP, dep_mutex(%rdi)
1839
1840 22:
1841 + xorl %r15d, %r15d
1842 +
1843 #ifndef __ASSUME_FUTEX_CLOCK_REALTIME
1844 # ifdef PIC
1845 cmpl $0, __have_futex_clock_realtime(%rip)
1846 @@ -165,10 +164,10 @@ __pthread_cond_timedwait:
1847
1848 movq %r13, %r10
1849 movl $FUTEX_WAIT_BITSET, %esi
1850 - cmpq $-1, dep_mutex(%rdi)
1851 + CMP_LP $-1, dep_mutex(%rdi)
1852 je 60f
1853
1854 - movq dep_mutex(%rdi), %r8
1855 + mov dep_mutex(%rdi), %R8_LP
1856 /* Requeue to a non-robust PI mutex if the PI bit is set and
1857 the robust bit is not set. */
1858 movl MUTEX_KIND(%r8), %eax
1859 @@ -270,7 +269,7 @@ __pthread_cond_timedwait:
1860 jne 55f
1861
1862 addq $cond_nwaiters, %rdi
1863 - cmpq $-1, dep_mutex-cond_nwaiters(%rdi)
1864 + CMP_LP $-1, dep_mutex-cond_nwaiters(%rdi)
1865 movl $1, %edx
1866 #ifdef __ASSUME_PRIVATE_FUTEX
1867 movl $FUTEX_WAKE, %eax
1868 @@ -333,7 +332,7 @@ __pthread_cond_timedwait:
1869 #if cond_lock != 0
1870 addq $cond_lock, %rdi
1871 #endif
1872 - cmpq $-1, dep_mutex-cond_lock(%rdi)
1873 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
1874 movl $LLL_PRIVATE, %eax
1875 movl $LLL_SHARED, %esi
1876 cmovne %eax, %esi
1877 @@ -345,7 +344,7 @@ __pthread_cond_timedwait:
1878 #if cond_lock != 0
1879 addq $cond_lock, %rdi
1880 #endif
1881 - cmpq $-1, dep_mutex-cond_lock(%rdi)
1882 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
1883 movl $LLL_PRIVATE, %eax
1884 movl $LLL_SHARED, %esi
1885 cmovne %eax, %esi
1886 @@ -357,7 +356,7 @@ __pthread_cond_timedwait:
1887 #if cond_lock != 0
1888 addq $cond_lock, %rdi
1889 #endif
1890 - cmpq $-1, dep_mutex-cond_lock(%rdi)
1891 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
1892 movl $LLL_PRIVATE, %eax
1893 movl $LLL_SHARED, %esi
1894 cmovne %eax, %esi
1895 @@ -372,7 +371,7 @@ __pthread_cond_timedwait:
1896 #if cond_lock != 0
1897 addq $cond_lock, %rdi
1898 #endif
1899 - cmpq $-1, dep_mutex-cond_lock(%rdi)
1900 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
1901 movl $LLL_PRIVATE, %eax
1902 movl $LLL_SHARED, %esi
1903 cmovne %eax, %esi
1904 @@ -393,7 +392,7 @@ __pthread_cond_timedwait:
1905 #if cond_lock != 0
1906 addq $cond_lock, %rdi
1907 #endif
1908 - cmpq $-1, dep_mutex-cond_lock(%rdi)
1909 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
1910 movl $LLL_PRIVATE, %eax
1911 movl $LLL_SHARED, %esi
1912 cmovne %eax, %esi
1913 @@ -405,8 +404,6 @@ __pthread_cond_timedwait:
1914
1915 #ifndef __ASSUME_FUTEX_CLOCK_REALTIME
1916 .Lreltmo:
1917 - xorl %r15d, %r15d
1918 -
1919 /* Get internal lock. */
1920 movl $1, %esi
1921 xorl %eax, %eax
1922 @@ -450,16 +447,14 @@ __pthread_cond_timedwait:
1923 kernel. */
1924 leaq 32(%rsp), %rsi
1925 # ifdef SHARED
1926 - movq __vdso_clock_gettime@GOTPCREL(%rip), %rax
1927 - movq (%rax), %rax
1928 - PTR_DEMANGLE (%rax)
1929 - jz 26f
1930 + mov __vdso_clock_gettime@GOTPCREL(%rip), %RAX_LP
1931 + mov (%rax), %RAX_LP
1932 + PTR_DEMANGLE (%RAX_LP)
1933 call *%rax
1934 - jmp 27f
1935 -# endif
1936 -26: movl $__NR_clock_gettime, %eax
1937 +# else
1938 + movl $__NR_clock_gettime, %eax
1939 syscall
1940 -27:
1941 +# endif
1942 # ifndef __ASSUME_POSIX_TIMERS
1943 cmpq $-ENOSYS, %rax
1944 je 19f
1945 @@ -473,8 +468,9 @@ __pthread_cond_timedwait:
1946 # else
1947 leaq 24(%rsp), %rdi
1948 xorl %esi, %esi
1949 - movq $VSYSCALL_ADDR_vgettimeofday, %rax
1950 - callq *%rax
1951 + /* This call works because we directly jump to a system call entry
1952 + which preserves all the registers. */
1953 + call JUMPTARGET(__gettimeofday)
1954
1955 /* Compute relative timeout. */
1956 movq 40(%rsp), %rax
1957 @@ -513,7 +509,7 @@ __pthread_cond_timedwait:
1958 movl %eax, (%rsp)
1959
1960 leaq 32(%rsp), %r10
1961 - cmpq $-1, dep_mutex(%rdi)
1962 + CMP_LP $-1, dep_mutex(%rdi)
1963 movq %r12, %rdx
1964 # ifdef __ASSUME_PRIVATE_FUTEX
1965 movl $FUTEX_WAIT, %eax
1966 @@ -573,7 +569,7 @@ __pthread_cond_timedwait:
1967 # if cond_lock != 0
1968 addq $cond_lock, %rdi
1969 # endif
1970 - cmpq $-1, dep_mutex-cond_lock(%rdi)
1971 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
1972 movl $LLL_PRIVATE, %eax
1973 movl $LLL_SHARED, %esi
1974 cmovne %eax, %esi
1975 @@ -585,7 +581,7 @@ __pthread_cond_timedwait:
1976 # if cond_lock != 0
1977 addq $cond_lock, %rdi
1978 # endif
1979 - cmpq $-1, dep_mutex-cond_lock(%rdi)
1980 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
1981 movl $LLL_PRIVATE, %eax
1982 movl $LLL_SHARED, %esi
1983 cmovne %eax, %esi
1984 @@ -597,7 +593,7 @@ __pthread_cond_timedwait:
1985 # if cond_lock != 0
1986 addq $cond_lock, %rdi
1987 # endif
1988 - cmpq $-1, dep_mutex-cond_lock(%rdi)
1989 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
1990 movl $LLL_PRIVATE, %eax
1991 movl $LLL_SHARED, %esi
1992 cmovne %eax, %esi
1993 @@ -611,8 +607,9 @@ __pthread_cond_timedwait:
1994 /* clock_gettime not available. */
1995 19: leaq 32(%rsp), %rdi
1996 xorl %esi, %esi
1997 - movq $VSYSCALL_ADDR_vgettimeofday, %rax
1998 - callq *%rax
1999 + /* This call works because we directly jump to a system call entry
2000 + which preserves all the registers. */
2001 + call JUMPTARGET(__gettimeofday)
2002
2003 /* Compute relative timeout. */
2004 movq 40(%rsp), %rax
2005 @@ -679,7 +676,7 @@ __condvar_cleanup2:
2006 #if cond_lock != 0
2007 addq $cond_lock, %rdi
2008 #endif
2009 - cmpq $-1, dep_mutex-cond_lock(%rdi)
2010 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
2011 movl $LLL_PRIVATE, %eax
2012 movl $LLL_SHARED, %esi
2013 cmovne %eax, %esi
2014 @@ -712,7 +709,7 @@ __condvar_cleanup2:
2015 andl $~((1 << nwaiters_shift) - 1), %eax
2016 jne 4f
2017
2018 - cmpq $-1, dep_mutex(%rdi)
2019 + CMP_LP $-1, dep_mutex(%rdi)
2020 leaq cond_nwaiters(%rdi), %rdi
2021 movl $1, %edx
2022 #ifdef __ASSUME_PRIVATE_FUTEX
2023 @@ -740,7 +737,7 @@ __condvar_cleanup2:
2024 #if cond_lock != 0
2025 addq $cond_lock, %rdi
2026 #endif
2027 - cmpq $-1, dep_mutex-cond_lock(%rdi)
2028 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
2029 movl $LLL_PRIVATE, %eax
2030 movl $LLL_SHARED, %esi
2031 cmovne %eax, %esi
2032 @@ -750,7 +747,7 @@ __condvar_cleanup2:
2033 2: testq %r12, %r12
2034 jnz 5f
2035 addq $cond_futex, %rdi
2036 - cmpq $-1, dep_mutex-cond_futex(%rdi)
2037 + CMP_LP $-1, dep_mutex-cond_futex(%rdi)
2038 movl $0x7fffffff, %edx
2039 #ifdef __ASSUME_PRIVATE_FUTEX
2040 movl $FUTEX_WAKE, %eax
2041 @@ -809,9 +806,9 @@ __condvar_cleanup2:
2042 .hidden DW.ref.__gcc_personality_v0
2043 .weak DW.ref.__gcc_personality_v0
2044 .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
2045 - .align 8
2046 + .align LP_SIZE
2047 .type DW.ref.__gcc_personality_v0, @object
2048 - .size DW.ref.__gcc_personality_v0, 8
2049 + .size DW.ref.__gcc_personality_v0, LP_SIZE
2050 DW.ref.__gcc_personality_v0:
2051 - .quad __gcc_personality_v0
2052 + ASM_ADDR __gcc_personality_v0
2053 #endif
2054 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
2055 index 7535baa..275e045 100644
2056 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
2057 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
2058 @@ -65,14 +65,14 @@ __pthread_cond_wait:
2059 +--------------------------+
2060 */
2061
2062 - cmpq $-1, dep_mutex(%rdi)
2063 + CMP_LP $-1, dep_mutex(%rdi)
2064
2065 /* Prepare structure passed to cancellation handler. */
2066 movq %rdi, 8(%rsp)
2067 movq %rsi, 16(%rsp)
2068
2069 je 15f
2070 - movq %rsi, dep_mutex(%rdi)
2071 + mov %RSI_LP, dep_mutex(%rdi)
2072
2073 /* Get internal lock. */
2074 15: movl $1, %esi
2075 @@ -120,12 +120,12 @@ __pthread_cond_wait:
2076 movl %eax, (%rsp)
2077
2078 xorq %r10, %r10
2079 - cmpq $-1, dep_mutex(%rdi)
2080 + CMP_LP $-1, dep_mutex(%rdi)
2081 leaq cond_futex(%rdi), %rdi
2082 movl $FUTEX_WAIT, %esi
2083 je 60f
2084
2085 - movq dep_mutex-cond_futex(%rdi), %r8
2086 + mov dep_mutex-cond_futex(%rdi), %R8_LP
2087 /* Requeue to a non-robust PI mutex if the PI bit is set and
2088 the robust bit is not set. */
2089 movl MUTEX_KIND(%r8), %eax
2090 @@ -203,7 +203,7 @@ __pthread_cond_wait:
2091 jne 17f
2092
2093 addq $cond_nwaiters, %rdi
2094 - cmpq $-1, dep_mutex-cond_nwaiters(%rdi)
2095 + CMP_LP $-1, dep_mutex-cond_nwaiters(%rdi)
2096 movl $1, %edx
2097 #ifdef __ASSUME_PRIVATE_FUTEX
2098 movl $FUTEX_WAKE, %eax
2099 @@ -252,7 +252,7 @@ __pthread_cond_wait:
2100 #if cond_lock != 0
2101 addq $cond_lock, %rdi
2102 #endif
2103 - cmpq $-1, dep_mutex-cond_lock(%rdi)
2104 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
2105 movl $LLL_PRIVATE, %eax
2106 movl $LLL_SHARED, %esi
2107 cmovne %eax, %esi
2108 @@ -264,7 +264,7 @@ __pthread_cond_wait:
2109 #if cond_lock != 0
2110 addq $cond_lock, %rdi
2111 #endif
2112 - cmpq $-1, dep_mutex-cond_lock(%rdi)
2113 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
2114 movl $LLL_PRIVATE, %eax
2115 movl $LLL_SHARED, %esi
2116 cmovne %eax, %esi
2117 @@ -280,7 +280,7 @@ __pthread_cond_wait:
2118 #if cond_lock != 0
2119 addq $cond_lock, %rdi
2120 #endif
2121 - cmpq $-1, dep_mutex-cond_lock(%rdi)
2122 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
2123 movl $LLL_PRIVATE, %eax
2124 movl $LLL_SHARED, %esi
2125 cmovne %eax, %esi
2126 @@ -295,7 +295,7 @@ __pthread_cond_wait:
2127 #if cond_lock != 0
2128 addq $cond_lock, %rdi
2129 #endif
2130 - cmpq $-1, dep_mutex-cond_lock(%rdi)
2131 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
2132 movl $LLL_PRIVATE, %eax
2133 movl $LLL_SHARED, %esi
2134 cmovne %eax, %esi
2135 @@ -316,7 +316,7 @@ __pthread_cond_wait:
2136 #if cond_lock != 0
2137 addq $cond_lock, %rdi
2138 #endif
2139 - cmpq $-1, dep_mutex-cond_lock(%rdi)
2140 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
2141 movl $LLL_PRIVATE, %eax
2142 movl $LLL_SHARED, %esi
2143 cmovne %eax, %esi
2144 @@ -367,7 +367,7 @@ __condvar_cleanup1:
2145 #if cond_lock != 0
2146 addq $cond_lock, %rdi
2147 #endif
2148 - cmpq $-1, dep_mutex-cond_lock(%rdi)
2149 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
2150 movl $LLL_PRIVATE, %eax
2151 movl $LLL_SHARED, %esi
2152 cmovne %eax, %esi
2153 @@ -400,7 +400,7 @@ __condvar_cleanup1:
2154 andl $~((1 << nwaiters_shift) - 1), %eax
2155 jne 4f
2156
2157 - cmpq $-1, dep_mutex(%rdi)
2158 + CMP_LP $-1, dep_mutex(%rdi)
2159 leaq cond_nwaiters(%rdi), %rdi
2160 movl $1, %edx
2161 #ifdef __ASSUME_PRIVATE_FUTEX
2162 @@ -428,7 +428,7 @@ __condvar_cleanup1:
2163 #if cond_lock != 0
2164 addq $cond_lock, %rdi
2165 #endif
2166 - cmpq $-1, dep_mutex-cond_lock(%rdi)
2167 + CMP_LP $-1, dep_mutex-cond_lock(%rdi)
2168 movl $LLL_PRIVATE, %eax
2169 movl $LLL_SHARED, %esi
2170 cmovne %eax, %esi
2171 @@ -439,7 +439,7 @@ __condvar_cleanup1:
2172 2: testl %ecx, %ecx
2173 jnz 5f
2174 addq $cond_futex, %rdi
2175 - cmpq $-1, dep_mutex-cond_futex(%rdi)
2176 + CMP_LP $-1, dep_mutex-cond_futex(%rdi)
2177 movl $0x7fffffff, %edx
2178 #ifdef __ASSUME_PRIVATE_FUTEX
2179 movl $FUTEX_WAKE, %eax
2180 @@ -488,9 +488,9 @@ __condvar_cleanup1:
2181 .hidden DW.ref.__gcc_personality_v0
2182 .weak DW.ref.__gcc_personality_v0
2183 .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
2184 - .align 8
2185 + .align LP_SIZE
2186 .type DW.ref.__gcc_personality_v0, @object
2187 - .size DW.ref.__gcc_personality_v0, 8
2188 + .size DW.ref.__gcc_personality_v0, LP_SIZE
2189 DW.ref.__gcc_personality_v0:
2190 - .quad __gcc_personality_v0
2191 + ASM_ADDR __gcc_personality_v0
2192 #endif
2193 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
2194 index ccc1849..4b28743 100644
2195 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
2196 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
2197 @@ -189,9 +189,9 @@ clear_once_control:
2198 .hidden DW.ref.__gcc_personality_v0
2199 .weak DW.ref.__gcc_personality_v0
2200 .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
2201 - .align 8
2202 + .align LP_SIZE
2203 .type DW.ref.__gcc_personality_v0, @object
2204 - .size DW.ref.__gcc_personality_v0, 8
2205 + .size DW.ref.__gcc_personality_v0, LP_SIZE
2206 DW.ref.__gcc_personality_v0:
2207 - .quad __gcc_personality_v0
2208 + ASM_ADDR __gcc_personality_v0
2209 #endif
2210 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
2211 index f5d055c..0e6a6ee 100644
2212 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
2213 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
2214 @@ -1,4 +1,4 @@
2215 -/* Copyright (C) 2002-2005, 2007, 2009, 2010 Free Software Foundation, Inc.
2216 +/* Copyright (C) 2002-2005,2007,2009,2010,2011 Free Software Foundation, Inc.
2217 This file is part of the GNU C Library.
2218 Contributed by Ulrich Drepper <drepper@××××××.com>, 2002.
2219
2220 @@ -23,10 +23,6 @@
2221 #include <pthread-errnos.h>
2222 #include <kernel-features.h>
2223
2224 -
2225 -/* For the calculation see asm/vsyscall.h. */
2226 -#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000
2227 -
2228 .text
2229
2230 .globl pthread_rwlock_timedrdlock
2231 @@ -123,8 +119,9 @@ pthread_rwlock_timedrdlock:
2232 /* Get current time. */
2233 movq %rsp, %rdi
2234 xorl %esi, %esi
2235 - movq $VSYSCALL_ADDR_vgettimeofday, %rax
2236 - callq *%rax
2237 + /* This call works because we directly jump to a system call entry
2238 + which preserves all the registers. */
2239 + call JUMPTARGET(__gettimeofday)
2240
2241 /* Compute relative timeout. */
2242 movq 8(%rsp), %rax
2243 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
2244 index 6ed8b49..16bf920 100644
2245 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
2246 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
2247 @@ -1,4 +1,5 @@
2248 -/* Copyright (C) 2002, 2003, 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
2249 +/* Copyright (C) 2002, 2003, 2005, 2007, 2009, 2010, 2011
2250 + Free Software Foundation, Inc.
2251 This file is part of the GNU C Library.
2252 Contributed by Ulrich Drepper <drepper@××××××.com>, 2002.
2253
2254 @@ -23,10 +24,6 @@
2255 #include <pthread-errnos.h>
2256 #include <kernel-features.h>
2257
2258 -
2259 -/* For the calculation see asm/vsyscall.h. */
2260 -#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000
2261 -
2262 .text
2263
2264 .globl pthread_rwlock_timedwrlock
2265 @@ -120,8 +117,9 @@ pthread_rwlock_timedwrlock:
2266 /* Get current time. */
2267 movq %rsp, %rdi
2268 xorl %esi, %esi
2269 - movq $VSYSCALL_ADDR_vgettimeofday, %rax
2270 - callq *%rax
2271 + /* This call works because we directly jump to a system call entry
2272 + which preserves all the registers. */
2273 + call JUMPTARGET(__gettimeofday)
2274
2275 /* Compute relative timeout. */
2276 movq 8(%rsp), %rax
2277 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
2278 index 979b1bf..2a631cf 100644
2279 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
2280 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
2281 @@ -46,7 +46,7 @@ sem_post:
2282 #endif
2283 jnz 0b
2284
2285 - cmpq $0, NWAITERS(%rdi)
2286 + CMP_LP $0, NWAITERS(%rdi)
2287 je 2f
2288
2289 movl $SYS_futex, %eax
2290 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
2291 index ca49cb8..b8db189 100644
2292 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
2293 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
2294 @@ -1,4 +1,4 @@
2295 -/* Copyright (C) 2002,2003,2005,2007,2009,2010 Free Software Foundation, Inc.
2296 +/* Copyright (C) 2002,2003,2005,2007,2009,2010,2011 Free Software Foundation, Inc.
2297 This file is part of the GNU C Library.
2298 Contributed by Ulrich Drepper <drepper@××××××.com>, 2002.
2299
2300 @@ -24,10 +24,6 @@
2301 #include <pthread-errnos.h>
2302 #include <structsem.h>
2303
2304 -
2305 -/* For the calculation see asm/vsyscall.h. */
2306 -#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000
2307 -
2308 .text
2309
2310 .globl sem_timedwait
2311 @@ -88,7 +84,7 @@ sem_timedwait:
2312 movq %rsi, %r10
2313
2314 LOCK
2315 - addq $1, NWAITERS(%rdi)
2316 + ADD_LP $1, NWAITERS(%rdi)
2317
2318 .LcleanupSTART:
2319 13: call __pthread_enable_asynccancel
2320 @@ -139,7 +135,7 @@ sem_timedwait:
2321 xorl %eax, %eax
2322
2323 15: LOCK
2324 - subq $1, NWAITERS(%rdi)
2325 + SUB_LP $1, NWAITERS(%rdi)
2326
2327 leaq 8(%rsp), %rsp
2328 cfi_adjust_cfa_offset(-8)
2329 @@ -209,12 +205,13 @@ sem_timedwait:
2330 movq %rsi, %r13
2331
2332 LOCK
2333 - addq $1, NWAITERS(%r12)
2334 + ADD_LP $1, NWAITERS(%r12)
2335
2336 7: xorl %esi, %esi
2337 - movq %rsp, %rdi
2338 - movq $VSYSCALL_ADDR_vgettimeofday, %rax
2339 - callq *%rax
2340 + movq %rsp,%rdi
2341 + /* This call works because we directly jump to a system call entry
2342 + which preserves all the registers. */
2343 + call JUMPTARGET(__gettimeofday)
2344
2345 /* Compute relative timeout. */
2346 movq 8(%rsp), %rax
2347 @@ -285,7 +282,7 @@ sem_timedwait:
2348 xorl %eax, %eax
2349
2350 45: LOCK
2351 - subq $1, NWAITERS(%r12)
2352 + SUB_LP $1, NWAITERS(%r12)
2353
2354 addq $STACKFRAME, %rsp
2355 cfi_adjust_cfa_offset(-STACKFRAME)
2356 @@ -328,7 +325,7 @@ sem_timedwait_cleanup:
2357
2358 movq (%rsp), %rdi
2359 LOCK
2360 - subq $1, NWAITERS(%rdi)
2361 + SUB_LP $1, NWAITERS(%rdi)
2362 movq %rax, %rdi
2363 .LcallUR:
2364 call _Unwind_Resume@PLT
2365 @@ -348,7 +345,7 @@ sem_timedwait_cleanup2:
2366 cfi_rel_offset(%r14, STACKFRAME)
2367
2368 LOCK
2369 - subq $1, NWAITERS(%r12)
2370 + SUB_LP $1, NWAITERS(%r12)
2371 movq %rax, %rdi
2372 movq STACKFRAME(%rsp), %r14
2373 movq STACKFRAME+8(%rsp), %r13
2374 @@ -396,9 +393,9 @@ sem_timedwait_cleanup2:
2375 .hidden DW.ref.__gcc_personality_v0
2376 .weak DW.ref.__gcc_personality_v0
2377 .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
2378 - .align 8
2379 + .align LP_SIZE
2380 .type DW.ref.__gcc_personality_v0, @object
2381 - .size DW.ref.__gcc_personality_v0, 8
2382 + .size DW.ref.__gcc_personality_v0, LP_SIZE
2383 DW.ref.__gcc_personality_v0:
2384 - .quad __gcc_personality_v0
2385 + ASM_ADDR __gcc_personality_v0
2386 #endif
2387 diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
2388 index 2cf6ec1..12d9e93 100644
2389 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
2390 +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
2391 @@ -67,7 +67,7 @@ sem_wait:
2392 cfi_adjust_cfa_offset(8)
2393
2394 LOCK
2395 - addq $1, NWAITERS(%rdi)
2396 + ADD_LP $1, NWAITERS(%rdi)
2397
2398 .LcleanupSTART:
2399 6: call __pthread_enable_asynccancel
2400 @@ -116,7 +116,7 @@ sem_wait:
2401 xorl %eax, %eax
2402
2403 9: LOCK
2404 - subq $1, NWAITERS(%rdi)
2405 + SUB_LP $1, NWAITERS(%rdi)
2406
2407 leaq 8(%rsp), %rsp
2408 cfi_adjust_cfa_offset(-8)
2409 @@ -143,7 +143,7 @@ sem_wait:
2410 sem_wait_cleanup:
2411 movq (%rsp), %rdi
2412 LOCK
2413 - subq $1, NWAITERS(%rdi)
2414 + SUB_LP $1, NWAITERS(%rdi)
2415 movq %rax, %rdi
2416 .LcallUR:
2417 call _Unwind_Resume@PLT
2418 @@ -175,9 +175,9 @@ sem_wait_cleanup:
2419 .hidden DW.ref.__gcc_personality_v0
2420 .weak DW.ref.__gcc_personality_v0
2421 .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
2422 - .align 8
2423 + .align LP_SIZE
2424 .type DW.ref.__gcc_personality_v0, @object
2425 - .size DW.ref.__gcc_personality_v0, 8
2426 + .size DW.ref.__gcc_personality_v0, LP_SIZE
2427 DW.ref.__gcc_personality_v0:
2428 - .quad __gcc_personality_v0
2429 + ASM_ADDR __gcc_personality_v0
2430 #endif
2431 diff --git a/nptl/sysdeps/x86_64/pthreaddef.h b/nptl/sysdeps/x86_64/pthreaddef.h
2432 index 8ec135c..1dbc0cf 100644
2433 --- a/nptl/sysdeps/x86_64/pthreaddef.h
2434 +++ b/nptl/sysdeps/x86_64/pthreaddef.h
2435 @@ -34,7 +34,7 @@
2436
2437 /* Location of current stack frame. The frame pointer is not usable. */
2438 #define CURRENT_STACK_FRAME \
2439 - ({ char *frame; asm ("movq %%rsp, %0" : "=r" (frame)); frame; })
2440 + ({ char *frame; asm ("mov %%" RSP_LP ", %0" : "=r" (frame)); frame; })
2441
2442
2443 /* XXX Until we have a better place keep the definitions here. */
2444 diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
2445 index 41b5e6d..0b45844 100644
2446 --- a/nptl/sysdeps/x86_64/tls.h
2447 +++ b/nptl/sysdeps/x86_64/tls.h
2448 @@ -28,7 +28,6 @@
2449 # include <stdlib.h>
2450 # include <sysdep.h>
2451 # include <kernel-features.h>
2452 -# include <bits/wordsize.h>
2453 # include <xmmintrin.h>
2454
2455
2456 @@ -61,17 +60,22 @@ typedef struct
2457 # else
2458 int __unused1;
2459 # endif
2460 -# if __WORDSIZE == 64
2461 +# ifdef __x86_64__
2462 int rtld_must_xmm_save;
2463 # endif
2464 /* Reservation of some values for the TM ABI. */
2465 void *__private_tm[5];
2466 -# if __WORDSIZE == 64
2467 +# ifdef __x86_64__
2468 +# ifdef __LP64__
2469 long int __unused2;
2470 +# else
2471 + /* Pad rtld_savespace_sse to 32byte aligned. */
2472 + void *__padding1[5];
2473 +# endif
2474 /* Have space for the post-AVX register size. */
2475 __m128 rtld_savespace_sse[8][4];
2476
2477 - void *__padding[8];
2478 + void *__padding2[8];
2479 # endif
2480 } tcbhead_t;
2481
2482 @@ -274,7 +278,7 @@ typedef struct
2483 abort (); \
2484 \
2485 asm volatile ("movq %q0,%%fs:%P1" : \
2486 - : IMM_MODE ((unsigned long int) value), \
2487 + : IMM_MODE ((unsigned long long int) value), \
2488 "i" (offsetof (struct pthread, member))); \
2489 }})
2490
2491 @@ -299,7 +303,7 @@ typedef struct
2492 abort (); \
2493 \
2494 asm volatile ("movq %q0,%%fs:%P1(,%q2,8)" : \
2495 - : IMM_MODE ((unsigned long int) value), \
2496 + : IMM_MODE ((unsigned long long int) value), \
2497 "i" (offsetof (struct pthread, member[0])), \
2498 "r" (idx)); \
2499 }})
2500 diff --git a/nptl/sysdeps/x86_64/x32/tls.h b/nptl/sysdeps/x86_64/x32/tls.h
2501 new file mode 100644
2502 index 0000000..6622b4e
2503 --- /dev/null
2504 +++ b/nptl/sysdeps/x86_64/x32/tls.h
2505 @@ -0,0 +1,49 @@
2506 +/* Definition for thread-local data handling. nptl/x32 version.
2507 + Copyright (C) 2011 Free Software Foundation, Inc.
2508 + This file is part of the GNU C Library.
2509 +
2510 + The GNU C Library is free software; you can redistribute it and/or
2511 + modify it under the terms of the GNU Lesser General Public
2512 + License as published by the Free Software Foundation; either
2513 + version 2.1 of the License, or (at your option) any later version.
2514 +
2515 + The GNU C Library is distributed in the hope that it will be useful,
2516 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2517 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2518 + Lesser General Public License for more details.
2519 +
2520 + You should have received a copy of the GNU Lesser General Public
2521 + License along with the GNU C Library; if not, write to the Free
2522 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2523 + 02111-1307 USA. */
2524 +
2525 +#ifndef _X32_TLS_H
2526 +#define _X32_TLS_H 1
2527 +
2528 +#include <sysdeps/x86_64/tls.h>
2529 +
2530 +#ifndef __ASSEMBLER__
2531 +
2532 +# undef THREAD_SELF
2533 +# define THREAD_SELF \
2534 + ({ struct pthread *__self; \
2535 + asm ("movl %%fs:%c1,%k0" : "=r" (__self) \
2536 + : "i" (offsetof (struct pthread, header.self))); \
2537 + __self;})
2538 +
2539 +# undef CALL_THREAD_FCT
2540 +# define CALL_THREAD_FCT(descr) \
2541 + ({ void *__res; \
2542 + asm volatile ("movl %%fs:%P2, %%edi\n\t" \
2543 + "movl %%fs:%P1, %k0\n\t" \
2544 + "callq *%q0" \
2545 + : "=a" (__res) \
2546 + : "i" (offsetof (struct pthread, start_routine)), \
2547 + "i" (offsetof (struct pthread, arg)) \
2548 + : "di", "si", "cx", "dx", "r8", "r9", "r10", "r11", \
2549 + "memory", "cc"); \
2550 + __res; })
2551 +
2552 +#endif /* __ASSEMBLER__ */
2553 +
2554 +#endif /* x32/tls.h */
2555 diff --git a/nptl/unwind.c b/nptl/unwind.c
2556 index 9a35695..37eeba7 100644
2557 --- a/nptl/unwind.c
2558 +++ b/nptl/unwind.c
2559 @@ -69,7 +69,7 @@ unwind_stop (int version, _Unwind_Action actions,
2560 registered with the old method which would be unwound by this
2561 step. */
2562 struct _pthread_cleanup_buffer *oldp = buf->priv.data.cleanup;
2563 - void *cfa = (void *) _Unwind_GetCFA (context);
2564 + void *cfa = (void *) (_Unwind_Ptr) _Unwind_GetCFA (context);
2565
2566 if (curp != oldp && (do_longjump || FRAME_LEFT (cfa, curp, adj)))
2567 {
2568 diff --git a/scripts/data/c++-types-x32-linux-gnu.data b/scripts/data/c++-types-x32-linux-gnu.data
2569 new file mode 100644
2570 index 0000000..0a89e27
2571 --- /dev/null
2572 +++ b/scripts/data/c++-types-x32-linux-gnu.data
2573 @@ -0,0 +1,67 @@
2574 +blkcnt64_t:x
2575 +blkcnt_t:x
2576 +blksize_t:x
2577 +caddr_t:Pc
2578 +clockid_t:i
2579 +clock_t:l
2580 +daddr_t:i
2581 +dev_t:y
2582 +fd_mask:l
2583 +fsblkcnt64_t:y
2584 +fsblkcnt_t:y
2585 +fsfilcnt64_t:y
2586 +fsfilcnt_t:y
2587 +fsid_t:8__fsid_t
2588 +gid_t:j
2589 +id_t:j
2590 +ino64_t:y
2591 +ino_t:y
2592 +int16_t:s
2593 +int32_t:i
2594 +int64_t:x
2595 +int8_t:a
2596 +intptr_t:i
2597 +key_t:i
2598 +loff_t:x
2599 +mode_t:j
2600 +nlink_t:y
2601 +off64_t:x
2602 +off_t:x
2603 +pid_t:i
2604 +pthread_attr_t:14pthread_attr_t
2605 +pthread_barrier_t:17pthread_barrier_t
2606 +pthread_barrierattr_t:21pthread_barrierattr_t
2607 +pthread_cond_t:14pthread_cond_t
2608 +pthread_condattr_t:18pthread_condattr_t
2609 +pthread_key_t:j
2610 +pthread_mutex_t:15pthread_mutex_t
2611 +pthread_mutexattr_t:19pthread_mutexattr_t
2612 +pthread_once_t:i
2613 +pthread_rwlock_t:16pthread_rwlock_t
2614 +pthread_rwlockattr_t:20pthread_rwlockattr_t
2615 +pthread_spinlock_t:i
2616 +pthread_t:m
2617 +quad_t:x
2618 +register_t:x
2619 +rlim64_t:y
2620 +rlim_t:y
2621 +sigset_t:10__sigset_t
2622 +size_t:j
2623 +socklen_t:j
2624 +ssize_t:i
2625 +suseconds_t:x
2626 +time_t:x
2627 +u_char:h
2628 +uid_t:j
2629 +uint:j
2630 +u_int:j
2631 +u_int16_t:t
2632 +u_int32_t:j
2633 +u_int64_t:y
2634 +u_int8_t:h
2635 +ulong:m
2636 +u_long:m
2637 +u_quad_t:y
2638 +useconds_t:j
2639 +ushort:t
2640 +u_short:t
2641 diff --git a/shlib-versions b/shlib-versions
2642 index d3e8407..75e0365 100644
2643 --- a/shlib-versions
2644 +++ b/shlib-versions
2645 @@ -28,7 +28,6 @@
2646
2647 s390x-.*-linux.* DEFAULT GLIBC_2.2
2648 cris-.*-linux.* DEFAULT GLIBC_2.2
2649 -x86_64-.*-linux.* DEFAULT GLIBC_2.2.5
2650 powerpc64-.*-linux.* DEFAULT GLIBC_2.3
2651 .*-.*-gnu-gnu.* DEFAULT GLIBC_2.2.6
2652
2653 @@ -85,7 +84,6 @@ ia64-.*-linux.* ld=ld-linux-ia64.so.2 GLIBC_2.2
2654 s390x-.*-linux.* ld=ld64.so.1 GLIBC_2.2
2655 powerpc64.*-.*-linux.* ld=ld64.so.1 GLIBC_2.3
2656 cris-.*-linux.* ld=ld.so.1 GLIBC_2.2
2657 -x86_64-.*-linux.* ld=ld-linux-x86-64.so.2 GLIBC_2.2.5
2658 # We use the ELF ABI standard name for the default.
2659 .*-.*-.* ld=ld.so.1
2660
2661 diff --git a/stdio-common/_itoa.c b/stdio-common/_itoa.c
2662 index 373843f..abb28aa 100644
2663 --- a/stdio-common/_itoa.c
2664 +++ b/stdio-common/_itoa.c
2665 @@ -80,7 +80,7 @@ struct base_table_t
2666
2667
2668 /* We do not compile _itoa if we always can use _itoa_word. */
2669 -#if LLONG_MAX != LONG_MAX
2670 +#if LLONG_MAX != LONG_MAX && !defined PREFER_LONG_LONG
2671 /* Local variables. */
2672 const struct base_table_t _itoa_base_table[] attribute_hidden =
2673 {
2674 @@ -202,7 +202,6 @@ _itoa_word (unsigned long value, char *buflim,
2675 }
2676 return buflim;
2677 }
2678 -#undef SPECIAL
2679
2680
2681 #if LLONG_MAX != LONG_MAX
2682 @@ -216,11 +215,31 @@ _itoa (value, buflim, base, upper_case)
2683 const char *digits = (upper_case
2684 ? INTUSE(_itoa_upper_digits)
2685 : INTUSE(_itoa_lower_digits));
2686 +
2687 +# ifdef PREFER_LONG_LONG
2688 + switch (base)
2689 + {
2690 +#define SPECIAL(Base) \
2691 + case Base: \
2692 + do \
2693 + *--buflim = digits[value % Base]; \
2694 + while ((value /= Base) != 0); \
2695 + break
2696 +
2697 + SPECIAL (10);
2698 + SPECIAL (16);
2699 + SPECIAL (8);
2700 + default:
2701 + do
2702 + *--buflim = digits[value % base];
2703 + while ((value /= base) != 0);
2704 + }
2705 +# else
2706 const struct base_table_t *brec = &_itoa_base_table[base - 2];
2707
2708 switch (base)
2709 {
2710 -# define RUN_2N(BITS) \
2711 +# define RUN_2N(BITS) \
2712 do \
2713 { \
2714 /* `unsigned long long int' always has 64 bits. */ \
2715 @@ -275,7 +294,7 @@ _itoa (value, buflim, base, upper_case)
2716 default:
2717 {
2718 char *bufend = buflim;
2719 -# if BITS_PER_MP_LIMB == 64
2720 +# if BITS_PER_MP_LIMB == 64
2721 mp_limb_t base_multiplier = brec->base_multiplier;
2722 if (brec->flag)
2723 while (value != 0)
2724 @@ -299,8 +318,8 @@ _itoa (value, buflim, base, upper_case)
2725 *--buflim = digits[rem];
2726 value = quo;
2727 }
2728 -# endif
2729 -# if BITS_PER_MP_LIMB == 32
2730 +# endif
2731 +# if BITS_PER_MP_LIMB == 32
2732 mp_limb_t t[3];
2733 int n;
2734
2735 @@ -308,11 +327,11 @@ _itoa (value, buflim, base, upper_case)
2736 Optimize for frequent cases of 32 bit numbers. */
2737 if ((mp_limb_t) (value >> 32) >= 1)
2738 {
2739 -# if UDIV_TIME > 2 * UMUL_TIME || UDIV_NEEDS_NORMALIZATION
2740 +# if UDIV_TIME > 2 * UMUL_TIME || UDIV_NEEDS_NORMALIZATION
2741 int big_normalization_steps = brec->big.normalization_steps;
2742 mp_limb_t big_base_norm
2743 = brec->big.base << big_normalization_steps;
2744 -# endif
2745 +# endif
2746 if ((mp_limb_t) (value >> 32) >= brec->big.base)
2747 {
2748 mp_limb_t x1hi, x1lo, r;
2749 @@ -321,7 +340,7 @@ _itoa (value, buflim, base, upper_case)
2750 always be very small. It might be faster just to
2751 subtract in a tight loop. */
2752
2753 -# if UDIV_TIME > 2 * UMUL_TIME
2754 +# if UDIV_TIME > 2 * UMUL_TIME
2755 mp_limb_t x, xh, xl;
2756
2757 if (big_normalization_steps == 0)
2758 @@ -346,7 +365,7 @@ _itoa (value, buflim, base, upper_case)
2759 udiv_qrnnd_preinv (t[0], x, xh, xl, big_base_norm,
2760 brec->big.base_ninv);
2761 t[1] = x >> big_normalization_steps;
2762 -# elif UDIV_NEEDS_NORMALIZATION
2763 +# elif UDIV_NEEDS_NORMALIZATION
2764 mp_limb_t x, xh, xl;
2765
2766 if (big_normalization_steps == 0)
2767 @@ -368,17 +387,17 @@ _itoa (value, buflim, base, upper_case)
2768 xl = x1lo << big_normalization_steps;
2769 udiv_qrnnd (t[0], x, xh, xl, big_base_norm);
2770 t[1] = x >> big_normalization_steps;
2771 -# else
2772 +# else
2773 udiv_qrnnd (x1hi, r, 0, (mp_limb_t) (value >> 32),
2774 brec->big.base);
2775 udiv_qrnnd (x1lo, t[2], r, (mp_limb_t) value, brec->big.base);
2776 udiv_qrnnd (t[0], t[1], x1hi, x1lo, brec->big.base);
2777 -# endif
2778 +# endif
2779 n = 3;
2780 }
2781 else
2782 {
2783 -# if UDIV_TIME > 2 * UMUL_TIME
2784 +# if UDIV_TIME > 2 * UMUL_TIME
2785 mp_limb_t x;
2786
2787 value <<= brec->big.normalization_steps;
2788 @@ -386,17 +405,17 @@ _itoa (value, buflim, base, upper_case)
2789 (mp_limb_t) value, big_base_norm,
2790 brec->big.base_ninv);
2791 t[1] = x >> brec->big.normalization_steps;
2792 -# elif UDIV_NEEDS_NORMALIZATION
2793 +# elif UDIV_NEEDS_NORMALIZATION
2794 mp_limb_t x;
2795
2796 value <<= big_normalization_steps;
2797 udiv_qrnnd (t[0], x, (mp_limb_t) (value >> 32),
2798 (mp_limb_t) value, big_base_norm);
2799 t[1] = x >> big_normalization_steps;
2800 -# else
2801 +# else
2802 udiv_qrnnd (t[0], t[1], (mp_limb_t) (value >> 32),
2803 (mp_limb_t) value, brec->big.base);
2804 -# endif
2805 +# endif
2806 n = 2;
2807 }
2808 }
2809 @@ -412,7 +431,7 @@ _itoa (value, buflim, base, upper_case)
2810 mp_limb_t ti = t[--n];
2811 int ndig_for_this_limb = 0;
2812
2813 -# if UDIV_TIME > 2 * UMUL_TIME
2814 +# if UDIV_TIME > 2 * UMUL_TIME
2815 mp_limb_t base_multiplier = brec->base_multiplier;
2816 if (brec->flag)
2817 while (ti != 0)
2818 @@ -438,7 +457,7 @@ _itoa (value, buflim, base, upper_case)
2819 ti = quo;
2820 ++ndig_for_this_limb;
2821 }
2822 -# else
2823 +# else
2824 while (ti != 0)
2825 {
2826 mp_limb_t quo, rem;
2827 @@ -449,7 +468,7 @@ _itoa (value, buflim, base, upper_case)
2828 ti = quo;
2829 ++ndig_for_this_limb;
2830 }
2831 -# endif
2832 +# endif
2833 /* If this wasn't the most significant word, pad with zeros. */
2834 if (n != 0)
2835 while (ndig_for_this_limb < brec->big.ndigits)
2836 @@ -459,17 +478,20 @@ _itoa (value, buflim, base, upper_case)
2837 }
2838 }
2839 while (n != 0);
2840 -# endif
2841 +# endif
2842 if (buflim == bufend)
2843 *--buflim = '0';
2844 }
2845 break;
2846 }
2847 +# endif /* PREFER_LONG_LONG */
2848
2849 return buflim;
2850 }
2851 #endif
2852
2853 +#undef SPECIAL
2854 +
2855 char *
2856 _fitoa_word (unsigned long value, char *buf, unsigned int base, int upper_case)
2857 {
2858 diff --git a/stdio-common/_itowa.c b/stdio-common/_itowa.c
2859 index 09a961d..689798f 100644
2860 --- a/stdio-common/_itowa.c
2861 +++ b/stdio-common/_itowa.c
2862 @@ -97,11 +97,32 @@ _itowa (value, buflim, base, upper_case)
2863 const wchar_t *digits = (upper_case
2864 ? _itowa_upper_digits : _itowa_lower_digits);
2865 wchar_t *bp = buflim;
2866 +
2867 +# ifdef PREFER_LONG_LONG
2868 + switch (base)
2869 + {
2870 +# define SPECIAL(Base) \
2871 + case Base: \
2872 + do \
2873 + *--bp = digits[value % Base]; \
2874 + while ((value /= Base) != 0); \
2875 + break
2876 +
2877 + SPECIAL (10);
2878 + SPECIAL (16);
2879 + SPECIAL (8);
2880 + default:
2881 + do
2882 + *--bp = digits[value % base];
2883 + while ((value /= base) != 0);
2884 + }
2885 +# undef SPECIAL
2886 +# else
2887 const struct base_table_t *brec = &_itoa_base_table[base - 2];
2888
2889 switch (base)
2890 {
2891 -# define RUN_2N(BITS) \
2892 +# define RUN_2N(BITS) \
2893 do \
2894 { \
2895 /* `unsigned long long int' always has 64 bits. */ \
2896 @@ -155,7 +176,7 @@ _itowa (value, buflim, base, upper_case)
2897
2898 default:
2899 {
2900 -# if BITS_PER_MP_LIMB == 64
2901 +# if BITS_PER_MP_LIMB == 64
2902 mp_limb_t base_multiplier = brec->base_multiplier;
2903 if (brec->flag)
2904 while (value != 0)
2905 @@ -179,8 +200,8 @@ _itowa (value, buflim, base, upper_case)
2906 *--bp = digits[rem];
2907 value = quo;
2908 }
2909 -# endif
2910 -# if BITS_PER_MP_LIMB == 32
2911 +# endif
2912 +# if BITS_PER_MP_LIMB == 32
2913 mp_limb_t t[3];
2914 int n;
2915
2916 @@ -188,11 +209,11 @@ _itowa (value, buflim, base, upper_case)
2917 Optimize for frequent cases of 32 bit numbers. */
2918 if ((mp_limb_t) (value >> 32) >= 1)
2919 {
2920 -# if UDIV_TIME > 2 * UMUL_TIME || UDIV_NEEDS_NORMALIZATION
2921 +# if UDIV_TIME > 2 * UMUL_TIME || UDIV_NEEDS_NORMALIZATION
2922 int big_normalization_steps = brec->big.normalization_steps;
2923 mp_limb_t big_base_norm
2924 = brec->big.base << big_normalization_steps;
2925 -# endif
2926 +# endif
2927 if ((mp_limb_t) (value >> 32) >= brec->big.base)
2928 {
2929 mp_limb_t x1hi, x1lo, r;
2930 @@ -201,7 +222,7 @@ _itowa (value, buflim, base, upper_case)
2931 always be very small. It might be faster just to
2932 subtract in a tight loop. */
2933
2934 -# if UDIV_TIME > 2 * UMUL_TIME
2935 +# if UDIV_TIME > 2 * UMUL_TIME
2936 mp_limb_t x, xh, xl;
2937
2938 if (big_normalization_steps == 0)
2939 @@ -226,7 +247,7 @@ _itowa (value, buflim, base, upper_case)
2940 udiv_qrnnd_preinv (t[0], x, xh, xl, big_base_norm,
2941 brec->big.base_ninv);
2942 t[1] = x >> big_normalization_steps;
2943 -# elif UDIV_NEEDS_NORMALIZATION
2944 +# elif UDIV_NEEDS_NORMALIZATION
2945 mp_limb_t x, xh, xl;
2946
2947 if (big_normalization_steps == 0)
2948 @@ -248,17 +269,17 @@ _itowa (value, buflim, base, upper_case)
2949 xl = x1lo << big_normalization_steps;
2950 udiv_qrnnd (t[0], x, xh, xl, big_base_norm);
2951 t[1] = x >> big_normalization_steps;
2952 -# else
2953 +# else
2954 udiv_qrnnd (x1hi, r, 0, (mp_limb_t) (value >> 32),
2955 brec->big.base);
2956 udiv_qrnnd (x1lo, t[2], r, (mp_limb_t) value, brec->big.base);
2957 udiv_qrnnd (t[0], t[1], x1hi, x1lo, brec->big.base);
2958 -# endif
2959 +# endif
2960 n = 3;
2961 }
2962 else
2963 {
2964 -# if UDIV_TIME > 2 * UMUL_TIME
2965 +# if UDIV_TIME > 2 * UMUL_TIME
2966 mp_limb_t x;
2967
2968 value <<= brec->big.normalization_steps;
2969 @@ -266,17 +287,17 @@ _itowa (value, buflim, base, upper_case)
2970 (mp_limb_t) value, big_base_norm,
2971 brec->big.base_ninv);
2972 t[1] = x >> brec->big.normalization_steps;
2973 -# elif UDIV_NEEDS_NORMALIZATION
2974 +# elif UDIV_NEEDS_NORMALIZATION
2975 mp_limb_t x;
2976
2977 value <<= big_normalization_steps;
2978 udiv_qrnnd (t[0], x, (mp_limb_t) (value >> 32),
2979 (mp_limb_t) value, big_base_norm);
2980 t[1] = x >> big_normalization_steps;
2981 -# else
2982 +# else
2983 udiv_qrnnd (t[0], t[1], (mp_limb_t) (value >> 32),
2984 (mp_limb_t) value, brec->big.base);
2985 -# endif
2986 +# endif
2987 n = 2;
2988 }
2989 }
2990 @@ -292,7 +313,7 @@ _itowa (value, buflim, base, upper_case)
2991 mp_limb_t ti = t[--n];
2992 int ndig_for_this_limb = 0;
2993
2994 -# if UDIV_TIME > 2 * UMUL_TIME
2995 +# if UDIV_TIME > 2 * UMUL_TIME
2996 mp_limb_t base_multiplier = brec->base_multiplier;
2997 if (brec->flag)
2998 while (ti != 0)
2999 @@ -318,7 +339,7 @@ _itowa (value, buflim, base, upper_case)
3000 ti = quo;
3001 ++ndig_for_this_limb;
3002 }
3003 -# else
3004 +# else
3005 while (ti != 0)
3006 {
3007 mp_limb_t quo, rem;
3008 @@ -329,7 +350,7 @@ _itowa (value, buflim, base, upper_case)
3009 ti = quo;
3010 ++ndig_for_this_limb;
3011 }
3012 -# endif
3013 +# endif
3014 /* If this wasn't the most significant word, pad with zeros. */
3015 if (n != 0)
3016 while (ndig_for_this_limb < brec->big.ndigits)
3017 @@ -339,10 +360,11 @@ _itowa (value, buflim, base, upper_case)
3018 }
3019 }
3020 while (n != 0);
3021 -# endif
3022 +# endif
3023 }
3024 break;
3025 }
3026 +# endif /* PREFER_LONG_LONG */
3027
3028 return bp;
3029 }
3030 diff --git a/stdlib/longlong.h b/stdlib/longlong.h
3031 index 1bab76d..d5c0cd9 100644
3032 --- a/stdlib/longlong.h
3033 +++ b/stdlib/longlong.h
3034 @@ -430,8 +430,8 @@ UDItype __umulsidi3 (USItype, USItype);
3035 : "0" ((UDItype) (n0)), \
3036 "1" ((UDItype) (n1)), \
3037 "rm" ((UDItype) (dv)))
3038 -#define count_leading_zeros(count, x) ((count) = __builtin_clzl (x))
3039 -#define count_trailing_zeros(count, x) ((count) = __builtin_ctzl (x))
3040 +#define count_leading_zeros(count, x) ((count) = __builtin_clzll (x))
3041 +#define count_trailing_zeros(count, x) ((count) = __builtin_ctzll (x))
3042 #define UMUL_TIME 40
3043 #define UDIV_TIME 40
3044 #endif /* x86_64 */
3045 diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h
3046 index fadd5ec..57ead17 100644
3047 --- a/sysdeps/generic/ldconfig.h
3048 +++ b/sysdeps/generic/ldconfig.h
3049 @@ -34,6 +34,7 @@
3050 #define FLAG_POWERPC_LIB64 0x0500
3051 #define FLAG_MIPS64_LIBN32 0x0600
3052 #define FLAG_MIPS64_LIBN64 0x0700
3053 +#define FLAG_X8664_LIBX32 0x0800
3054
3055 /* Name of auxiliary cache. */
3056 #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"
3057 diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
3058 index d040590..3f8264a 100644
3059 --- a/sysdeps/generic/ldsodefs.h
3060 +++ b/sysdeps/generic/ldsodefs.h
3061 @@ -230,6 +230,10 @@ struct audit_ifaces
3062 uintptr_t *, struct La_x86_64_regs *,
3063 unsigned int *, const char *name,
3064 long int *framesizep);
3065 + Elf32_Addr (*x32_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
3066 + uintptr_t *, struct La_x86_64_regs *,
3067 + unsigned int *, const char *name,
3068 + long int *framesizep);
3069 Elf32_Addr (*ppc32_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
3070 uintptr_t *, struct La_ppc32_regs *,
3071 unsigned int *, const char *name,
3072 @@ -282,6 +286,11 @@ struct audit_ifaces
3073 const struct La_x86_64_regs *,
3074 struct La_x86_64_retval *,
3075 const char *);
3076 + unsigned int (*x32_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
3077 + uintptr_t *,
3078 + const struct La_x86_64_regs *,
3079 + struct La_x86_64_retval *,
3080 + const char *);
3081 unsigned int (*ppc32_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
3082 uintptr_t *,
3083 const struct La_ppc32_regs *,
3084 diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c
3085 index f7c9ea5..2fbbd64 100644
3086 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c
3087 +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c
3088 @@ -1 +1,80 @@
3089 -/* The code is the same as lround. Use an alias, see l_round.c. */
3090 +/* Round double value to long long int.
3091 + Copyright (C) 1997, 2004, 2009, 2011 Free Software Foundation, Inc.
3092 + This file is part of the GNU C Library.
3093 + Contributed by Ulrich Drepper <drepper@××××××.com>, 1997.
3094 +
3095 + The GNU C Library is free software; you can redistribute it and/or
3096 + modify it under the terms of the GNU Lesser General Public
3097 + License as published by the Free Software Foundation; either
3098 + version 2.1 of the License, or (at your option) any later version.
3099 +
3100 + The GNU C Library is distributed in the hope that it will be useful,
3101 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3102 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3103 + Lesser General Public License for more details.
3104 +
3105 + You should have received a copy of the GNU Lesser General Public
3106 + License along with the GNU C Library; if not, write to the Free
3107 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3108 + 02111-1307 USA. */
3109 +
3110 +#define lround __hidden_lround
3111 +#define __lround __hidden___lround
3112 +
3113 +#include <math.h>
3114 +
3115 +#include "math_private.h"
3116 +
3117 +
3118 +long long int
3119 +__llround (double x)
3120 +{
3121 + int32_t j0;
3122 + int64_t i0;
3123 + long long int result;
3124 + int sign;
3125 +
3126 + EXTRACT_WORDS64 (i0, x);
3127 + j0 = ((i0 >> 52) & 0x7ff) - 0x3ff;
3128 + sign = i0 < 0 ? -1 : 1;
3129 + i0 &= UINT64_C(0xfffffffffffff);
3130 + i0 |= UINT64_C(0x10000000000000);
3131 +
3132 + if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
3133 + {
3134 + if (j0 < 0)
3135 + return j0 < -1 ? 0 : sign;
3136 + else if (j0 >= 52)
3137 + result = i0 << (j0 - 52);
3138 + else
3139 + {
3140 + i0 += UINT64_C(0x8000000000000) >> j0;
3141 +
3142 + result = i0 >> (52 - j0);
3143 + }
3144 + }
3145 + else
3146 + {
3147 + /* The number is too large. It is left implementation defined
3148 + what happens. */
3149 + return (long long int) x;
3150 + }
3151 +
3152 + return sign * result;
3153 +}
3154 +
3155 +weak_alias (__llround, llround)
3156 +#ifdef NO_LONG_DOUBLE
3157 +strong_alias (__llround, __lroundl)
3158 +weak_alias (__llround, lroundl)
3159 +#endif
3160 +
3161 +/* long has the same width as long long on 64-bit machines. */
3162 +#undef lround
3163 +#undef __lround
3164 +strong_alias (__llround, __lround)
3165 +weak_alias (__llround, lround)
3166 +#ifdef NO_LONG_DOUBLE
3167 +strong_alias (__llround, __llroundl)
3168 +weak_alias (__llround, llroundl)
3169 +#endif
3170 diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
3171 index 30ea5db..16db260 100644
3172 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
3173 +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
3174 @@ -1,80 +1 @@
3175 -/* Round double value to long int.
3176 - Copyright (C) 1997, 2004, 2009 Free Software Foundation, Inc.
3177 - This file is part of the GNU C Library.
3178 - Contributed by Ulrich Drepper <drepper@××××××.com>, 1997.
3179 -
3180 - The GNU C Library is free software; you can redistribute it and/or
3181 - modify it under the terms of the GNU Lesser General Public
3182 - License as published by the Free Software Foundation; either
3183 - version 2.1 of the License, or (at your option) any later version.
3184 -
3185 - The GNU C Library is distributed in the hope that it will be useful,
3186 - but WITHOUT ANY WARRANTY; without even the implied warranty of
3187 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3188 - Lesser General Public License for more details.
3189 -
3190 - You should have received a copy of the GNU Lesser General Public
3191 - License along with the GNU C Library; if not, write to the Free
3192 - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3193 - 02111-1307 USA. */
3194 -
3195 -#define llround __hidden_llround
3196 -#define __llround __hidden___llround
3197 -
3198 -#include <math.h>
3199 -
3200 -#include "math_private.h"
3201 -
3202 -
3203 -long int
3204 -__lround (double x)
3205 -{
3206 - int32_t j0;
3207 - int64_t i0;
3208 - long int result;
3209 - int sign;
3210 -
3211 - EXTRACT_WORDS64 (i0, x);
3212 - j0 = ((i0 >> 52) & 0x7ff) - 0x3ff;
3213 - sign = i0 < 0 ? -1 : 1;
3214 - i0 &= UINT64_C(0xfffffffffffff);
3215 - i0 |= UINT64_C(0x10000000000000);
3216 -
3217 - if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
3218 - {
3219 - if (j0 < 0)
3220 - return j0 < -1 ? 0 : sign;
3221 - else if (j0 >= 52)
3222 - result = i0 << (j0 - 52);
3223 - else
3224 - {
3225 - i0 += UINT64_C(0x8000000000000) >> j0;
3226 -
3227 - result = i0 >> (52 - j0);
3228 - }
3229 - }
3230 - else
3231 - {
3232 - /* The number is too large. It is left implementation defined
3233 - what happens. */
3234 - return (long int) x;
3235 - }
3236 -
3237 - return sign * result;
3238 -}
3239 -
3240 -weak_alias (__lround, lround)
3241 -#ifdef NO_LONG_DOUBLE
3242 -strong_alias (__lround, __lroundl)
3243 -weak_alias (__lround, lroundl)
3244 -#endif
3245 -
3246 -/* long long has the same width as long on 64-bit machines. */
3247 -#undef llround
3248 -#undef __llround
3249 -strong_alias (__lround, __llround)
3250 -weak_alias (__lround, llround)
3251 -#ifdef NO_LONG_DOUBLE
3252 -strong_alias (__lround, __llroundl)
3253 -weak_alias (__lround, llroundl)
3254 -#endif
3255 +/* The code is the same as llround. Use an alias, see ll_round.c. */
3256 diff --git a/sysdeps/mach/hurd/bits/typesizes.h b/sysdeps/mach/hurd/bits/typesizes.h
3257 index 4322617..8db5866 100644
3258 --- a/sysdeps/mach/hurd/bits/typesizes.h
3259 +++ b/sysdeps/mach/hurd/bits/typesizes.h
3260 @@ -58,6 +58,7 @@
3261 #define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
3262 #define __FSID_T_TYPE __UQUAD_TYPE
3263 #define __SSIZE_T_TYPE __SWORD_TYPE
3264 +#define __SNSECONDS_T_TYPE __SLONGWORD_TYPE
3265
3266 /* Number of descriptors that can fit in an `fd_set'. */
3267 #define __FD_SETSIZE 256
3268 diff --git a/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h b/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h
3269 index c0e267f..26ea5a6 100644
3270 --- a/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h
3271 +++ b/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h
3272 @@ -58,6 +58,7 @@
3273 #define __BLKSIZE_T_TYPE __U32_TYPE
3274 #define __FSID_T_TYPE struct { int __val[2]; }
3275 #define __SSIZE_T_TYPE __SWORD_TYPE
3276 +#define __SNSECONDS_T_TYPE __SLONGWORD_TYPE
3277
3278 /* Number of descriptors that can fit in an `fd_set'. */
3279 #define __FD_SETSIZE 1024
3280 diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
3281 index 05834e3..9087230 100644
3282 --- a/sysdeps/unix/sysv/linux/Makefile
3283 +++ b/sysdeps/unix/sysv/linux/Makefile
3284 @@ -37,6 +37,7 @@ install-others += $(inst_includedir)/bits/syscall.h
3285
3286 tests += tst-clone
3287
3288 +ifeq (yes,$(use-default-syscall-macros))
3289 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
3290 # For bi-arch platforms, the CPU/Makefile defines {32,64}bit-predefine and
3291 # we generate a file that uses <bits/wordsize.h>.
3292 @@ -81,6 +82,7 @@ else
3293 endif
3294 rm -f $(@:.h=.d)-t1 $(@:.h=.d)-t2
3295 mv -f $(@:.h=.d)-t3 $(@:.h=.d)
3296 +endif
3297
3298 $(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h $(+force)
3299 $(make-target-directory)
3300 diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
3301 index d05bd13..e8b3e45 100644
3302 --- a/sysdeps/unix/sysv/linux/configure
3303 +++ b/sysdeps/unix/sysv/linux/configure
3304 @@ -332,6 +332,9 @@ case "$machine" in
3305 libc_cv_gcc_unwind_find_fde=yes
3306 arch_minimum_kernel=2.0.10
3307 ;;
3308 + x86_64/x32*)
3309 + arch_minimum_kernel=2.6.35
3310 + ;;
3311 x86_64*)
3312 arch_minimum_kernel=2.4.0
3313 ;;
3314 @@ -412,7 +415,7 @@ case "$prefix" in
3315 # and libc_cv_localedir.
3316 test -n "$libc_cv_slibdir" || \
3317 case $machine in
3318 - sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64)
3319 + sparc/sparc64 | x86_64/64 | powerpc/powerpc64 | s390/s390-64)
3320 libc_cv_slibdir="/lib64"
3321 if test "$libdir" = '${exec_prefix}/lib'; then
3322 libdir='${exec_prefix}/lib64';
3323 diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in
3324 index 8f00407..617622c 100644
3325 --- a/sysdeps/unix/sysv/linux/configure.in
3326 +++ b/sysdeps/unix/sysv/linux/configure.in
3327 @@ -89,6 +89,9 @@ case "$machine" in
3328 libc_cv_gcc_unwind_find_fde=yes
3329 arch_minimum_kernel=2.0.10
3330 ;;
3331 + x86_64/x32*)
3332 + arch_minimum_kernel=2.6.35
3333 + ;;
3334 x86_64*)
3335 arch_minimum_kernel=2.4.0
3336 ;;
3337 @@ -151,7 +154,7 @@ case "$prefix" in
3338 # and libc_cv_localedir.
3339 test -n "$libc_cv_slibdir" || \
3340 case $machine in
3341 - sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64)
3342 + sparc/sparc64 | x86_64/64 | powerpc/powerpc64 | s390/s390-64)
3343 libc_cv_slibdir="/lib64"
3344 if test "$libdir" = '${exec_prefix}/lib'; then
3345 libdir='${exec_prefix}/lib64';
3346 diff --git a/sysdeps/unix/sysv/linux/i386/readelflib.c b/sysdeps/unix/sysv/linux/i386/readelflib.c
3347 index a6374e6..6e39b3d 100644
3348 --- a/sysdeps/unix/sysv/linux/i386/readelflib.c
3349 +++ b/sysdeps/unix/sysv/linux/i386/readelflib.c
3350 @@ -36,8 +36,18 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
3351 int ret;
3352
3353 if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
3354 - return process_elf32_file (file_name, lib, flag, osversion, soname,
3355 - file_contents, file_length);
3356 + {
3357 + ret = process_elf32_file (file_name, lib, flag, osversion, soname,
3358 + file_contents, file_length);
3359 + /* X32 libraries are always libc.so.6+. */
3360 + if (!ret)
3361 + switch (elf_header->e_machine)
3362 + {
3363 + case EM_X86_64:
3364 + *flag = FLAG_X8664_LIBX32|FLAG_ELF_LIBC6;
3365 + break;
3366 + }
3367 + }
3368 else
3369 {
3370 switch (elf_header->e_machine)
3371 diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
3372 index d91f581..58f833e 100644
3373 --- a/sysdeps/unix/sysv/linux/kernel-features.h
3374 +++ b/sysdeps/unix/sysv/linux/kernel-features.h
3375 @@ -546,3 +546,8 @@
3376 #if __LINUX_KERNEL_VERSION >= 0x020627
3377 # define __ASSUME_SENDMMSG 1
3378 #endif
3379 +
3380 +/* getcpu is a syscall for x86-64 since 3.1. */
3381 +#if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
3382 +# define __ASSUME_GETCPU_SYSCALL 1
3383 +#endif
3384 diff --git a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
3385 index 2d9cd87..b97f42a 100644
3386 --- a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
3387 +++ b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
3388 @@ -64,6 +64,7 @@
3389 /* size_t is unsigned long int on s390 -m31. */
3390 #define __SSIZE_T_TYPE __SLONGWORD_TYPE
3391 #endif
3392 +#define __SNSECONDS_T_TYPE __SLONGWORD_TYPE
3393
3394 /* Number of descriptors that can fit in an `fd_set'. */
3395 #define __FD_SETSIZE 1024
3396 diff --git a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
3397 index b0dd1bd..3f062c0 100644
3398 --- a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
3399 +++ b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
3400 @@ -58,6 +58,7 @@
3401 #define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
3402 #define __FSID_T_TYPE struct { int __val[2]; }
3403 #define __SSIZE_T_TYPE __SWORD_TYPE
3404 +#define __SNSECONDS_T_TYPE __SLONGWORD_TYPE
3405
3406 /* Number of descriptors that can fit in an `fd_set'. */
3407 #define __FD_SETSIZE 1024
3408 diff --git a/sysdeps/unix/sysv/linux/x86_64/64/Implies b/sysdeps/unix/sysv/linux/x86_64/64/Implies
3409 new file mode 100644
3410 index 0000000..8d91c80
3411 --- /dev/null
3412 +++ b/sysdeps/unix/sysv/linux/x86_64/64/Implies
3413 @@ -0,0 +1 @@
3414 +unix/sysv/linux/wordsize-64
3415 diff --git a/sysdeps/unix/sysv/linux/x86_64/Implies b/sysdeps/unix/sysv/linux/x86_64/Implies
3416 deleted file mode 100644
3417 index 8d91c80..0000000
3418 --- a/sysdeps/unix/sysv/linux/x86_64/Implies
3419 +++ /dev/null
3420 @@ -1 +0,0 @@
3421 -unix/sysv/linux/wordsize-64
3422 diff --git a/sysdeps/unix/sysv/linux/x86_64/Makefile b/sysdeps/unix/sysv/linux/x86_64/Makefile
3423 index 6e2741a..326a617 100644
3424 --- a/sysdeps/unix/sysv/linux/x86_64/Makefile
3425 +++ b/sysdeps/unix/sysv/linux/x86_64/Makefile
3426 @@ -1,5 +1,5 @@
3427 32bit-predefine = __i386__
3428 -64bit-predefine = __x86_64__
3429 +64bit-predefine = __x86_64__ __LP64__
3430
3431 ifeq ($(subdir),misc)
3432 sysdep_routines += ioperm iopl
3433 @@ -14,6 +14,55 @@ ifeq ($(subdir),csu)
3434 gen-as-const-headers += ucontext_i.sym
3435 endif
3436
3437 +ifeq ($(subdir),misc)
3438 +gen-as-const-headers += sigaltstack.sym
3439 +endif
3440 +
3441 ifeq ($(subdir),elf)
3442 sysdep_routines += dl-vdso
3443 endif
3444 +
3445 +# Generate the list of SYS_* macros for the system calls (__NR_* macros).
3446 +# For bi-arch platforms, the CPU/Makefile defines {32,64}bit-predefine and
3447 +# we generate a file that uses <bits/wordsize.h>.
3448 +$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
3449 + $(make-target-directory)
3450 + { \
3451 + echo '/* Generated at libc build time from kernel syscall list. */';\
3452 + echo ''; \
3453 + echo '#ifndef _SYSCALL_H'; \
3454 + echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
3455 + echo '#endif'; \
3456 + echo ''; \
3457 + $(CC) -E -MD -MP -MF $(@:.h=.d)-t1 -MT '$(@:.d=.h) $(@:.h=.d)' \
3458 + -x c $(sysincludes) $< $(addprefix -U,$(64bit-predefine)) \
3459 + $(addprefix -D,$(32bit-predefine)) -D_LIBC -dM | \
3460 + sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
3461 + LC_ALL=C sort > $(@:.d=.h).new32; \
3462 + $(CC) -E -MD -MP -MF $(@:.h=.d)-t2 -MT '$(@:.d=.h) $(@:.h=.d)' \
3463 + -x c $(sysincludes) $< $(addprefix -U,$(32bit-predefine)) \
3464 + $(addprefix -D,$(64bit-predefine)) -D_LIBC -dM | \
3465 + grep -i -v _x32_ | grep -v "COMMON_SYSCALL(n)" | \
3466 + sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
3467 + LC_ALL=C sort > $(@:.d=.h).new64; \
3468 + if cmp -s $(@:.d=.h).new32 $(@:.d=.h).new64; then \
3469 + cat $(@:.d=.h).new32; \
3470 + else \
3471 + echo ''; \
3472 + LC_ALL=C comm -12 $(@:.d=.h).new32 $(@:.d=.h).new64; \
3473 + echo '#ifdef __x86_64__'; \
3474 + LC_ALL=C comm -13 $(@:.d=.h).new32 $(@:.d=.h).new64; \
3475 + echo '#else'; \
3476 + LC_ALL=C comm -23 $(@:.d=.h).new32 $(@:.d=.h).new64; \
3477 + echo '#endif'; \
3478 + fi; \
3479 + rm -f $(@:.d=.h).new32 $(@:.d=.h).new64; \
3480 + } > $(@:.d=.h).new
3481 + mv -f $(@:.d=.h).new $(@:.d=.h)
3482 +ifneq (,$(objpfx))
3483 + sed $(sed-remove-objpfx) $(@:.h=.d)-t1 $(@:.h=.d)-t2 > $(@:.h=.d)-t3
3484 +else
3485 + cat $(@:.h=.d)-t1 $(@:.h=.d)-t2 > $(@:.h=.d)-t3
3486 +endif
3487 + rm -f $(@:.h=.d)-t1 $(@:.h=.d)-t2
3488 + mv -f $(@:.h=.d)-t3 $(@:.h=.d)
3489 diff --git a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
3490 index 3881082..98a3e66 100644
3491 --- a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
3492 +++ b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
3493 @@ -20,6 +20,8 @@
3494 #include <jmpbuf-offsets.h>
3495 #include <asm-syntax.h>
3496
3497 +#include "sigaltstack.h"
3498 +
3499 .section .rodata.str1.1,"aMS",@progbits,1
3500 .type longjmp_msg,@object
3501 longjmp_msg:
3502 @@ -41,7 +43,7 @@ longjmp_msg:
3503 # define CALL_FAIL subq $8, %rsp; \
3504 cfi_remember_state; \
3505 cfi_def_cfa_offset(16); \
3506 - movq $longjmp_msg, %rdi; \
3507 + mov $longjmp_msg, %RDI_LP; \
3508 call HIDDEN_JUMPTARGET(__fortify_fail); \
3509 nop; \
3510 cfi_restore_state
3511 @@ -57,9 +59,9 @@ ENTRY(____longjmp_chk)
3512 movq (JB_RBP*8)(%rdi), %r9
3513 movq (JB_PC*8)(%rdi), %rdx
3514 #ifdef PTR_DEMANGLE
3515 - PTR_DEMANGLE (%r8)
3516 - PTR_DEMANGLE (%r9)
3517 - PTR_DEMANGLE (%rdx)
3518 + PTR_DEMANGLE (%R8_LP)
3519 + PTR_DEMANGLE (%R9_LP)
3520 + PTR_DEMANGLE (%RDX_LP)
3521 #endif
3522
3523 cmpq %r8, %rsp
3524 @@ -72,19 +74,19 @@ ENTRY(____longjmp_chk)
3525 cfi_register (%rsi, %rbx)
3526
3527 xorl %edi, %edi
3528 - leaq -24(%rsp), %rsi
3529 + lea -sizeSS(%rsp), %RSI_LP
3530 movl $__NR_sigaltstack, %eax
3531 syscall
3532 /* Without working sigaltstack we cannot perform the test. */
3533 testl %eax, %eax
3534 jne .Lok2
3535 - testl $1, -16(%rsp)
3536 + testl $1, (-sizeSS + oSS_FLAGS)(%rsp)
3537 jz .Lfail
3538
3539 - movq -24(%rsp), %rax
3540 - addq -8(%rsp), %rax
3541 + mov (-sizeSS + oSS_SP)(%rsp), %RAX_LP
3542 + add (-sizeSS + oSS_SIZE)(%rsp), %RAX_LP
3543 subq %r8, %rax
3544 - cmpq -8(%rsp), %rax
3545 + cmp (-sizeSS + oSS_SIZE)(%rsp), %RAX_LP
3546 jae .Lok2
3547
3548 .Lfail: CALL_FAIL
3549 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/a.out.h b/sysdeps/unix/sysv/linux/x86_64/bits/a.out.h
3550 index 228a8d4..0e4a7c9 100644
3551 --- a/sysdeps/unix/sysv/linux/x86_64/bits/a.out.h
3552 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/a.out.h
3553 @@ -2,9 +2,7 @@
3554 # error "Never use <bits/a.out.h> directly; include <a.out.h> instead."
3555 #endif
3556
3557 -#include <bits/wordsize.h>
3558 -
3559 -#if __WORDSIZE == 64
3560 +#ifdef __x86_64__
3561
3562 /* Signal to users of this header that this architecture really doesn't
3563 support a.out binary format. */
3564 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
3565 index 7f18562..0d00c69 100644
3566 --- a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
3567 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
3568 @@ -23,7 +23,6 @@
3569 #endif
3570
3571 #include <sys/types.h>
3572 -#include <bits/wordsize.h>
3573 #ifdef __USE_GNU
3574 # include <bits/uio.h>
3575 #endif
3576 @@ -66,7 +65,7 @@
3577 #endif
3578
3579 #ifdef __USE_LARGEFILE64
3580 -# if __WORDSIZE == 64
3581 +# ifdef __x86_64__
3582 # define O_LARGEFILE 0
3583 # else
3584 # define O_LARGEFILE 0100000
3585 @@ -79,7 +78,7 @@
3586 #define F_SETFD 2 /* Set file descriptor flags. */
3587 #define F_GETFL 3 /* Get file status flags. */
3588 #define F_SETFL 4 /* Set file status flags. */
3589 -#if __WORDSIZE == 64
3590 +#ifdef __x86_64__
3591 # define F_GETLK 5 /* Get record locking info. */
3592 # define F_SETLK 6 /* Set record locking info (non-blocking). */
3593 # define F_SETLKW 7 /* Set record locking info (blocking). */
3594 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/ipc.h b/sysdeps/unix/sysv/linux/x86_64/bits/ipc.h
3595 new file mode 100644
3596 index 0000000..27758ce
3597 --- /dev/null
3598 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/ipc.h
3599 @@ -0,0 +1,57 @@
3600 +/* Copyright (C) 1995-1999, 2000, 2011
3601 + Free Software Foundation, Inc.
3602 + This file is part of the GNU C Library.
3603 +
3604 + The GNU C Library is free software; you can redistribute it and/or
3605 + modify it under the terms of the GNU Lesser General Public
3606 + License as published by the Free Software Foundation; either
3607 + version 2.1 of the License, or (at your option) any later version.
3608 +
3609 + The GNU C Library is distributed in the hope that it will be useful,
3610 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3611 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3612 + Lesser General Public License for more details.
3613 +
3614 + You should have received a copy of the GNU Lesser General Public
3615 + License along with the GNU C Library; if not, write to the Free
3616 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3617 + 02111-1307 USA. */
3618 +
3619 +#ifndef _SYS_IPC_H
3620 +# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
3621 +#endif
3622 +
3623 +#include <bits/types.h>
3624 +
3625 +/* Mode bits for `msgget', `semget', and `shmget'. */
3626 +#define IPC_CREAT 01000 /* Create key if key does not exist. */
3627 +#define IPC_EXCL 02000 /* Fail if key exists. */
3628 +#define IPC_NOWAIT 04000 /* Return error on wait. */
3629 +
3630 +/* Control commands for `msgctl', `semctl', and `shmctl'. */
3631 +#define IPC_RMID 0 /* Remove identifier. */
3632 +#define IPC_SET 1 /* Set `ipc_perm' options. */
3633 +#define IPC_STAT 2 /* Get `ipc_perm' options. */
3634 +#ifdef __USE_GNU
3635 +# define IPC_INFO 3 /* See ipcs. */
3636 +#endif
3637 +
3638 +/* Special key values. */
3639 +#define IPC_PRIVATE ((__key_t) 0) /* Private key. */
3640 +
3641 +
3642 +/* Data structure used to pass permission information to IPC operations. */
3643 +struct ipc_perm
3644 + {
3645 + __key_t __key; /* Key. */
3646 + __uid_t uid; /* Owner's user ID. */
3647 + __gid_t gid; /* Owner's group ID. */
3648 + __uid_t cuid; /* Creator's user ID. */
3649 + __gid_t cgid; /* Creator's group ID. */
3650 + unsigned short int mode; /* Read/write permission. */
3651 + unsigned short int __pad1;
3652 + unsigned short int __seq; /* Sequence number. */
3653 + unsigned short int __pad2;
3654 + __UNATIVE_LONG_TYPE __unused1;
3655 + __UNATIVE_LONG_TYPE __unused2;
3656 + };
3657 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/ipctypes.h b/sysdeps/unix/sysv/linux/x86_64/bits/ipctypes.h
3658 new file mode 100644
3659 index 0000000..f8101b1
3660 --- /dev/null
3661 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/ipctypes.h
3662 @@ -0,0 +1,32 @@
3663 +/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM.
3664 + Copyright (C) 2011 Free Software Foundation, Inc.
3665 + This file is part of the GNU C Library.
3666 +
3667 + The GNU C Library is free software; you can redistribute it and/or
3668 + modify it under the terms of the GNU Lesser General Public
3669 + License as published by the Free Software Foundation; either
3670 + version 2.1 of the License, or (at your option) any later version.
3671 +
3672 + The GNU C Library is distributed in the hope that it will be useful,
3673 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3674 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3675 + Lesser General Public License for more details.
3676 +
3677 + You should have received a copy of the GNU Lesser General Public
3678 + License along with the GNU C Library; if not, write to the Free
3679 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3680 + 02111-1307 USA. */
3681 +
3682 +#ifndef _SYS_IPC_H
3683 +# error "Never use <bits/ipctypes.h> directly; include <sys/ipc.h> instead."
3684 +#endif
3685 +
3686 +#ifndef _BITS_IPCTYPES_H
3687 +#define _BITS_IPCTYPES_H 1
3688 +
3689 +#include <bits/types.h>
3690 +
3691 +/* Used in `struct shmid_ds'. */
3692 +typedef __pid_t __ipc_pid_t;
3693 +
3694 +#endif /* bits/ipctypes.h */
3695 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h b/sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h
3696 index d7123c9..f9bf84e 100644
3697 --- a/sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h
3698 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h
3699 @@ -1,5 +1,5 @@
3700 /* Resolve function pointers to VDSO functions.
3701 - Copyright (C) 2005, 2007 Free Software Foundation, Inc.
3702 + Copyright (C) 2005, 2007, 2011 Free Software Foundation, Inc.
3703 This file is part of the GNU C Library.
3704
3705 The GNU C Library is free software; you can redistribute it and/or
3706 @@ -25,9 +25,6 @@
3707
3708 #ifdef SHARED
3709
3710 -extern long int (*__vdso_gettimeofday) (struct timeval *, void *)
3711 - attribute_hidden;
3712 -
3713 extern long int (*__vdso_clock_gettime) (clockid_t, struct timespec *);
3714
3715 #endif
3716 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h b/sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h
3717 new file mode 100644
3718 index 0000000..3c2c006
3719 --- /dev/null
3720 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h
3721 @@ -0,0 +1,35 @@
3722 +/* Copyright (C) 2004, 2011
3723 + Free Software Foundation, Inc.
3724 + This file is part of the GNU C Library.
3725 +
3726 + The GNU C Library is free software; you can redistribute it and/or
3727 + modify it under the terms of the GNU Lesser General Public
3728 + License as published by the Free Software Foundation; either
3729 + version 2.1 of the License, or (at your option) any later version.
3730 +
3731 + The GNU C Library is distributed in the hope that it will be useful,
3732 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3733 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3734 + Lesser General Public License for more details.
3735 +
3736 + You should have received a copy of the GNU Lesser General Public
3737 + License along with the GNU C Library; if not, write to the Free
3738 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3739 + 02111-1307 USA. */
3740 +
3741 +#ifndef _MQUEUE_H
3742 +# error "Never use <bits/mqueue.h> directly; include <mqueue.h> instead."
3743 +#endif
3744 +
3745 +#include <sys/types.h>
3746 +
3747 +typedef int mqd_t;
3748 +
3749 +struct mq_attr
3750 +{
3751 + __SNATIVE_LONG_TYPE mq_flags; /* Message queue flags. */
3752 + __SNATIVE_LONG_TYPE mq_maxmsg; /* Maximum number of messages. */
3753 + __SNATIVE_LONG_TYPE mq_msgsize; /* Maximum message size. */
3754 + __SNATIVE_LONG_TYPE mq_curmsgs; /* Number of messages currently queued. */
3755 + __SNATIVE_LONG_TYPE __pad[4];
3756 +};
3757 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/msq.h b/sysdeps/unix/sysv/linux/x86_64/bits/msq.h
3758 index 422218a..376e16f 100644
3759 --- a/sysdeps/unix/sysv/linux/x86_64/bits/msq.h
3760 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/msq.h
3761 @@ -1,4 +1,5 @@
3762 -/* Copyright (C) 1995, 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
3763 +/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2011
3764 + Free Software Foundation, Inc.
3765 This file is part of the GNU C Library.
3766
3767 The GNU C Library is free software; you can redistribute it and/or
3768 @@ -21,7 +22,6 @@
3769 #endif
3770
3771 #include <bits/types.h>
3772 -#include <bits/wordsize.h>
3773
3774 /* Define options for message queue functions. */
3775 #define MSG_NOERROR 010000 /* no error if message is too big */
3776 @@ -30,8 +30,8 @@
3777 #endif
3778
3779 /* Types used in the structure definition. */
3780 -typedef unsigned long int msgqnum_t;
3781 -typedef unsigned long int msglen_t;
3782 +typedef __UNATIVE_LONG_TYPE msgqnum_t;
3783 +typedef __UNATIVE_LONG_TYPE msglen_t;
3784
3785 /* Structure of record for one message inside the kernel.
3786 The type `struct msg' is opaque. */
3787 @@ -39,24 +39,24 @@ struct msqid_ds
3788 {
3789 struct ipc_perm msg_perm; /* structure describing operation permission */
3790 __time_t msg_stime; /* time of last msgsnd command */
3791 -#if __WORDSIZE == 32
3792 +#ifndef __x86_64__
3793 unsigned long int __unused1;
3794 #endif
3795 __time_t msg_rtime; /* time of last msgrcv command */
3796 -#if __WORDSIZE == 32
3797 +#ifndef __x86_64__
3798 unsigned long int __unused2;
3799 #endif
3800 __time_t msg_ctime; /* time of last change */
3801 -#if __WORDSIZE == 32
3802 +#ifndef __x86_64__
3803 unsigned long int __unused3;
3804 #endif
3805 - unsigned long int __msg_cbytes; /* current number of bytes on queue */
3806 + __UNATIVE_LONG_TYPE __msg_cbytes; /* current number of bytes on queue */
3807 msgqnum_t msg_qnum; /* number of messages currently on queue */
3808 msglen_t msg_qbytes; /* max number of bytes allowed on queue */
3809 __pid_t msg_lspid; /* pid of last msgsnd() */
3810 __pid_t msg_lrpid; /* pid of last msgrcv() */
3811 - unsigned long int __unused4;
3812 - unsigned long int __unused5;
3813 + __UNATIVE_LONG_TYPE __unused4;
3814 + __UNATIVE_LONG_TYPE __unused5;
3815 };
3816
3817 #ifdef __USE_MISC
3818 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/resource.h b/sysdeps/unix/sysv/linux/x86_64/bits/resource.h
3819 new file mode 100644
3820 index 0000000..dea74be
3821 --- /dev/null
3822 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/resource.h
3823 @@ -0,0 +1,310 @@
3824 +/* Bit values & structures for resource limits. Linux version.
3825 + Copyright (C) 1994, 1996-2000, 2004, 2005, 2008, 2009, 2010, 2011
3826 + Free Software Foundation, Inc.
3827 + This file is part of the GNU C Library.
3828 +
3829 + The GNU C Library is free software; you can redistribute it and/or
3830 + modify it under the terms of the GNU Lesser General Public
3831 + License as published by the Free Software Foundation; either
3832 + version 2.1 of the License, or (at your option) any later version.
3833 +
3834 + The GNU C Library is distributed in the hope that it will be useful,
3835 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3836 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3837 + Lesser General Public License for more details.
3838 +
3839 + You should have received a copy of the GNU Lesser General Public
3840 + License along with the GNU C Library; if not, write to the Free
3841 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3842 + 02111-1307 USA. */
3843 +
3844 +#ifndef _SYS_RESOURCE_H
3845 +# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
3846 +#endif
3847 +
3848 +#include <bits/types.h>
3849 +
3850 +/* Transmute defines to enumerations. The macro re-definitions are
3851 + necessary because some programs want to test for operating system
3852 + features with #ifdef RUSAGE_SELF. In ISO C the reflexive
3853 + definition is a no-op. */
3854 +
3855 +/* Kinds of resource limit. */
3856 +enum __rlimit_resource
3857 +{
3858 + /* Per-process CPU limit, in seconds. */
3859 + RLIMIT_CPU = 0,
3860 +#define RLIMIT_CPU RLIMIT_CPU
3861 +
3862 + /* Largest file that can be created, in bytes. */
3863 + RLIMIT_FSIZE = 1,
3864 +#define RLIMIT_FSIZE RLIMIT_FSIZE
3865 +
3866 + /* Maximum size of data segment, in bytes. */
3867 + RLIMIT_DATA = 2,
3868 +#define RLIMIT_DATA RLIMIT_DATA
3869 +
3870 + /* Maximum size of stack segment, in bytes. */
3871 + RLIMIT_STACK = 3,
3872 +#define RLIMIT_STACK RLIMIT_STACK
3873 +
3874 + /* Largest core file that can be created, in bytes. */
3875 + RLIMIT_CORE = 4,
3876 +#define RLIMIT_CORE RLIMIT_CORE
3877 +
3878 + /* Largest resident set size, in bytes.
3879 + This affects swapping; processes that are exceeding their
3880 + resident set size will be more likely to have physical memory
3881 + taken from them. */
3882 + __RLIMIT_RSS = 5,
3883 +#define RLIMIT_RSS __RLIMIT_RSS
3884 +
3885 + /* Number of open files. */
3886 + RLIMIT_NOFILE = 7,
3887 + __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */
3888 +#define RLIMIT_NOFILE RLIMIT_NOFILE
3889 +#define RLIMIT_OFILE __RLIMIT_OFILE
3890 +
3891 + /* Address space limit. */
3892 + RLIMIT_AS = 9,
3893 +#define RLIMIT_AS RLIMIT_AS
3894 +
3895 + /* Number of processes. */
3896 + __RLIMIT_NPROC = 6,
3897 +#define RLIMIT_NPROC __RLIMIT_NPROC
3898 +
3899 + /* Locked-in-memory address space. */
3900 + __RLIMIT_MEMLOCK = 8,
3901 +#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK
3902 +
3903 + /* Maximum number of file locks. */
3904 + __RLIMIT_LOCKS = 10,
3905 +#define RLIMIT_LOCKS __RLIMIT_LOCKS
3906 +
3907 + /* Maximum number of pending signals. */
3908 + __RLIMIT_SIGPENDING = 11,
3909 +#define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING
3910 +
3911 + /* Maximum bytes in POSIX message queues. */
3912 + __RLIMIT_MSGQUEUE = 12,
3913 +#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
3914 +
3915 + /* Maximum nice priority allowed to raise to.
3916 + Nice levels 19 .. -20 correspond to 0 .. 39
3917 + values of this resource limit. */
3918 + __RLIMIT_NICE = 13,
3919 +#define RLIMIT_NICE __RLIMIT_NICE
3920 +
3921 + /* Maximum realtime priority allowed for non-priviledged
3922 + processes. */
3923 + __RLIMIT_RTPRIO = 14,
3924 +#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
3925 +
3926 + /* Maximum CPU time in µs that a process scheduled under a real-time
3927 + scheduling policy may consume without making a blocking system
3928 + call before being forcibly descheduled. */
3929 + __RLIMIT_RTTIME = 15,
3930 +#define RLIMIT_RTTIME __RLIMIT_RTTIME
3931 +
3932 + __RLIMIT_NLIMITS = 16,
3933 + __RLIM_NLIMITS = __RLIMIT_NLIMITS
3934 +#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
3935 +#define RLIM_NLIMITS __RLIM_NLIMITS
3936 +};
3937 +
3938 +/* Value to indicate that there is no limit. */
3939 +#ifndef __USE_FILE_OFFSET64
3940 +# define RLIM_INFINITY ((__rlim_t) -1)
3941 +#else
3942 +# define RLIM_INFINITY 0xffffffffffffffffuLL
3943 +#endif
3944 +
3945 +#ifdef __USE_LARGEFILE64
3946 +# define RLIM64_INFINITY 0xffffffffffffffffuLL
3947 +#endif
3948 +
3949 +/* We can represent all limits. */
3950 +#define RLIM_SAVED_MAX RLIM_INFINITY
3951 +#define RLIM_SAVED_CUR RLIM_INFINITY
3952 +
3953 +
3954 +/* Type for resource quantity measurement. */
3955 +#ifndef __USE_FILE_OFFSET64
3956 +typedef __rlim_t rlim_t;
3957 +#else
3958 +typedef __rlim64_t rlim_t;
3959 +#endif
3960 +#ifdef __USE_LARGEFILE64
3961 +typedef __rlim64_t rlim64_t;
3962 +#endif
3963 +
3964 +struct rlimit
3965 + {
3966 + /* The current (soft) limit. */
3967 + rlim_t rlim_cur;
3968 + /* The hard limit. */
3969 + rlim_t rlim_max;
3970 + };
3971 +
3972 +#ifdef __USE_LARGEFILE64
3973 +struct rlimit64
3974 + {
3975 + /* The current (soft) limit. */
3976 + rlim64_t rlim_cur;
3977 + /* The hard limit. */
3978 + rlim64_t rlim_max;
3979 + };
3980 +#endif
3981 +
3982 +/* Whose usage statistics do you want? */
3983 +enum __rusage_who
3984 +{
3985 + /* The calling process. */
3986 + RUSAGE_SELF = 0,
3987 +#define RUSAGE_SELF RUSAGE_SELF
3988 +
3989 + /* All of its terminated child processes. */
3990 + RUSAGE_CHILDREN = -1
3991 +#define RUSAGE_CHILDREN RUSAGE_CHILDREN
3992 +
3993 +#ifdef __USE_GNU
3994 + ,
3995 + /* The calling thread. */
3996 + RUSAGE_THREAD = 1
3997 +# define RUSAGE_THREAD RUSAGE_THREAD
3998 + /* Name for the same functionality on Solaris. */
3999 +# define RUSAGE_LWP RUSAGE_THREAD
4000 +#endif
4001 +};
4002 +
4003 +#define __need_timeval
4004 +#include <bits/time.h> /* For `struct timeval'. */
4005 +
4006 +/* Structure which says how much of each resource has been used. */
4007 +struct rusage
4008 + {
4009 + /* Total amount of user time used. */
4010 + struct timeval ru_utime;
4011 + /* Total amount of system time used. */
4012 + struct timeval ru_stime;
4013 + /* Maximum resident set size (in kilobytes). */
4014 + long int ru_maxrss;
4015 +#if defined __x86_64__ && __WORDSIZE == 32
4016 + long int __unused1;
4017 +#endif
4018 + /* Amount of sharing of text segment memory
4019 + with other processes (kilobyte-seconds). */
4020 + long int ru_ixrss;
4021 +#if defined __x86_64__ && __WORDSIZE == 32
4022 + long int __unused2;
4023 +#endif
4024 + /* Amount of data segment memory used (kilobyte-seconds). */
4025 + long int ru_idrss;
4026 +#if defined __x86_64__ && __WORDSIZE == 32
4027 + long int __unused3;
4028 +#endif
4029 + /* Amount of stack memory used (kilobyte-seconds). */
4030 + long int ru_isrss;
4031 +#if defined __x86_64__ && __WORDSIZE == 32
4032 + long int __unused4;
4033 +#endif
4034 + /* Number of soft page faults (i.e. those serviced by reclaiming
4035 + a page from the list of pages awaiting reallocation. */
4036 + long int ru_minflt;
4037 +#if defined __x86_64__ && __WORDSIZE == 32
4038 + long int __unused5;
4039 +#endif
4040 + /* Number of hard page faults (i.e. those that required I/O). */
4041 + long int ru_majflt;
4042 +#if defined __x86_64__ && __WORDSIZE == 32
4043 + long int __unused6;
4044 +#endif
4045 + /* Number of times a process was swapped out of physical memory. */
4046 + long int ru_nswap;
4047 +#if defined __x86_64__ && __WORDSIZE == 32
4048 + long int __unused7;
4049 +#endif
4050 + /* Number of input operations via the file system. Note: This
4051 + and `ru_oublock' do not include operations with the cache. */
4052 + long int ru_inblock;
4053 +#if defined __x86_64__ && __WORDSIZE == 32
4054 + long int __unused8;
4055 +#endif
4056 + /* Number of output operations via the file system. */
4057 + long int ru_oublock;
4058 +#if defined __x86_64__ && __WORDSIZE == 32
4059 + long int __unused9;
4060 +#endif
4061 + /* Number of IPC messages sent. */
4062 + long int ru_msgsnd;
4063 +#if defined __x86_64__ && __WORDSIZE == 32
4064 + long int __unused10;
4065 +#endif
4066 + /* Number of IPC messages received. */
4067 + long int ru_msgrcv;
4068 +#if defined __x86_64__ && __WORDSIZE == 32
4069 + long int __unused11;
4070 +#endif
4071 + /* Number of signals delivered. */
4072 + long int ru_nsignals;
4073 +#if defined __x86_64__ && __WORDSIZE == 32
4074 + long int __unused12;
4075 +#endif
4076 + /* Number of voluntary context switches, i.e. because the process
4077 + gave up the process before it had to (usually to wait for some
4078 + resource to be available). */
4079 + long int ru_nvcsw;
4080 +#if defined __x86_64__ && __WORDSIZE == 32
4081 + long int __unused13;
4082 +#endif
4083 + /* Number of involuntary context switches, i.e. a higher priority process
4084 + became runnable or the current process used up its time slice. */
4085 + long int ru_nivcsw;
4086 +#if defined __x86_64__ && __WORDSIZE == 32
4087 + long int __unused14;
4088 +#endif
4089 + };
4090 +
4091 +/* Priority limits. */
4092 +#define PRIO_MIN -20 /* Minimum priority a process can have. */
4093 +#define PRIO_MAX 20 /* Maximum priority a process can have. */
4094 +
4095 +/* The type of the WHICH argument to `getpriority' and `setpriority',
4096 + indicating what flavor of entity the WHO argument specifies. */
4097 +enum __priority_which
4098 +{
4099 + PRIO_PROCESS = 0, /* WHO is a process ID. */
4100 +#define PRIO_PROCESS PRIO_PROCESS
4101 + PRIO_PGRP = 1, /* WHO is a process group ID. */
4102 +#define PRIO_PGRP PRIO_PGRP
4103 + PRIO_USER = 2 /* WHO is a user ID. */
4104 +#define PRIO_USER PRIO_USER
4105 +};
4106 +
4107 +
4108 +__BEGIN_DECLS
4109 +
4110 +#ifdef __USE_GNU
4111 +/* Modify and return resource limits of a process atomically. */
4112 +# ifndef __USE_FILE_OFFSET64
4113 +extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource,
4114 + __const struct rlimit *__new_limit,
4115 + struct rlimit *__old_limit) __THROW;
4116 +# else
4117 +# ifdef __REDIRECT_NTH
4118 +extern int __REDIRECT_NTH (prlimit, (__pid_t __pid,
4119 + enum __rlimit_resource __resource,
4120 + __const struct rlimit *__new_limit,
4121 + struct rlimit *__old_limit), prlimit64);
4122 +# else
4123 +# define prlimit prlimit64
4124 +# endif
4125 +# endif
4126 +# ifdef __USE_LARGEFILE64
4127 +extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource,
4128 + __const struct rlimit64 *__new_limit,
4129 + struct rlimit64 *__old_limit) __THROW;
4130 +# endif
4131 +#endif
4132 +
4133 +__END_DECLS
4134 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/sem.h b/sysdeps/unix/sysv/linux/x86_64/bits/sem.h
4135 index 9b1d993..61fcfd8 100644
4136 --- a/sysdeps/unix/sysv/linux/x86_64/bits/sem.h
4137 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/sem.h
4138 @@ -40,12 +40,12 @@ struct semid_ds
4139 {
4140 struct ipc_perm sem_perm; /* operation permission struct */
4141 __time_t sem_otime; /* last semop() time */
4142 - unsigned long int __unused1;
4143 + __UNATIVE_LONG_TYPE __unused1;
4144 __time_t sem_ctime; /* last time changed by semctl() */
4145 - unsigned long int __unused2;
4146 - unsigned long int sem_nsems; /* number of semaphores in set */
4147 - unsigned long int __unused3;
4148 - unsigned long int __unused4;
4149 + __UNATIVE_LONG_TYPE __unused2;
4150 + __UNATIVE_LONG_TYPE sem_nsems; /* number of semaphores in set */
4151 + __UNATIVE_LONG_TYPE __unused3;
4152 + __UNATIVE_LONG_TYPE __unused4;
4153 };
4154
4155 /* The user should define a union like the following to use it for arguments
4156 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/shm.h b/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
4157 index 04f5cc5..6d09cdd 100644
4158 --- a/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
4159 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
4160 @@ -1,4 +1,4 @@
4161 -/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004, 2009
4162 +/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004, 2009, 2011
4163 Free Software Foundation, Inc.
4164 This file is part of the GNU C Library.
4165
4166 @@ -45,7 +45,7 @@ extern int __getpagesize (void) __THROW __attribute__ ((__const__));
4167
4168
4169 /* Type to count number of attaches. */
4170 -typedef unsigned long int shmatt_t;
4171 +typedef __UNATIVE_LONG_TYPE shmatt_t;
4172
4173 /* Data structure describing a shared memory segment. */
4174 struct shmid_ds
4175 @@ -53,22 +53,22 @@ struct shmid_ds
4176 struct ipc_perm shm_perm; /* operation permission struct */
4177 size_t shm_segsz; /* size of segment in bytes */
4178 __time_t shm_atime; /* time of last shmat() */
4179 -#if __WORDSIZE == 32
4180 +#ifndef __x86_64__
4181 unsigned long int __unused1;
4182 #endif
4183 __time_t shm_dtime; /* time of last shmdt() */
4184 -#if __WORDSIZE == 32
4185 +#ifndef __x86_64__
4186 unsigned long int __unused2;
4187 #endif
4188 __time_t shm_ctime; /* time of last change by shmctl() */
4189 -#if __WORDSIZE == 32
4190 +#ifndef __x86_64__
4191 unsigned long int __unused3;
4192 #endif
4193 __pid_t shm_cpid; /* pid of creator */
4194 __pid_t shm_lpid; /* pid of last shmop */
4195 shmatt_t shm_nattch; /* number of current attaches */
4196 - unsigned long int __unused4;
4197 - unsigned long int __unused5;
4198 + __UNATIVE_LONG_TYPE __unused4;
4199 + __UNATIVE_LONG_TYPE __unused5;
4200 };
4201
4202 #ifdef __USE_MISC
4203 @@ -85,25 +85,25 @@ struct shmid_ds
4204
4205 struct shminfo
4206 {
4207 - unsigned long int shmmax;
4208 - unsigned long int shmmin;
4209 - unsigned long int shmmni;
4210 - unsigned long int shmseg;
4211 - unsigned long int shmall;
4212 - unsigned long int __unused1;
4213 - unsigned long int __unused2;
4214 - unsigned long int __unused3;
4215 - unsigned long int __unused4;
4216 + __UNATIVE_LONG_TYPE shmmax;
4217 + __UNATIVE_LONG_TYPE shmmin;
4218 + __UNATIVE_LONG_TYPE shmmni;
4219 + __UNATIVE_LONG_TYPE shmseg;
4220 + __UNATIVE_LONG_TYPE shmall;
4221 + __UNATIVE_LONG_TYPE __unused1;
4222 + __UNATIVE_LONG_TYPE __unused2;
4223 + __UNATIVE_LONG_TYPE __unused3;
4224 + __UNATIVE_LONG_TYPE __unused4;
4225 };
4226
4227 struct shm_info
4228 {
4229 int used_ids;
4230 - unsigned long int shm_tot; /* total allocated shm */
4231 - unsigned long int shm_rss; /* total resident shm */
4232 - unsigned long int shm_swp; /* total swapped shm */
4233 - unsigned long int swap_attempts;
4234 - unsigned long int swap_successes;
4235 + __UNATIVE_LONG_TYPE shm_tot; /* total allocated shm */
4236 + __UNATIVE_LONG_TYPE shm_rss; /* total resident shm */
4237 + __UNATIVE_LONG_TYPE shm_swp; /* total swapped shm */
4238 + __UNATIVE_LONG_TYPE swap_attempts;
4239 + __UNATIVE_LONG_TYPE swap_successes;
4240 };
4241
4242 #endif /* __USE_MISC */
4243 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h b/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
4244 index c0d5fe7..f470b22 100644
4245 --- a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
4246 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
4247 @@ -23,8 +23,6 @@
4248 # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
4249 #endif
4250
4251 -#include <bits/wordsize.h>
4252 -
4253 struct _fpreg
4254 {
4255 unsigned short significand[4];
4256 @@ -45,7 +43,7 @@ struct _xmmreg
4257
4258
4259
4260 -#if __WORDSIZE == 32
4261 +#ifndef __x86_64__
4262
4263 struct _fpstate
4264 {
4265 @@ -104,7 +102,7 @@ struct sigcontext
4266 unsigned long cr2;
4267 };
4268
4269 -#else /* __WORDSIZE == 64 */
4270 +#else /* __x86_64__ */
4271
4272 struct _fpstate
4273 {
4274 @@ -124,36 +122,39 @@ struct _fpstate
4275
4276 struct sigcontext
4277 {
4278 - unsigned long r8;
4279 - unsigned long r9;
4280 - unsigned long r10;
4281 - unsigned long r11;
4282 - unsigned long r12;
4283 - unsigned long r13;
4284 - unsigned long r14;
4285 - unsigned long r15;
4286 - unsigned long rdi;
4287 - unsigned long rsi;
4288 - unsigned long rbp;
4289 - unsigned long rbx;
4290 - unsigned long rdx;
4291 - unsigned long rax;
4292 - unsigned long rcx;
4293 - unsigned long rsp;
4294 - unsigned long rip;
4295 - unsigned long eflags;
4296 + unsigned long long r8;
4297 + unsigned long long r9;
4298 + unsigned long long r10;
4299 + unsigned long long r11;
4300 + unsigned long long r12;
4301 + unsigned long long r13;
4302 + unsigned long long r14;
4303 + unsigned long long r15;
4304 + unsigned long long rdi;
4305 + unsigned long long rsi;
4306 + unsigned long long rbp;
4307 + unsigned long long rbx;
4308 + unsigned long long rdx;
4309 + unsigned long long rax;
4310 + unsigned long long rcx;
4311 + unsigned long long rsp;
4312 + unsigned long long rip;
4313 + unsigned long long eflags;
4314 unsigned short cs;
4315 unsigned short gs;
4316 unsigned short fs;
4317 unsigned short __pad0;
4318 - unsigned long err;
4319 - unsigned long trapno;
4320 - unsigned long oldmask;
4321 - unsigned long cr2;
4322 + unsigned long long err;
4323 + unsigned long long trapno;
4324 + unsigned long long oldmask;
4325 + unsigned long long cr2;
4326 struct _fpstate * fpstate;
4327 - unsigned long __reserved1 [8];
4328 +#ifndef __LP64__
4329 + unsigned int pad0;
4330 +#endif
4331 + unsigned long long __reserved1 [8];
4332 };
4333
4334 -#endif /* __WORDSIZE == 64 */
4335 +#endif /* __x86_64__ */
4336
4337 #endif /* _BITS_SIGCONTEXT_H */
4338 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/stat.h b/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
4339 index c7e4e1f..49dec53 100644
4340 --- a/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
4341 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
4342 @@ -26,7 +26,7 @@
4343 /* Versions of the `struct stat' data structure. */
4344 #define _STAT_VER_KERNEL 0
4345
4346 -#if __WORDSIZE == 32
4347 +#ifndef __x86_64__
4348 # define _STAT_VER_SVR4 2
4349 # define _STAT_VER_LINUX 3
4350
4351 @@ -46,37 +46,37 @@
4352 struct stat
4353 {
4354 __dev_t st_dev; /* Device. */
4355 -#if __WORDSIZE == 32
4356 +#ifndef __x86_64__
4357 unsigned short int __pad1;
4358 #endif
4359 -#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64
4360 +#if defined __x86_64__ || !defined __USE_FILE_OFFSET64
4361 __ino_t st_ino; /* File serial number. */
4362 #else
4363 - __ino_t __st_ino; /* 32bit file serial number. */
4364 + __ino_t __st_ino; /* 32bit file serial number. */
4365 #endif
4366 -#if __WORDSIZE == 32
4367 - __mode_t st_mode; /* File mode. */
4368 - __nlink_t st_nlink; /* Link count. */
4369 +#ifndef __x86_64__
4370 + __mode_t st_mode; /* File mode. */
4371 + __nlink_t st_nlink; /* Link count. */
4372 #else
4373 __nlink_t st_nlink; /* Link count. */
4374 __mode_t st_mode; /* File mode. */
4375 #endif
4376 __uid_t st_uid; /* User ID of the file's owner. */
4377 __gid_t st_gid; /* Group ID of the file's group.*/
4378 -#if __WORDSIZE == 64
4379 +#ifdef __x86_64__
4380 int __pad0;
4381 #endif
4382 __dev_t st_rdev; /* Device number, if device. */
4383 -#if __WORDSIZE == 32
4384 +#ifndef __x86_64__
4385 unsigned short int __pad2;
4386 #endif
4387 -#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64
4388 +#if defined __x86_64__ || !defined __USE_FILE_OFFSET64
4389 __off_t st_size; /* Size of file, in bytes. */
4390 #else
4391 __off64_t st_size; /* Size of file, in bytes. */
4392 #endif
4393 __blksize_t st_blksize; /* Optimal block size for I/O. */
4394 -#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64
4395 +#if defined __x86_64__ || !defined __USE_FILE_OFFSET64
4396 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
4397 #else
4398 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
4399 @@ -96,14 +96,14 @@ struct stat
4400 # define st_ctime st_ctim.tv_sec
4401 #else
4402 __time_t st_atime; /* Time of last access. */
4403 - unsigned long int st_atimensec; /* Nscecs of last access. */
4404 + __UNATIVE_LONG_TYPE st_atimensec; /* Nscecs of last access. */
4405 __time_t st_mtime; /* Time of last modification. */
4406 - unsigned long int st_mtimensec; /* Nsecs of last modification. */
4407 + __UNATIVE_LONG_TYPE st_mtimensec; /* Nsecs of last modification. */
4408 __time_t st_ctime; /* Time of last status change. */
4409 - unsigned long int st_ctimensec; /* Nsecs of last status change. */
4410 + __UNATIVE_LONG_TYPE st_ctimensec; /* Nsecs of last status change. */
4411 #endif
4412 -#if __WORDSIZE == 64
4413 - long int __unused[3];
4414 +#ifdef __x86_64__
4415 + long long int __unused[3];
4416 #else
4417 # ifndef __USE_FILE_OFFSET64
4418 unsigned long int __unused4;
4419 @@ -119,7 +119,7 @@ struct stat
4420 struct stat64
4421 {
4422 __dev_t st_dev; /* Device. */
4423 -# if __WORDSIZE == 64
4424 +# ifdef __x86_64__
4425 __ino64_t st_ino; /* File serial number. */
4426 __nlink_t st_nlink; /* Link count. */
4427 __mode_t st_mode; /* File mode. */
4428 @@ -131,7 +131,7 @@ struct stat64
4429 # endif
4430 __uid_t st_uid; /* User ID of the file's owner. */
4431 __gid_t st_gid; /* Group ID of the file's group.*/
4432 -# if __WORDSIZE == 64
4433 +# ifdef __x86_64__
4434 int __pad0;
4435 __dev_t st_rdev; /* Device number, if device. */
4436 __off_t st_size; /* Size of file, in bytes. */
4437 @@ -157,14 +157,14 @@ struct stat64
4438 # define st_ctime st_ctim.tv_sec
4439 # else
4440 __time_t st_atime; /* Time of last access. */
4441 - unsigned long int st_atimensec; /* Nscecs of last access. */
4442 + __UNATIVE_LONG_TYPE st_atimensec; /* Nscecs of last access. */
4443 __time_t st_mtime; /* Time of last modification. */
4444 - unsigned long int st_mtimensec; /* Nsecs of last modification. */
4445 + __UNATIVE_LONG_TYPE st_mtimensec; /* Nsecs of last modification. */
4446 __time_t st_ctime; /* Time of last status change. */
4447 - unsigned long int st_ctimensec; /* Nsecs of last status change. */
4448 + __UNATIVE_LONG_TYPE st_ctimensec; /* Nsecs of last status change. */
4449 # endif
4450 -# if __WORDSIZE == 64
4451 - long int __unused[3];
4452 +# ifdef __x86_64__
4453 + long long int __unused[3];
4454 # else
4455 __ino64_t st_ino; /* File serial number. */
4456 # endif
4457 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h b/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h
4458 new file mode 100644
4459 index 0000000..2829607
4460 --- /dev/null
4461 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h
4462 @@ -0,0 +1,71 @@
4463 +/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2010, 2011
4464 + Free Software Foundation, Inc.
4465 + This file is part of the GNU C Library.
4466 +
4467 + The GNU C Library is free software; you can redistribute it and/or
4468 + modify it under the terms of the GNU Lesser General Public
4469 + License as published by the Free Software Foundation; either
4470 + version 2.1 of the License, or (at your option) any later version.
4471 +
4472 + The GNU C Library is distributed in the hope that it will be useful,
4473 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4474 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4475 + Lesser General Public License for more details.
4476 +
4477 + You should have received a copy of the GNU Lesser General Public
4478 + License along with the GNU C Library; if not, write to the Free
4479 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4480 + 02111-1307 USA. */
4481 +
4482 +#ifndef _SYS_STATFS_H
4483 +# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
4484 +#endif
4485 +
4486 +#include <bits/types.h>
4487 +
4488 +struct statfs
4489 + {
4490 + __SNATIVE_LONG_TYPE f_type;
4491 + __SNATIVE_LONG_TYPE f_bsize;
4492 +#ifndef __USE_FILE_OFFSET64
4493 + __fsblkcnt_t f_blocks;
4494 + __fsblkcnt_t f_bfree;
4495 + __fsblkcnt_t f_bavail;
4496 + __fsfilcnt_t f_files;
4497 + __fsfilcnt_t f_ffree;
4498 +#else
4499 + __fsblkcnt64_t f_blocks;
4500 + __fsblkcnt64_t f_bfree;
4501 + __fsblkcnt64_t f_bavail;
4502 + __fsfilcnt64_t f_files;
4503 + __fsfilcnt64_t f_ffree;
4504 +#endif
4505 + __fsid_t f_fsid;
4506 + __SNATIVE_LONG_TYPE f_namelen;
4507 + __SNATIVE_LONG_TYPE f_frsize;
4508 + __SNATIVE_LONG_TYPE f_flags;
4509 + __SNATIVE_LONG_TYPE f_spare[4];
4510 + };
4511 +
4512 +#ifdef __USE_LARGEFILE64
4513 +struct statfs64
4514 + {
4515 + __SNATIVE_LONG_TYPE f_type;
4516 + __SNATIVE_LONG_TYPE f_bsize;
4517 + __fsblkcnt64_t f_blocks;
4518 + __fsblkcnt64_t f_bfree;
4519 + __fsblkcnt64_t f_bavail;
4520 + __fsfilcnt64_t f_files;
4521 + __fsfilcnt64_t f_ffree;
4522 + __fsid_t f_fsid;
4523 + __SNATIVE_LONG_TYPE f_namelen;
4524 + __SNATIVE_LONG_TYPE f_frsize;
4525 + __SNATIVE_LONG_TYPE f_flags;
4526 + __SNATIVE_LONG_TYPE f_spare[4];
4527 + };
4528 +#endif
4529 +
4530 +/* Tell code we have these members. */
4531 +#define _STATFS_F_NAMELEN
4532 +#define _STATFS_F_FRSIZE
4533 +#define _STATFS_F_FLAGS
4534 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/statvfs.h b/sysdeps/unix/sysv/linux/x86_64/bits/statvfs.h
4535 new file mode 100644
4536 index 0000000..a2769bd
4537 --- /dev/null
4538 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/statvfs.h
4539 @@ -0,0 +1,110 @@
4540 +/* Copyright (C) 1997,1998,2000,2001,2002,2006,2011
4541 + Free Software Foundation, Inc.
4542 + This file is part of the GNU C Library.
4543 +
4544 + The GNU C Library is free software; you can redistribute it and/or
4545 + modify it under the terms of the GNU Lesser General Public
4546 + License as published by the Free Software Foundation; either
4547 + version 2.1 of the License, or (at your option) any later version.
4548 +
4549 + The GNU C Library is distributed in the hope that it will be useful,
4550 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4551 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4552 + Lesser General Public License for more details.
4553 +
4554 + You should have received a copy of the GNU Lesser General Public
4555 + License along with the GNU C Library; if not, write to the Free
4556 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4557 + 02111-1307 USA. */
4558 +
4559 +#ifndef _SYS_STATVFS_H
4560 +# error "Never include <bits/statvfs.h> directly; use <sys/statvfs.h> instead."
4561 +#endif
4562 +
4563 +#include <bits/types.h> /* For __fsblkcnt_t and __fsfilcnt_t. */
4564 +
4565 +#ifndef __x86_64__
4566 +#define _STATVFSBUF_F_UNUSED
4567 +#endif
4568 +
4569 +struct statvfs
4570 + {
4571 + unsigned long int f_bsize;
4572 + unsigned long int f_frsize;
4573 +#ifndef __USE_FILE_OFFSET64
4574 + __fsblkcnt_t f_blocks;
4575 + __fsblkcnt_t f_bfree;
4576 + __fsblkcnt_t f_bavail;
4577 + __fsfilcnt_t f_files;
4578 + __fsfilcnt_t f_ffree;
4579 + __fsfilcnt_t f_favail;
4580 +#else
4581 + __fsblkcnt64_t f_blocks;
4582 + __fsblkcnt64_t f_bfree;
4583 + __fsblkcnt64_t f_bavail;
4584 + __fsfilcnt64_t f_files;
4585 + __fsfilcnt64_t f_ffree;
4586 + __fsfilcnt64_t f_favail;
4587 +#endif
4588 + unsigned long int f_fsid;
4589 +#ifdef _STATVFSBUF_F_UNUSED
4590 + int __f_unused;
4591 +#endif
4592 + unsigned long int f_flag;
4593 + unsigned long int f_namemax;
4594 + int __f_spare[6];
4595 + };
4596 +
4597 +#ifdef __USE_LARGEFILE64
4598 +struct statvfs64
4599 + {
4600 + unsigned long int f_bsize;
4601 + unsigned long int f_frsize;
4602 + __fsblkcnt64_t f_blocks;
4603 + __fsblkcnt64_t f_bfree;
4604 + __fsblkcnt64_t f_bavail;
4605 + __fsfilcnt64_t f_files;
4606 + __fsfilcnt64_t f_ffree;
4607 + __fsfilcnt64_t f_favail;
4608 + unsigned long int f_fsid;
4609 +#ifdef _STATVFSBUF_F_UNUSED
4610 + int __f_unused;
4611 +#endif
4612 + unsigned long int f_flag;
4613 + unsigned long int f_namemax;
4614 + int __f_spare[6];
4615 + };
4616 +#endif
4617 +
4618 +/* Definitions for the flag in `f_flag'. These definitions should be
4619 + kept in sync with the definitions in <sys/mount.h>. */
4620 +enum
4621 +{
4622 + ST_RDONLY = 1, /* Mount read-only. */
4623 +#define ST_RDONLY ST_RDONLY
4624 + ST_NOSUID = 2 /* Ignore suid and sgid bits. */
4625 +#define ST_NOSUID ST_NOSUID
4626 +#ifdef __USE_GNU
4627 + ,
4628 + ST_NODEV = 4, /* Disallow access to device special files. */
4629 +# define ST_NODEV ST_NODEV
4630 + ST_NOEXEC = 8, /* Disallow program execution. */
4631 +# define ST_NOEXEC ST_NOEXEC
4632 + ST_SYNCHRONOUS = 16, /* Writes are synced at once. */
4633 +# define ST_SYNCHRONOUS ST_SYNCHRONOUS
4634 + ST_MANDLOCK = 64, /* Allow mandatory locks on an FS. */
4635 +# define ST_MANDLOCK ST_MANDLOCK
4636 + ST_WRITE = 128, /* Write on file/directory/symlink. */
4637 +# define ST_WRITE ST_WRITE
4638 + ST_APPEND = 256, /* Append-only file. */
4639 +# define ST_APPEND ST_APPEND
4640 + ST_IMMUTABLE = 512, /* Immutable file. */
4641 +# define ST_IMMUTABLE ST_IMMUTABLE
4642 + ST_NOATIME = 1024, /* Do not update access times. */
4643 +# define ST_NOATIME ST_NOATIME
4644 + ST_NODIRATIME = 2048, /* Do not update directory access times. */
4645 +# define ST_NODIRATIME ST_NODIRATIME
4646 + ST_RELATIME = 4096 /* Update atime relative to mtime/ctime. */
4647 +# define ST_RELATIME ST_RELATIME
4648 +#endif /* Use GNU. */
4649 +};
4650 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/timex.h b/sysdeps/unix/sysv/linux/x86_64/bits/timex.h
4651 new file mode 100644
4652 index 0000000..702a8c4
4653 --- /dev/null
4654 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/timex.h
4655 @@ -0,0 +1,128 @@
4656 +/* Copyright (C) 1995-1997, 1999, 2007, 2009, 2011
4657 + Free Software Foundation, Inc.
4658 + This file is part of the GNU C Library.
4659 +
4660 + The GNU C Library is free software; you can redistribute it and/or
4661 + modify it under the terms of the GNU Lesser General Public
4662 + License as published by the Free Software Foundation; either
4663 + version 2.1 of the License, or (at your option) any later version.
4664 +
4665 + The GNU C Library is distributed in the hope that it will be useful,
4666 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4667 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4668 + Lesser General Public License for more details.
4669 +
4670 + You should have received a copy of the GNU Lesser General Public
4671 + License along with the GNU C Library; if not, write to the Free
4672 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4673 + 02111-1307 USA. */
4674 +
4675 +#ifndef _BITS_TIMEX_H
4676 +#define _BITS_TIMEX_H 1
4677 +
4678 +/* These definitions from linux/timex.h as of 2.6.30. */
4679 +
4680 +struct timex
4681 +{
4682 + /* mode selector */
4683 + unsigned int modes;
4684 + /* time offset (usec) */
4685 + __SNATIVE_LONG_TYPE offset;
4686 + /* frequency offset (scaled ppm) */
4687 + __SNATIVE_LONG_TYPE freq;
4688 + /* maximum error (usec) */
4689 + __SNATIVE_LONG_TYPE maxerror;
4690 + /* estimated error (usec) */
4691 + __SNATIVE_LONG_TYPE esterror;
4692 + /* clock command/status */
4693 + int status;
4694 + /* pll time constant */
4695 + __SNATIVE_LONG_TYPE constant;
4696 + /* clock precision (usec) (read only) */
4697 + __SNATIVE_LONG_TYPE precision;
4698 + /* clock frequency tolerance (ppm) (read only) */
4699 + __SNATIVE_LONG_TYPE tolerance;
4700 + /* (read only) */
4701 + struct timeval time;
4702 + /* (modified) usecs between clock ticks */
4703 + __SNATIVE_LONG_TYPE tick;
4704 + /* pps frequency (scaled ppm) (ro) */
4705 + __SNATIVE_LONG_TYPE ppsfreq;
4706 + /* pps jitter (us) (ro) */
4707 + __SNATIVE_LONG_TYPE jitter;
4708 + /* interval duration (s) (shift) (ro) */
4709 + int shift;
4710 + /* pps stability (scaled ppm) (ro) */
4711 + __SNATIVE_LONG_TYPE stabil;
4712 + /* jitter limit exceeded (ro) */
4713 + __SNATIVE_LONG_TYPE jitcnt;
4714 + /* calibration intervals (ro) */
4715 + __SNATIVE_LONG_TYPE calcnt;
4716 + /* calibration errors (ro) */
4717 + __SNATIVE_LONG_TYPE errcnt;
4718 + /* stability limit exceeded (ro) */
4719 + __SNATIVE_LONG_TYPE stbcnt;
4720 +
4721 + /* TAI offset (ro) */
4722 + int tai;
4723 +
4724 + /* ??? */
4725 + int :32; int :32; int :32; int :32;
4726 + int :32; int :32; int :32; int :32;
4727 + int :32; int :32; int :32;
4728 +};
4729 +
4730 +/* Mode codes (timex.mode) */
4731 +#define ADJ_OFFSET 0x0001 /* time offset */
4732 +#define ADJ_FREQUENCY 0x0002 /* frequency offset */
4733 +#define ADJ_MAXERROR 0x0004 /* maximum time error */
4734 +#define ADJ_ESTERROR 0x0008 /* estimated time error */
4735 +#define ADJ_STATUS 0x0010 /* clock status */
4736 +#define ADJ_TIMECONST 0x0020 /* pll time constant */
4737 +#define ADJ_TAI 0x0080 /* set TAI offset */
4738 +#define ADJ_MICRO 0x1000 /* select microsecond resolution */
4739 +#define ADJ_NANO 0x2000 /* select nanosecond resolution */
4740 +#define ADJ_TICK 0x4000 /* tick value */
4741 +#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
4742 +#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
4743 +
4744 +/* xntp 3.4 compatibility names */
4745 +#define MOD_OFFSET ADJ_OFFSET
4746 +#define MOD_FREQUENCY ADJ_FREQUENCY
4747 +#define MOD_MAXERROR ADJ_MAXERROR
4748 +#define MOD_ESTERROR ADJ_ESTERROR
4749 +#define MOD_STATUS ADJ_STATUS
4750 +#define MOD_TIMECONST ADJ_TIMECONST
4751 +#define MOD_CLKB ADJ_TICK
4752 +#define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */
4753 +#define MOD_TAI ADJ_TAI
4754 +#define MOD_MICRO ADJ_MICRO
4755 +#define MOD_NANO ADJ_NANO
4756 +
4757 +
4758 +/* Status codes (timex.status) */
4759 +#define STA_PLL 0x0001 /* enable PLL updates (rw) */
4760 +#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */
4761 +#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */
4762 +#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */
4763 +
4764 +#define STA_INS 0x0010 /* insert leap (rw) */
4765 +#define STA_DEL 0x0020 /* delete leap (rw) */
4766 +#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */
4767 +#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */
4768 +
4769 +#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */
4770 +#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */
4771 +#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */
4772 +#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
4773 +
4774 +#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
4775 +#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */
4776 +#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */
4777 +#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */
4778 +
4779 +/* Read-only bits */
4780 +#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
4781 + STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
4782 +
4783 +#endif /* bits/timex.h */
4784 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h b/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
4785 new file mode 100644
4786 index 0000000..fa2be06
4787 --- /dev/null
4788 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
4789 @@ -0,0 +1,87 @@
4790 +/* bits/typesizes.h -- underlying types for *_t. X86_64 version.
4791 + Copyright (C) 2011 Free Software Foundation, Inc.
4792 + This file is part of the GNU C Library.
4793 +
4794 + The GNU C Library is free software; you can redistribute it and/or
4795 + modify it under the terms of the GNU Lesser General Public
4796 + License as published by the Free Software Foundation; either
4797 + version 2.1 of the License, or (at your option) any later version.
4798 +
4799 + The GNU C Library is distributed in the hope that it will be useful,
4800 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4801 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4802 + Lesser General Public License for more details.
4803 +
4804 + You should have received a copy of the GNU Lesser General Public
4805 + License along with the GNU C Library; if not, write to the Free
4806 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4807 + 02111-1307 USA. */
4808 +
4809 +#ifndef _BITS_TYPES_H
4810 +# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
4811 +#endif
4812 +
4813 +#ifndef _BITS_TYPESIZES_H
4814 +#define _BITS_TYPESIZES_H 1
4815 +
4816 +/* See <bits/types.h> for the meaning of these macros. This file exists so
4817 + that <bits/types.h> need not vary across different GNU platforms. */
4818 +
4819 +/* X32 kernel interface is 64bit. */
4820 +#if defined __x86_64__ && __WORDSIZE == 32
4821 +#define __INO_T_TYPE __UQUAD_TYPE
4822 +#define __NLINK_T_TYPE __UQUAD_TYPE
4823 +#define __OFF_T_TYPE __SQUAD_TYPE
4824 +#define __RLIM_T_TYPE __UQUAD_TYPE
4825 +#define __BLKCNT_T_TYPE __SQUAD_TYPE
4826 +#define __FSFILCNT_T_TYPE __UQUAD_TYPE
4827 +#define __FSBLKCNT_T_TYPE __UQUAD_TYPE
4828 +#define __TIME_T_TYPE __SQUAD_TYPE
4829 +#define __BLKSIZE_T_TYPE __SQUAD_TYPE
4830 +#define __SUSECONDS_T_TYPE __SQUAD_TYPE
4831 +#define __SNSECONDS_T_TYPE __SQUAD_TYPE
4832 +#define __SNATIVE_LONG_TYPE __SQUAD_TYPE
4833 +#define __UNATIVE_LONG_TYPE __UQUAD_TYPE
4834 +#else
4835 +#define __INO_T_TYPE __ULONGWORD_TYPE
4836 +#define __NLINK_T_TYPE __UWORD_TYPE
4837 +#define __OFF_T_TYPE __SLONGWORD_TYPE
4838 +#define __RLIM_T_TYPE __ULONGWORD_TYPE
4839 +#define __BLKCNT_T_TYPE __SLONGWORD_TYPE
4840 +#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE
4841 +#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE
4842 +#define __TIME_T_TYPE __SLONGWORD_TYPE
4843 +#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
4844 +#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
4845 +#define __SNSECONDS_T_TYPE __SLONGWORD_TYPE
4846 +#define __SNATIVE_LONG_TYPE __SLONGWORD_TYPE
4847 +#define __UNATIVE_LONG_TYPE __ULONGWORD_TYPE
4848 +#endif
4849 +
4850 +#define __DEV_T_TYPE __UQUAD_TYPE
4851 +#define __UID_T_TYPE __U32_TYPE
4852 +#define __GID_T_TYPE __U32_TYPE
4853 +#define __INO64_T_TYPE __UQUAD_TYPE
4854 +#define __MODE_T_TYPE __U32_TYPE
4855 +#define __OFF64_T_TYPE __SQUAD_TYPE
4856 +#define __PID_T_TYPE __S32_TYPE
4857 +#define __RLIM64_T_TYPE __UQUAD_TYPE
4858 +#define __BLKCNT64_T_TYPE __SQUAD_TYPE
4859 +#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
4860 +#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
4861 +#define __ID_T_TYPE __U32_TYPE
4862 +#define __CLOCK_T_TYPE __SLONGWORD_TYPE
4863 +#define __USECONDS_T_TYPE __U32_TYPE
4864 +#define __DADDR_T_TYPE __S32_TYPE
4865 +#define __SWBLK_T_TYPE __SLONGWORD_TYPE
4866 +#define __KEY_T_TYPE __S32_TYPE
4867 +#define __CLOCKID_T_TYPE __S32_TYPE
4868 +#define __TIMER_T_TYPE void *
4869 +#define __FSID_T_TYPE struct { int __val[2]; }
4870 +#define __SSIZE_T_TYPE __SWORD_TYPE
4871 +
4872 +/* Number of descriptors that can fit in an `fd_set'. */
4873 +#define __FD_SETSIZE 1024
4874 +
4875 +
4876 +#endif /* bits/typesizes.h */
4877 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/utmp.h b/sysdeps/unix/sysv/linux/x86_64/bits/utmp.h
4878 new file mode 100644
4879 index 0000000..3e18f17
4880 --- /dev/null
4881 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/utmp.h
4882 @@ -0,0 +1,124 @@
4883 +/* The `struct utmp' type, describing entries in the utmp file. GNU version.
4884 + Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002, 2011
4885 + Free Software Foundation, Inc.
4886 + This file is part of the GNU C Library.
4887 +
4888 + The GNU C Library is free software; you can redistribute it and/or
4889 + modify it under the terms of the GNU Lesser General Public
4890 + License as published by the Free Software Foundation; either
4891 + version 2.1 of the License, or (at your option) any later version.
4892 +
4893 + The GNU C Library is distributed in the hope that it will be useful,
4894 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4895 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4896 + Lesser General Public License for more details.
4897 +
4898 + You should have received a copy of the GNU Lesser General Public
4899 + License along with the GNU C Library; if not, write to the Free
4900 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4901 + 02111-1307 USA. */
4902 +
4903 +#ifndef _UTMP_H
4904 +# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
4905 +#endif
4906 +
4907 +#include <paths.h>
4908 +#include <sys/time.h>
4909 +#include <sys/types.h>
4910 +
4911 +
4912 +#define UT_LINESIZE 32
4913 +#define UT_NAMESIZE 32
4914 +#define UT_HOSTSIZE 256
4915 +
4916 +
4917 +/* The structure describing an entry in the database of
4918 + previous logins. */
4919 +struct lastlog
4920 + {
4921 +#ifdef __x86_64__
4922 + int32_t ll_time;
4923 +#else
4924 + __time_t ll_time;
4925 +#endif
4926 + char ll_line[UT_LINESIZE];
4927 + char ll_host[UT_HOSTSIZE];
4928 + };
4929 +
4930 +
4931 +/* The structure describing the status of a terminated process. This
4932 + type is used in `struct utmp' below. */
4933 +struct exit_status
4934 + {
4935 + short int e_termination; /* Process termination status. */
4936 + short int e_exit; /* Process exit status. */
4937 + };
4938 +
4939 +
4940 +/* The structure describing an entry in the user accounting database. */
4941 +struct utmp
4942 +{
4943 + short int ut_type; /* Type of login. */
4944 + pid_t ut_pid; /* Process ID of login process. */
4945 + char ut_line[UT_LINESIZE]; /* Devicename. */
4946 + char ut_id[4]; /* Inittab ID. */
4947 + char ut_user[UT_NAMESIZE]; /* Username. */
4948 + char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
4949 + struct exit_status ut_exit; /* Exit status of a process marked
4950 + as DEAD_PROCESS. */
4951 +/* The ut_session and ut_tv fields must be the same size when compiled
4952 + 32- and 64-bit. This allows data files and shared memory to be
4953 + shared between 32- and 64-bit applications. */
4954 +#ifdef __x86_64__
4955 + int32_t ut_session; /* Session ID, used for windowing. */
4956 + struct
4957 + {
4958 + int32_t tv_sec; /* Seconds. */
4959 + int32_t tv_usec; /* Microseconds. */
4960 + } ut_tv; /* Time entry was made. */
4961 +#else
4962 + long int ut_session; /* Session ID, used for windowing. */
4963 + struct timeval ut_tv; /* Time entry was made. */
4964 +#endif
4965 +
4966 + int32_t ut_addr_v6[4]; /* Internet address of remote host. */
4967 + char __unused[20]; /* Reserved for future use. */
4968 +};
4969 +
4970 +/* Backwards compatibility hacks. */
4971 +#define ut_name ut_user
4972 +#ifndef _NO_UT_TIME
4973 +/* We have a problem here: `ut_time' is also used otherwise. Define
4974 + _NO_UT_TIME if the compiler complains. */
4975 +# define ut_time ut_tv.tv_sec
4976 +#endif
4977 +#define ut_xtime ut_tv.tv_sec
4978 +#define ut_addr ut_addr_v6[0]
4979 +
4980 +
4981 +/* Values for the `ut_type' field of a `struct utmp'. */
4982 +#define EMPTY 0 /* No valid user accounting information. */
4983 +
4984 +#define RUN_LVL 1 /* The system's runlevel. */
4985 +#define BOOT_TIME 2 /* Time of system boot. */
4986 +#define NEW_TIME 3 /* Time after system clock changed. */
4987 +#define OLD_TIME 4 /* Time when system clock changed. */
4988 +
4989 +#define INIT_PROCESS 5 /* Process spawned by the init process. */
4990 +#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
4991 +#define USER_PROCESS 7 /* Normal process. */
4992 +#define DEAD_PROCESS 8 /* Terminated process. */
4993 +
4994 +#define ACCOUNTING 9
4995 +
4996 +/* Old Linux name for the EMPTY type. */
4997 +#define UT_UNKNOWN EMPTY
4998 +
4999 +
5000 +/* Tell the user that we have a modern system with UT_HOST, UT_PID,
5001 + UT_TYPE, UT_ID and UT_TV fields. */
5002 +#define _HAVE_UT_TYPE 1
5003 +#define _HAVE_UT_PID 1
5004 +#define _HAVE_UT_ID 1
5005 +#define _HAVE_UT_TV 1
5006 +#define _HAVE_UT_HOST 1
5007 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/utmpx.h b/sysdeps/unix/sysv/linux/x86_64/bits/utmpx.h
5008 new file mode 100644
5009 index 0000000..6972b91
5010 --- /dev/null
5011 +++ b/sysdeps/unix/sysv/linux/x86_64/bits/utmpx.h
5012 @@ -0,0 +1,103 @@
5013 +/* Structures and definitions for the user accounting database. GNU version.
5014 + Copyright (C) 1997, 1998, 2000, 2001, 2002, 2011
5015 + Free Software Foundation, Inc.
5016 + This file is part of the GNU C Library.
5017 +
5018 + The GNU C Library is free software; you can redistribute it and/or
5019 + modify it under the terms of the GNU Lesser General Public
5020 + License as published by the Free Software Foundation; either
5021 + version 2.1 of the License, or (at your option) any later version.
5022 +
5023 + The GNU C Library is distributed in the hope that it will be useful,
5024 + but WITHOUT ANY WARRANTY; without even the implied warranty of
5025 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5026 + Lesser General Public License for more details.
5027 +
5028 + You should have received a copy of the GNU Lesser General Public
5029 + License along with the GNU C Library; if not, write to the Free
5030 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5031 + 02111-1307 USA. */
5032 +
5033 +#ifndef _UTMPX_H
5034 +# error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead."
5035 +#endif
5036 +
5037 +#include <bits/types.h>
5038 +#include <sys/time.h>
5039 +
5040 +
5041 +#ifdef __USE_GNU
5042 +# include <paths.h>
5043 +# define _PATH_UTMPX _PATH_UTMP
5044 +# define _PATH_WTMPX _PATH_WTMP
5045 +#endif
5046 +
5047 +
5048 +#define __UT_LINESIZE 32
5049 +#define __UT_NAMESIZE 32
5050 +#define __UT_HOSTSIZE 256
5051 +
5052 +
5053 +/* The structure describing the status of a terminated process. This
5054 + type is used in `struct utmpx' below. */
5055 +struct __exit_status
5056 + {
5057 +#ifdef __USE_GNU
5058 + short int e_termination; /* Process termination status. */
5059 + short int e_exit; /* Process exit status. */
5060 +#else
5061 + short int __e_termination; /* Process termination status. */
5062 + short int __e_exit; /* Process exit status. */
5063 +#endif
5064 + };
5065 +
5066 +
5067 +/* The structure describing an entry in the user accounting database. */
5068 +struct utmpx
5069 +{
5070 + short int ut_type; /* Type of login. */
5071 + __pid_t ut_pid; /* Process ID of login process. */
5072 + char ut_line[__UT_LINESIZE]; /* Devicename. */
5073 + char ut_id[4]; /* Inittab ID. */
5074 + char ut_user[__UT_NAMESIZE]; /* Username. */
5075 + char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */
5076 + struct __exit_status ut_exit; /* Exit status of a process marked
5077 + as DEAD_PROCESS. */
5078 +
5079 +/* The fields ut_session and ut_tv must be the same size when compiled
5080 + 32- and 64-bit. This allows files and shared memory to be shared
5081 + between 32- and 64-bit applications. */
5082 +#ifdef __x86_64__
5083 + __int32_t ut_session; /* Session ID, used for windowing. */
5084 + struct
5085 + {
5086 + __int32_t tv_sec; /* Seconds. */
5087 + __int32_t tv_usec; /* Microseconds. */
5088 + } ut_tv; /* Time entry was made. */
5089 +#else
5090 + long int ut_session; /* Session ID, used for windowing. */
5091 + struct timeval ut_tv; /* Time entry was made. */
5092 +#endif
5093 + __int32_t ut_addr_v6[4]; /* Internet address of remote host. */
5094 + char __unused[20]; /* Reserved for future use. */
5095 +};
5096 +
5097 +
5098 +/* Values for the `ut_type' field of a `struct utmpx'. */
5099 +#define EMPTY 0 /* No valid user accounting information. */
5100 +
5101 +#ifdef __USE_GNU
5102 +# define RUN_LVL 1 /* The system's runlevel. */
5103 +#endif
5104 +#define BOOT_TIME 2 /* Time of system boot. */
5105 +#define NEW_TIME 3 /* Time after system clock changed. */
5106 +#define OLD_TIME 4 /* Time when system clock changed. */
5107 +
5108 +#define INIT_PROCESS 5 /* Process spawned by the init process. */
5109 +#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
5110 +#define USER_PROCESS 7 /* Normal process. */
5111 +#define DEAD_PROCESS 8 /* Terminated process. */
5112 +
5113 +#ifdef __USE_GNU
5114 +# define ACCOUNTING 9 /* System accounting. */
5115 +#endif
5116 diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S
5117 index db42f20..be8c6c6 100644
5118 --- a/sysdeps/unix/sysv/linux/x86_64/clone.S
5119 +++ b/sysdeps/unix/sysv/linux/x86_64/clone.S
5120 @@ -73,7 +73,7 @@ ENTRY (BP_SYM (__clone))
5121 movq %rdx, %rdi
5122 movq %r8, %rdx
5123 movq %r9, %r8
5124 - movq 8(%rsp), %r10
5125 + mov 8(%rsp), %R10_LP
5126 movl $SYS_ify(clone),%eax
5127
5128 /* End FDE now, because in the child the unwind info will be
5129 diff --git a/sysdeps/unix/sysv/linux/x86_64/dl-cache.h b/sysdeps/unix/sysv/linux/x86_64/dl-cache.h
5130 index cb647ab..1f400eb 100644
5131 --- a/sysdeps/unix/sysv/linux/x86_64/dl-cache.h
5132 +++ b/sysdeps/unix/sysv/linux/x86_64/dl-cache.h
5133 @@ -22,4 +22,31 @@
5134 #define _dl_cache_check_flags(flags) \
5135 ((flags) == _DL_CACHE_DEFAULT_ID)
5136
5137 -#include <sysdeps/unix/sysv/linux/sparc/dl-cache.h>
5138 +#define add_system_dir(dir) \
5139 + do \
5140 + { \
5141 + size_t len = strlen (dir); \
5142 + char path[len + 4]; \
5143 + memcpy (path, dir, len + 1); \
5144 + if (len >= 6 && ! memcmp (path + len - 6, "/lib64", 6)) \
5145 + { \
5146 + len -= 2; \
5147 + path[len] = '\0'; \
5148 + } \
5149 + else if (len >= 7 \
5150 + && ! memcmp (path + len - 7, "/libx32", 7)) \
5151 + { \
5152 + len -= 3; \
5153 + path[len] = '\0'; \
5154 + } \
5155 + add_dir (path); \
5156 + if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4)) \
5157 + { \
5158 + memcpy (path + len, "64", 3); \
5159 + add_dir (path); \
5160 + memcpy (path + len, "x32", 4); \
5161 + add_dir (path); \
5162 + } \
5163 + } while (0)
5164 +
5165 +#include <sysdeps/generic/dl-cache.h>
5166 diff --git a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.S b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.S
5167 deleted file mode 100644
5168 index f618e73..0000000
5169 --- a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.S
5170 +++ /dev/null
5171 @@ -1,49 +0,0 @@
5172 -/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
5173 - This file is part of the GNU C Library.
5174 -
5175 - The GNU C Library is free software; you can redistribute it and/or
5176 - modify it under the terms of the GNU Lesser General Public
5177 - License as published by the Free Software Foundation; either
5178 - version 2.1 of the License, or (at your option) any later version.
5179 -
5180 - The GNU C Library is distributed in the hope that it will be useful,
5181 - but WITHOUT ANY WARRANTY; without even the implied warranty of
5182 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5183 - Lesser General Public License for more details.
5184 -
5185 - You should have received a copy of the GNU Lesser General Public
5186 - License along with the GNU C Library; if not, write to the Free
5187 - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5188 - 02111-1307 USA. */
5189 -
5190 -#include <sysdep.h>
5191 -#define _ERRNO_H 1
5192 -#include <bits/errno.h>
5193 -
5194 -/* For the calculation see asm/vsyscall.h. */
5195 -#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000
5196 -
5197 -
5198 -ENTRY (__gettimeofday)
5199 - /* Align stack. */
5200 - sub $0x8, %rsp
5201 - cfi_adjust_cfa_offset(8)
5202 -#ifdef SHARED
5203 - movq __vdso_gettimeofday(%rip), %rax
5204 - PTR_DEMANGLE (%rax)
5205 -#else
5206 - movq $VSYSCALL_ADDR_vgettimeofday, %rax
5207 -#endif
5208 - callq *%rax
5209 - /* Check error return. */
5210 - cmpl $-4095, %eax
5211 - jae SYSCALL_ERROR_LABEL
5212 -
5213 -L(pseudo_end):
5214 - add $0x8, %rsp
5215 - cfi_adjust_cfa_offset(-8)
5216 - ret
5217 -PSEUDO_END(__gettimeofday)
5218 -
5219 -strong_alias (__gettimeofday, __gettimeofday_internal)
5220 -weak_alias (__gettimeofday, gettimeofday)
5221 diff --git a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
5222 new file mode 100644
5223 index 0000000..0b06133
5224 --- /dev/null
5225 +++ b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
5226 @@ -0,0 +1,47 @@
5227 +/* Copyright (C) 2002, 2003, 2007, 2011 Free Software Foundation, Inc.
5228 + This file is part of the GNU C Library.
5229 +
5230 + The GNU C Library is free software; you can redistribute it and/or
5231 + modify it under the terms of the GNU Lesser General Public
5232 + License as published by the Free Software Foundation; either
5233 + version 2.1 of the License, or (at your option) any later version.
5234 +
5235 + The GNU C Library is distributed in the hope that it will be useful,
5236 + but WITHOUT ANY WARRANTY; without even the implied warranty of
5237 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5238 + Lesser General Public License for more details.
5239 +
5240 + You should have received a copy of the GNU Lesser General Public
5241 + License along with the GNU C Library; if not, write to the Free
5242 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5243 + 02111-1307 USA. */
5244 +
5245 +#include <dl-vdso.h>
5246 +
5247 +#ifdef SHARED
5248 +void *gettimeofday_ifunc (void) __asm__ ("__gettimeofday");
5249 +
5250 +void *
5251 +gettimeofday_ifunc (void)
5252 +{
5253 + PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
5254 +
5255 + /* If the vDSO is not available we fall back on the old vsyscall. */
5256 + return (_dl_vdso_vsym ("gettimeofday", &linux26)
5257 + ?: (void *) VSYSCALL_ADDR_vgettimeofday);
5258 +}
5259 +__asm (".type __gettimeofday, %gnu_indirect_function");
5260 +#else
5261 +# include <sys/time.h>
5262 +# include <sysdep.h>
5263 +# include <errno.h>
5264 +
5265 +int
5266 +__gettimeofday (struct timeval *tv, struct timezone *tz)
5267 +{
5268 + return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
5269 +}
5270 +#endif
5271 +
5272 +weak_alias (__gettimeofday, gettimeofday)
5273 +strong_alias (__gettimeofday, __gettimeofday_internal)
5274 diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
5275 index e676f62..ac977a8 100644
5276 --- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
5277 +++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
5278 @@ -20,15 +20,11 @@
5279 # include <dl-vdso.h>
5280 # include <bits/libc-vdso.h>
5281
5282 -long int (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden;
5283 -
5284 long int (*__vdso_clock_gettime) (clockid_t, struct timespec *)
5285 __attribute__ ((nocommon));
5286 strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden)
5287
5288 -long int (*__vdso_getcpu) (unsigned *, unsigned *, void *);
5289 -
5290 -long int (*__vdso_time) (time_t *) attribute_hidden;
5291 +long int (*__vdso_getcpu) (unsigned *, unsigned *, void *) attribute_hidden;
5292
5293
5294 static inline void
5295 @@ -36,33 +32,16 @@ _libc_vdso_platform_setup (void)
5296 {
5297 PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
5298
5299 - void *p = _dl_vdso_vsym ("gettimeofday", &linux26);
5300 - /* If the vDSO is not available we fall back on the old vsyscall. */
5301 -#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000ul
5302 - if (p == NULL)
5303 - p = (void *) VSYSCALL_ADDR_vgettimeofday;
5304 - PTR_MANGLE (p);
5305 - __vdso_gettimeofday = p;
5306 -
5307 - p = _dl_vdso_vsym ("clock_gettime", &linux26);
5308 + void *p = _dl_vdso_vsym ("clock_gettime", &linux26);
5309 PTR_MANGLE (p);
5310 __GI___vdso_clock_gettime = p;
5311
5312 p = _dl_vdso_vsym ("getcpu", &linux26);
5313 /* If the vDSO is not available we fall back on the old vsyscall. */
5314 -#define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800
5315 if (p == NULL)
5316 p = (void *) VSYSCALL_ADDR_vgetcpu;
5317 PTR_MANGLE (p);
5318 __vdso_getcpu = p;
5319 -
5320 - p = _dl_vdso_vsym ("time", &linux26);
5321 - /* If the vDSO is not available we fall back on the old vsyscall. */
5322 -#define VSYSCALL_ADDR_vtime 0xffffffffff600400
5323 - if (p == NULL)
5324 - p = (void *) VSYSCALL_ADDR_vtime;
5325 - PTR_MANGLE (p);
5326 - __vdso_time = p;
5327 }
5328
5329 # define VDSO_SETUP _libc_vdso_platform_setup
5330 diff --git a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
5331 index f7f64eb..69f77dd 100644
5332 --- a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
5333 +++ b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
5334 @@ -20,6 +20,7 @@
5335
5336 #define SYSDEP_KNOWN_INTERPRETER_NAMES \
5337 { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \
5338 + { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \
5339 { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 },
5340 #define SYSDEP_KNOWN_LIBRARY_NAMES \
5341 { "libc.so.6", FLAG_ELF_LIBC6 }, \
5342 diff --git a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
5343 index 3f1530d..44d76e8 100644
5344 --- a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
5345 +++ b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
5346 @@ -1,3 +1,3 @@
5347 /LD_TRACE_LOADED_OBJECTS=1/a\
5348 add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out"
5349 -s_^\(RTLDLIST=\)\(.*lib\)\(\|64\)\(/[^/]*\)\(-x86-64\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \264\4\5\6"_
5350 +s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \264\4-x86-64\6 \2x32\4-x32\6"_
5351 diff --git a/sysdeps/unix/sysv/linux/x86_64/makecontext.c b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
5352 index 615dede..477d22e 100644
5353 --- a/sysdeps/unix/sysv/linux/x86_64/makecontext.c
5354 +++ b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
5355 @@ -53,25 +53,26 @@ void
5356 __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
5357 {
5358 extern void __start_context (void);
5359 - unsigned long int *sp, idx_uc_link;
5360 + unsigned long long int *sp;
5361 + unsigned int idx_uc_link;
5362 va_list ap;
5363 int i;
5364
5365 /* Generate room on stack for parameter if needed and uc_link. */
5366 - sp = (unsigned long int *) ((uintptr_t) ucp->uc_stack.ss_sp
5367 - + ucp->uc_stack.ss_size);
5368 + sp = (unsigned long long int *) ((uintptr_t) ucp->uc_stack.ss_sp
5369 + + ucp->uc_stack.ss_size);
5370 sp -= (argc > 6 ? argc - 6 : 0) + 1;
5371 /* Align stack and make space for trampoline address. */
5372 - sp = (unsigned long int *) ((((uintptr_t) sp) & -16L) - 8);
5373 + sp = (unsigned long long int *) ((((uintptr_t) sp) & -16L) - 8);
5374
5375 idx_uc_link = (argc > 6 ? argc - 6 : 0) + 1;
5376
5377 /* Setup context ucp. */
5378 /* Address to jump to. */
5379 - ucp->uc_mcontext.gregs[REG_RIP] = (long int) func;
5380 + ucp->uc_mcontext.gregs[REG_RIP] = (unsigned long int) func;
5381 /* Setup rbx.*/
5382 - ucp->uc_mcontext.gregs[REG_RBX] = (long int) &sp[idx_uc_link];
5383 - ucp->uc_mcontext.gregs[REG_RSP] = (long int) sp;
5384 + ucp->uc_mcontext.gregs[REG_RBX] = (unsigned long int) &sp[idx_uc_link];
5385 + ucp->uc_mcontext.gregs[REG_RSP] = (unsigned long int) sp;
5386
5387 /* Setup stack. */
5388 sp[0] = (unsigned long int) &__start_context;
5389 @@ -91,26 +92,26 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
5390 switch (i)
5391 {
5392 case 0:
5393 - ucp->uc_mcontext.gregs[REG_RDI] = va_arg (ap, long int);
5394 + ucp->uc_mcontext.gregs[REG_RDI] = va_arg (ap, long long int);
5395 break;
5396 case 1:
5397 - ucp->uc_mcontext.gregs[REG_RSI] = va_arg (ap, long int);
5398 + ucp->uc_mcontext.gregs[REG_RSI] = va_arg (ap, long long int);
5399 break;
5400 case 2:
5401 - ucp->uc_mcontext.gregs[REG_RDX] = va_arg (ap, long int);
5402 + ucp->uc_mcontext.gregs[REG_RDX] = va_arg (ap, long long int);
5403 break;
5404 case 3:
5405 - ucp->uc_mcontext.gregs[REG_RCX] = va_arg (ap, long int);
5406 + ucp->uc_mcontext.gregs[REG_RCX] = va_arg (ap, long long int);
5407 break;
5408 case 4:
5409 - ucp->uc_mcontext.gregs[REG_R8] = va_arg (ap, long int);
5410 + ucp->uc_mcontext.gregs[REG_R8] = va_arg (ap, long long int);
5411 break;
5412 case 5:
5413 - ucp->uc_mcontext.gregs[REG_R9] = va_arg (ap, long int);
5414 + ucp->uc_mcontext.gregs[REG_R9] = va_arg (ap, long long int);
5415 break;
5416 default:
5417 /* Put value on stack. */
5418 - sp[i - 5] = va_arg (ap, unsigned long int);
5419 + sp[i - 5] = va_arg (ap, unsigned long long int);
5420 break;
5421 }
5422 va_end (ap);
5423 diff --git a/sysdeps/unix/sysv/linux/x86_64/readelflib.c b/sysdeps/unix/sysv/linux/x86_64/readelflib.c
5424 index 5a49af3..65d3ed7 100644
5425 --- a/sysdeps/unix/sysv/linux/x86_64/readelflib.c
5426 +++ b/sysdeps/unix/sysv/linux/x86_64/readelflib.c
5427 @@ -36,8 +36,18 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
5428 int ret;
5429
5430 if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
5431 - return process_elf32_file (file_name, lib, flag, osversion, soname,
5432 - file_contents, file_length);
5433 + {
5434 + ret = process_elf32_file (file_name, lib, flag, osversion, soname,
5435 + file_contents, file_length);
5436 + /* X32 libraries are always libc.so.6+. */
5437 + if (!ret)
5438 + switch (elf_header->e_machine)
5439 + {
5440 + case EM_X86_64:
5441 + *flag = FLAG_X8664_LIBX32|FLAG_ELF_LIBC6;
5442 + break;
5443 + }
5444 + }
5445 else
5446 {
5447 ret = process_elf64_file (file_name, lib, flag, osversion, soname,
5448 diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
5449 index 8ec7d3f..2053bfd 100644
5450 --- a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
5451 +++ b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
5452 @@ -20,10 +20,7 @@
5453 #include <tls.h>
5454 #define _ERRNO_H 1
5455 #include <bits/errno.h>
5456 -
5457 -/* For the calculation see asm/vsyscall.h. */
5458 -#define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800
5459 -
5460 +#include <kernel-features.h>
5461
5462 ENTRY (sched_getcpu)
5463 /* Align stack and create local variable for result. */
5464 @@ -38,10 +35,26 @@ ENTRY (sched_getcpu)
5465 #ifdef SHARED
5466 movq __vdso_getcpu(%rip), %rax
5467 PTR_DEMANGLE (%rax)
5468 + callq *%rax
5469 #else
5470 +# ifdef __NR_getcpu
5471 + movl $__NR_getcpu, %eax
5472 + syscall
5473 +# ifndef __ASSUME_GETCPU_SYSCALL
5474 + cmpq $-ENOSYS, %rax
5475 + jne 1f
5476 +# endif
5477 +# endif
5478 +# ifndef __ASSUME_GETCPU_SYSCALL
5479 movq $VSYSCALL_ADDR_vgetcpu, %rax
5480 -#endif
5481 callq *%rax
5482 +1:
5483 +# else
5484 +# ifndef __NR_getcpu
5485 +# error "cannot happen"
5486 +# endif
5487 +# endif
5488 +#endif
5489
5490 cmpq $-4095, %rax
5491 jae SYSCALL_ERROR_LABEL
5492 diff --git a/sysdeps/unix/sysv/linux/x86_64/sigaction.c b/sysdeps/unix/sysv/linux/x86_64/sigaction.c
5493 index ab10123..a97e072 100644
5494 --- a/sysdeps/unix/sysv/linux/x86_64/sigaction.c
5495 +++ b/sysdeps/unix/sysv/linux/x86_64/sigaction.c
5496 @@ -147,7 +147,7 @@ asm \
5497 ".LSTARTAUGMNT_" #name ":\n" \
5498 " .byte 0x1b\n" /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ \
5499 ".LENDAUGMNT_" #name ":\n" \
5500 - " .align 8\n" \
5501 + " .align " LP_SIZE "\n" \
5502 ".LENDCIE_" #name ":\n" \
5503 " .long .LENDFDE_" #name "-.LSTARTFDE_" #name "\n" /* FDE len */ \
5504 ".LSTARTFDE_" #name ":\n" \
5505 @@ -178,7 +178,7 @@ asm \
5506 /* do_expr (49 |* rflags *|, oEFL) */ \
5507 /* `cs'/`ds'/`fs' are unaligned and a different size. */ \
5508 /* gas: Error: register save offset not a multiple of 8 */ \
5509 - " .align 8\n" \
5510 + " .align " LP_SIZE "\n" \
5511 ".LENDFDE_" #name ":\n" \
5512 " .previous\n" \
5513 );
5514 diff --git a/sysdeps/unix/sysv/linux/x86_64/sigaltstack.sym b/sysdeps/unix/sysv/linux/x86_64/sigaltstack.sym
5515 new file mode 100644
5516 index 0000000..9fd26fe
5517 --- /dev/null
5518 +++ b/sysdeps/unix/sysv/linux/x86_64/sigaltstack.sym
5519 @@ -0,0 +1,15 @@
5520 +#ifndef _XOPEN_EXTENDED
5521 +# define _XOPEN_EXTENDED
5522 +#endif
5523 +
5524 +#include <stddef.h>
5525 +#include <signal.h>
5526 +
5527 +--
5528 +
5529 +#define sigaltstack(member) offsetof (stack_t, member)
5530 +
5531 +sizeSS sizeof(stack_t)
5532 +oSS_SP sigaltstack(ss_sp)
5533 +oSS_SIZE sigaltstack(ss_size)
5534 +oSS_FLAGS sigaltstack(ss_flags)
5535 diff --git a/sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h b/sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h
5536 index 11493c5..78c9aa7 100644
5537 --- a/sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h
5538 +++ b/sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h
5539 @@ -16,11 +16,16 @@
5540 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5541 02111-1307 USA. */
5542
5543 +#include <stdint.h>
5544 +
5545 #define SIGCONTEXT siginfo_t *_si, struct ucontext *
5546 #define SIGCONTEXT_EXTRA_ARGS _si,
5547 -#define GET_PC(ctx) ((void *) (ctx)->uc_mcontext.gregs[REG_RIP])
5548 -#define GET_FRAME(ctx) ((void *) (ctx)->uc_mcontext.gregs[REG_RBP])
5549 -#define GET_STACK(ctx) ((void *) (ctx)->uc_mcontext.gregs[REG_RSP])
5550 +#define GET_PC(ctx) \
5551 + ((void *) (uintptr_t) (ctx)->uc_mcontext.gregs[REG_RIP])
5552 +#define GET_FRAME(ctx) \
5553 + ((void *) (uintptr_t) (ctx)->uc_mcontext.gregs[REG_RBP])
5554 +#define GET_STACK(ctx) \
5555 + ((void *) (uintptr_t) (ctx)->uc_mcontext.gregs[REG_RSP])
5556
5557 #define CALL_SIGHANDLER(handler, signo, ctx) \
5558 (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
5559 diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/debugreg.h b/sysdeps/unix/sysv/linux/x86_64/sys/debugreg.h
5560 index 8abbf75..c3adbdf 100644
5561 --- a/sysdeps/unix/sysv/linux/x86_64/sys/debugreg.h
5562 +++ b/sysdeps/unix/sysv/linux/x86_64/sys/debugreg.h
5563 @@ -18,7 +18,6 @@
5564
5565 #ifndef _SYS_DEBUGREG_H
5566 #define _SYS_DEBUGREG_H 1
5567 -#include <bits/wordsize.h>
5568
5569 /* Indicate the register numbers for a number of the specific
5570 debug registers. Registers 0-3 contain the addresses we wish to trap on */
5571 @@ -77,8 +76,8 @@
5572
5573
5574
5575 -#if __WORDSIZE == 64
5576 -# define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00UL) /* Reserved */
5577 +#ifdef __x86_64__
5578 +# define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00ULL) /* Reserved */
5579 #else
5580 # define DR_CONTROL_RESERVED (0x00FC00U) /* Reserved */
5581 #endif
5582 diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/msg.h b/sysdeps/unix/sysv/linux/x86_64/sys/msg.h
5583 new file mode 100644
5584 index 0000000..b59b3a0
5585 --- /dev/null
5586 +++ b/sysdeps/unix/sysv/linux/x86_64/sys/msg.h
5587 @@ -0,0 +1,85 @@
5588 +/* Copyright (C) 1995-1997, 1999, 2000, 2003, 2006, 2007, 2011
5589 + Free Software Foundation, Inc.
5590 + This file is part of the GNU C Library.
5591 +
5592 + The GNU C Library is free software; you can redistribute it and/or
5593 + modify it under the terms of the GNU Lesser General Public
5594 + License as published by the Free Software Foundation; either
5595 + version 2.1 of the License, or (at your option) any later version.
5596 +
5597 + The GNU C Library is distributed in the hope that it will be useful,
5598 + but WITHOUT ANY WARRANTY; without even the implied warranty of
5599 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5600 + Lesser General Public License for more details.
5601 +
5602 + You should have received a copy of the GNU Lesser General Public
5603 + License along with the GNU C Library; if not, write to the Free
5604 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5605 + 02111-1307 USA. */
5606 +
5607 +#ifndef _SYS_MSG_H
5608 +#define _SYS_MSG_H
5609 +
5610 +#include <features.h>
5611 +
5612 +#define __need_size_t
5613 +#include <stddef.h>
5614 +
5615 +/* Get common definition of System V style IPC. */
5616 +#include <sys/ipc.h>
5617 +
5618 +/* Get system dependent definition of `struct msqid_ds' and more. */
5619 +#include <bits/msq.h>
5620 +
5621 +/* Define types required by the standard. */
5622 +#define __need_time_t
5623 +#include <time.h>
5624 +
5625 +#ifndef __pid_t_defined
5626 +typedef __pid_t pid_t;
5627 +# define __pid_t_defined
5628 +#endif
5629 +
5630 +#ifndef __ssize_t_defined
5631 +typedef __ssize_t ssize_t;
5632 +# define __ssize_t_defined
5633 +#endif
5634 +
5635 +/* The following System V style IPC functions implement a message queue
5636 + system. The definition is found in XPG2. */
5637 +
5638 +#ifdef __USE_GNU
5639 +/* Template for struct to be used as argument for `msgsnd' and `msgrcv'. */
5640 +struct msgbuf
5641 + {
5642 + __SNATIVE_LONG_TYPE mtype; /* type of received/sent message */
5643 + char mtext[1]; /* text of the message */
5644 + };
5645 +#endif
5646 +
5647 +
5648 +__BEGIN_DECLS
5649 +
5650 +/* Message queue control operation. */
5651 +extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW;
5652 +
5653 +/* Get messages queue. */
5654 +extern int msgget (key_t __key, int __msgflg) __THROW;
5655 +
5656 +/* Receive message from message queue.
5657 +
5658 + This function is a cancellation point and therefore not marked with
5659 + __THROW. */
5660 +extern ssize_t msgrcv (int __msqid, void *__msgp, size_t __msgsz,
5661 + long int __msgtyp, int __msgflg);
5662 +
5663 +/* Send message to message queue.
5664 +
5665 + This function is a cancellation point and therefore not marked with
5666 + __THROW. */
5667 +extern int msgsnd (int __msqid, __const void *__msgp, size_t __msgsz,
5668 + int __msgflg);
5669 +
5670 +__END_DECLS
5671 +
5672 +#endif /* sys/msg.h */
5673 diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/procfs.h b/sysdeps/unix/sysv/linux/x86_64/sys/procfs.h
5674 index 853d7db..80c6cfb 100644
5675 --- a/sysdeps/unix/sysv/linux/x86_64/sys/procfs.h
5676 +++ b/sysdeps/unix/sysv/linux/x86_64/sys/procfs.h
5677 @@ -36,7 +36,11 @@
5678 __BEGIN_DECLS
5679
5680 /* Type for a general-purpose register. */
5681 +#ifdef __x86_64__
5682 +typedef unsigned long long elf_greg_t;
5683 +#else
5684 typedef unsigned long elf_greg_t;
5685 +#endif
5686
5687 /* And the whole bunch of them. We could have used `struct
5688 user_regs_struct' directly in the typedef, but tradition says that
5689 @@ -45,7 +49,7 @@ typedef unsigned long elf_greg_t;
5690 #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
5691 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
5692
5693 -#if __WORDSIZE == 32
5694 +#ifndef __x86_64__
5695 /* Register set for the floating-point registers. */
5696 typedef struct user_fpregs_struct elf_fpregset_t;
5697
5698 diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/reg.h b/sysdeps/unix/sysv/linux/x86_64/sys/reg.h
5699 index acb71a2..0772bc7 100644
5700 --- a/sysdeps/unix/sysv/linux/x86_64/sys/reg.h
5701 +++ b/sysdeps/unix/sysv/linux/x86_64/sys/reg.h
5702 @@ -18,10 +18,9 @@
5703
5704 #ifndef _SYS_REG_H
5705 #define _SYS_REG_H 1
5706 -#include <bits/wordsize.h>
5707
5708
5709 -#if __WORDSIZE == 64
5710 +#ifdef __x86_64__
5711 /* Index into an array of 8 byte longs returned from ptrace for
5712 location of the users' stored general purpose registers. */
5713
5714 diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h b/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
5715 index b59cd29..5bc8f0e 100644
5716 --- a/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
5717 +++ b/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
5718 @@ -21,16 +21,15 @@
5719
5720 #include <features.h>
5721 #include <signal.h>
5722 -#include <bits/wordsize.h>
5723
5724 /* We need the signal context definitions even if they are not used
5725 included in <signal.h>. */
5726 #include <bits/sigcontext.h>
5727
5728 -#if __WORDSIZE == 64
5729 +#ifdef __x86_64__
5730
5731 /* Type for general register. */
5732 -typedef long int greg_t;
5733 +typedef long long int greg_t;
5734
5735 /* Number of general registers. */
5736 #define NGREG 23
5737 @@ -128,13 +127,13 @@ typedef struct
5738 gregset_t gregs;
5739 /* Note that fpregs is a pointer. */
5740 fpregset_t fpregs;
5741 - unsigned long __reserved1 [8];
5742 + unsigned long long __reserved1 [8];
5743 } mcontext_t;
5744
5745 /* Userlevel context. */
5746 typedef struct ucontext
5747 {
5748 - unsigned long int uc_flags;
5749 + unsigned long long int uc_flags;
5750 struct ucontext *uc_link;
5751 stack_t uc_stack;
5752 mcontext_t uc_mcontext;
5753 @@ -142,7 +141,7 @@ typedef struct ucontext
5754 struct _libc_fpstate __fpregs_mem;
5755 } ucontext_t;
5756
5757 -#else /* __WORDSIZE == 32 */
5758 +#else /* !__x86_64__ */
5759
5760 /* Type for general register. */
5761 typedef int greg_t;
5762 @@ -243,6 +242,6 @@ typedef struct ucontext
5763 struct _libc_fpstate __fpregs_mem;
5764 } ucontext_t;
5765
5766 -#endif /* __WORDSIZE == 32 */
5767 +#endif /* !__x86_64__ */
5768
5769 #endif /* sys/ucontext.h */
5770 diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/user.h b/sysdeps/unix/sysv/linux/x86_64/sys/user.h
5771 index e4423cf..d09a420 100644
5772 --- a/sysdeps/unix/sysv/linux/x86_64/sys/user.h
5773 +++ b/sysdeps/unix/sysv/linux/x86_64/sys/user.h
5774 @@ -23,9 +23,7 @@
5775 too much into it. Don't use it for anything other than GDB unless
5776 you know what you are doing. */
5777
5778 -#include <bits/wordsize.h>
5779 -
5780 -#if __WORDSIZE == 64
5781 +#ifdef __x86_64__
5782
5783 struct user_fpregs_struct
5784 {
5785 @@ -33,8 +31,8 @@ struct user_fpregs_struct
5786 unsigned short int swd;
5787 unsigned short int ftw;
5788 unsigned short int fop;
5789 - unsigned long int rip;
5790 - unsigned long int rdp;
5791 + unsigned long long int rip;
5792 + unsigned long long int rdp;
5793 unsigned int mxcsr;
5794 unsigned int mxcr_mask;
5795 unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
5796 @@ -44,33 +42,33 @@ struct user_fpregs_struct
5797
5798 struct user_regs_struct
5799 {
5800 - unsigned long int r15;
5801 - unsigned long int r14;
5802 - unsigned long int r13;
5803 - unsigned long int r12;
5804 - unsigned long int rbp;
5805 - unsigned long int rbx;
5806 - unsigned long int r11;
5807 - unsigned long int r10;
5808 - unsigned long int r9;
5809 - unsigned long int r8;
5810 - unsigned long int rax;
5811 - unsigned long int rcx;
5812 - unsigned long int rdx;
5813 - unsigned long int rsi;
5814 - unsigned long int rdi;
5815 - unsigned long int orig_rax;
5816 - unsigned long int rip;
5817 - unsigned long int cs;
5818 - unsigned long int eflags;
5819 - unsigned long int rsp;
5820 - unsigned long int ss;
5821 - unsigned long int fs_base;
5822 - unsigned long int gs_base;
5823 - unsigned long int ds;
5824 - unsigned long int es;
5825 - unsigned long int fs;
5826 - unsigned long int gs;
5827 + unsigned long long int r15;
5828 + unsigned long long int r14;
5829 + unsigned long long int r13;
5830 + unsigned long long int r12;
5831 + unsigned long long int rbp;
5832 + unsigned long long int rbx;
5833 + unsigned long long int r11;
5834 + unsigned long long int r10;
5835 + unsigned long long int r9;
5836 + unsigned long long int r8;
5837 + unsigned long long int rax;
5838 + unsigned long long int rcx;
5839 + unsigned long long int rdx;
5840 + unsigned long long int rsi;
5841 + unsigned long long int rdi;
5842 + unsigned long long int orig_rax;
5843 + unsigned long long int rip;
5844 + unsigned long long int cs;
5845 + unsigned long long int eflags;
5846 + unsigned long long int rsp;
5847 + unsigned long long int ss;
5848 + unsigned long long int fs_base;
5849 + unsigned long long int gs_base;
5850 + unsigned long long int ds;
5851 + unsigned long long int es;
5852 + unsigned long long int fs;
5853 + unsigned long long int gs;
5854 };
5855
5856 struct user
5857 @@ -78,18 +76,24 @@ struct user
5858 struct user_regs_struct regs;
5859 int u_fpvalid;
5860 struct user_fpregs_struct i387;
5861 - unsigned long int u_tsize;
5862 - unsigned long int u_dsize;
5863 - unsigned long int u_ssize;
5864 - unsigned long int start_code;
5865 - unsigned long int start_stack;
5866 - long int signal;
5867 + unsigned long long int u_tsize;
5868 + unsigned long long int u_dsize;
5869 + unsigned long long int u_ssize;
5870 + unsigned long long int start_code;
5871 + unsigned long long int start_stack;
5872 + long long int signal;
5873 int reserved;
5874 struct user_regs_struct* u_ar0;
5875 +#ifndef __LP64__
5876 + unsigned int pad0;
5877 +#endif
5878 struct user_fpregs_struct* u_fpstate;
5879 - unsigned long int magic;
5880 +#ifndef __LP64__
5881 + unsigned int pad1;
5882 +#endif
5883 + unsigned long long int magic;
5884 char u_comm [32];
5885 - unsigned long int u_debugreg [8];
5886 + unsigned long long int u_debugreg [8];
5887 };
5888
5889 #else
5890 @@ -162,7 +166,7 @@ struct user
5891 char u_comm [32];
5892 int u_debugreg [8];
5893 };
5894 -#endif /* __WORDSIZE */
5895 +#endif /* __x86_64__ */
5896
5897 #define PAGE_SHIFT 12
5898 #define PAGE_SIZE (1UL << PAGE_SHIFT)
5899 diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
5900 index 2b9ea85..376a98e 100644
5901 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
5902 +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
5903 @@ -218,6 +218,11 @@
5904 # define DOARGS_5 DOARGS_4
5905 # define DOARGS_6 DOARGS_5
5906
5907 +/* For the calculation see asm/vsyscall.h. */
5908 +# define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000
5909 +# define VSYSCALL_ADDR_vtime 0xffffffffff600400
5910 +# define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800
5911 +
5912 #else /* !__ASSEMBLER__ */
5913 /* Define a macro which expands inline into the wrapper code for a system
5914 call. */
5915 @@ -366,6 +371,11 @@
5916 LOAD_REGS_5
5917 # define ASM_ARGS_6 ASM_ARGS_5, "r" (_a6)
5918
5919 +/* For the calculation see asm/vsyscall.h. */
5920 +# define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000ul
5921 +# define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800ul
5922 +# define VSYSCALL_ADDR_vtime 0xffffffffff600400ul
5923 +
5924 #endif /* __ASSEMBLER__ */
5925
5926
5927 diff --git a/sysdeps/unix/sysv/linux/x86_64/time.S b/sysdeps/unix/sysv/linux/x86_64/time.S
5928 deleted file mode 100644
5929 index 66d7498..0000000
5930 --- a/sysdeps/unix/sysv/linux/x86_64/time.S
5931 +++ /dev/null
5932 @@ -1,47 +0,0 @@
5933 -/* Copyright (C) 2001,02, 2003, 2011 Free Software Foundation, Inc.
5934 - This file is part of the GNU C Library.
5935 -
5936 - The GNU C Library is free software; you can redistribute it and/or
5937 - modify it under the terms of the GNU Lesser General Public
5938 - License as published by the Free Software Foundation; either
5939 - version 2.1 of the License, or (at your option) any later version.
5940 -
5941 - The GNU C Library is distributed in the hope that it will be useful,
5942 - but WITHOUT ANY WARRANTY; without even the implied warranty of
5943 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5944 - Lesser General Public License for more details.
5945 -
5946 - You should have received a copy of the GNU Lesser General Public
5947 - License along with the GNU C Library; if not, write to the Free
5948 - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5949 - 02111-1307 USA. */
5950 -
5951 -#include <sysdep.h>
5952 -#define _ERRNO_H 1
5953 -#include <bits/errno.h>
5954 -
5955 -/* For the calculation see asm/vsyscall.h. */
5956 -#define VSYSCALL_ADDR_vtime 0xffffffffff600400
5957 -
5958 -
5959 -/* Return the current time as a `time_t' and also put it in *T if T is
5960 - not NULL. Time is represented as seconds from Jan 1 00:00:00 1970. */
5961 -
5962 -ENTRY (time)
5963 - /* Align stack. */
5964 - sub $0x8, %rsp
5965 - cfi_adjust_cfa_offset(8)
5966 -
5967 -#ifdef SHARED
5968 - movq __vdso_time(%rip), %rax
5969 - PTR_DEMANGLE (%rax)
5970 -#else
5971 - movq $VSYSCALL_ADDR_vtime, %rax
5972 -#endif
5973 - callq *%rax
5974 -
5975 - add $0x8, %rsp
5976 - cfi_adjust_cfa_offset(-8)
5977 - ret
5978 -PSEUDO_END_NOERRNO(time)
5979 -libc_hidden_def (time)
5980 diff --git a/sysdeps/unix/sysv/linux/x86_64/time.c b/sysdeps/unix/sysv/linux/x86_64/time.c
5981 new file mode 100644
5982 index 0000000..7b4a0c8
5983 --- /dev/null
5984 +++ b/sysdeps/unix/sysv/linux/x86_64/time.c
5985 @@ -0,0 +1,48 @@
5986 +/* Copyright (C) 2001,02,2003,2011 Free Software Foundation, Inc.
5987 + This file is part of the GNU C Library.
5988 +
5989 + The GNU C Library is free software; you can redistribute it and/or
5990 + modify it under the terms of the GNU Lesser General Public
5991 + License as published by the Free Software Foundation; either
5992 + version 2.1 of the License, or (at your option) any later version.
5993 +
5994 + The GNU C Library is distributed in the hope that it will be useful,
5995 + but WITHOUT ANY WARRANTY; without even the implied warranty of
5996 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5997 + Lesser General Public License for more details.
5998 +
5999 + You should have received a copy of the GNU Lesser General Public
6000 + License along with the GNU C Library; if not, write to the Free
6001 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6002 + 02111-1307 USA. */
6003 +
6004 +#ifdef SHARED
6005 +#include <dl-vdso.h>
6006 +
6007 +void *time_ifunc (void) __asm__ ("time");
6008 +
6009 +void *
6010 +time_ifunc (void)
6011 +{
6012 + PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
6013 +
6014 + /* If the vDSO is not available we fall back on the old vsyscall. */
6015 + return _dl_vdso_vsym ("time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime;
6016 +}
6017 +__asm (".type time, %gnu_indirect_function");
6018 +
6019 +#else
6020 +
6021 +# include <time.h>
6022 +# include <sysdep.h>
6023 +
6024 +time_t
6025 +time (time_t *t)
6026 +{
6027 + INTERNAL_SYSCALL_DECL (err);
6028 + return INTERNAL_SYSCALL (time, err, 1, t);
6029 +}
6030 +
6031 +#endif
6032 +
6033 +strong_alias (time, __GI_time)
6034 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/Implies b/sysdeps/unix/sysv/linux/x86_64/x32/Implies
6035 new file mode 100644
6036 index 0000000..8d91c80
6037 --- /dev/null
6038 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/Implies
6039 @@ -0,0 +1 @@
6040 +unix/sysv/linux/wordsize-64
6041 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
6042 new file mode 100644
6043 index 0000000..5f77df7
6044 --- /dev/null
6045 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
6046 @@ -0,0 +1,3 @@
6047 +ifeq ($(subdir),posix)
6048 +sysdep_routines += getcpu sched_getcpu-static
6049 +endif
6050 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/alphasort.c b/sysdeps/unix/sysv/linux/x86_64/x32/alphasort.c
6051 new file mode 100644
6052 index 0000000..69ec427
6053 --- /dev/null
6054 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/alphasort.c
6055 @@ -0,0 +1 @@
6056 +#include <sysdeps/wordsize-64/alphasort.c>
6057 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/alphasort64.c b/sysdeps/unix/sysv/linux/x86_64/x32/alphasort64.c
6058 new file mode 100644
6059 index 0000000..6c5b2a1
6060 --- /dev/null
6061 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/alphasort64.c
6062 @@ -0,0 +1 @@
6063 +#include <sysdeps/wordsize-64/alphasort64.c>
6064 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/dl-cache.h b/sysdeps/unix/sysv/linux/x86_64/x32/dl-cache.h
6065 new file mode 100644
6066 index 0000000..22a56d7
6067 --- /dev/null
6068 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/dl-cache.h
6069 @@ -0,0 +1,23 @@
6070 +/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
6071 + Copyright (C) 20011 Free Software Foundation, Inc.
6072 + This file is part of the GNU C Library.
6073 +
6074 + The GNU C Library is free software; you can redistribute it and/or
6075 + modify it under the terms of the GNU Lesser General Public
6076 + License as published by the Free Software Foundation; either
6077 + version 2.1 of the License, or (at your option) any later version.
6078 +
6079 + The GNU C Library is distributed in the hope that it will be useful,
6080 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6081 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6082 + Lesser General Public License for more details.
6083 +
6084 + You should have received a copy of the GNU Lesser General Public
6085 + License along with the GNU C Library; if not, write to the Free
6086 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6087 + 02111-1307 USA. */
6088 +
6089 +#include <sysdeps/unix/sysv/linux/x86_64/dl-cache.h>
6090 +
6091 +#undef _DL_CACHE_DEFAULT_ID
6092 +#define _DL_CACHE_DEFAULT_ID 0x803
6093 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/fallocate.c b/sysdeps/unix/sysv/linux/x86_64/x32/fallocate.c
6094 new file mode 100644
6095 index 0000000..3b849d5
6096 --- /dev/null
6097 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/fallocate.c
6098 @@ -0,0 +1,56 @@
6099 +/* Copyright (C) 2011 Free Software Foundation, Inc.
6100 + This file is part of the GNU C Library.
6101 +
6102 + The GNU C Library is free software; you can redistribute it and/or
6103 + modify it under the terms of the GNU Lesser General Public
6104 + License as published by the Free Software Foundation; either
6105 + version 2.1 of the License, or (at your option) any later version.
6106 +
6107 + The GNU C Library is distributed in the hope that it will be useful,
6108 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6109 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6110 + Lesser General Public License for more details.
6111 +
6112 + You should have received a copy of the GNU Lesser General Public
6113 + License along with the GNU C Library; if not, write to the Free
6114 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6115 + 02111-1307 USA. */
6116 +
6117 +#include <errno.h>
6118 +#include <fcntl.h>
6119 +#include <sysdep.h>
6120 +#include <sysdep-cancel.h>
6121 +
6122 +#undef LOAD_ARGS_3
6123 +#define LOAD_ARGS_3(a1, a2, a3) \
6124 + long long int __arg3 = (long long int) (a3); \
6125 + LOAD_ARGS_2 (a1, a2)
6126 +#undef LOAD_REGS_3
6127 +#define LOAD_REGS_3 \
6128 + register long long int _a3 asm ("rdx") = __arg3; \
6129 + LOAD_REGS_2
6130 +
6131 +#undef LOAD_ARGS_4
6132 +#define LOAD_ARGS_4(a1, a2, a3, a4) \
6133 + long long int __arg4 = (long long int) (a4); \
6134 + LOAD_ARGS_3 (a1, a2, a3)
6135 +#undef LOAD_REGS_4
6136 +#define LOAD_REGS_4 \
6137 + register long long int _a4 asm ("r10") = __arg4; \
6138 + LOAD_REGS_3
6139 +
6140 +/* Reserve storage for the data of the file associated with FD. */
6141 +int
6142 +fallocate (int fd, int mode, __off_t offset, __off_t len)
6143 +{
6144 + if (SINGLE_THREAD_P)
6145 + return INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len);
6146 +
6147 + int oldtype = LIBC_CANCEL_ASYNC ();
6148 + int result = INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len);
6149 +
6150 + LIBC_CANCEL_RESET (oldtype);
6151 +
6152 + return result;
6153 +}
6154 +strong_alias (fallocate, fallocate64)
6155 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/fseeko.c b/sysdeps/unix/sysv/linux/x86_64/x32/fseeko.c
6156 new file mode 100644
6157 index 0000000..dc47698
6158 --- /dev/null
6159 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/fseeko.c
6160 @@ -0,0 +1 @@
6161 +#include <sysdeps/wordsize-64/fseeko.c>
6162 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/fseeko64.c b/sysdeps/unix/sysv/linux/x86_64/x32/fseeko64.c
6163 new file mode 100644
6164 index 0000000..3e554ec
6165 --- /dev/null
6166 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/fseeko64.c
6167 @@ -0,0 +1 @@
6168 +#include <sysdeps/wordsize-64/fseeko64.c>
6169 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/ftello.c b/sysdeps/unix/sysv/linux/x86_64/x32/ftello.c
6170 new file mode 100644
6171 index 0000000..735e3e1
6172 --- /dev/null
6173 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/ftello.c
6174 @@ -0,0 +1 @@
6175 +#include <sysdeps/wordsize-64/ftello.c>
6176 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/ftello64.c b/sysdeps/unix/sysv/linux/x86_64/x32/ftello64.c
6177 new file mode 100644
6178 index 0000000..eb155ed
6179 --- /dev/null
6180 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/ftello64.c
6181 @@ -0,0 +1 @@
6182 +#include <sysdeps/wordsize-64/ftello64.c>
6183 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/ftw.c b/sysdeps/unix/sysv/linux/x86_64/x32/ftw.c
6184 new file mode 100644
6185 index 0000000..a21dfe5
6186 --- /dev/null
6187 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/ftw.c
6188 @@ -0,0 +1 @@
6189 +#include <sysdeps/wordsize-64/ftw.c>
6190 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/ftw64.c b/sysdeps/unix/sysv/linux/x86_64/x32/ftw64.c
6191 new file mode 100644
6192 index 0000000..3c025b7
6193 --- /dev/null
6194 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/ftw64.c
6195 @@ -0,0 +1 @@
6196 +#include <sysdeps/wordsize-64/ftw64.c>
6197 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c b/sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c
6198 new file mode 100644
6199 index 0000000..f00cdff
6200 --- /dev/null
6201 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c
6202 @@ -0,0 +1,32 @@
6203 +/* Copyright (C) 2011 Free Software Foundation, Inc.
6204 + This file is part of the GNU C Library.
6205 +
6206 + The GNU C Library is free software; you can redistribute it and/or
6207 + modify it under the terms of the GNU Lesser General Public
6208 + License as published by the Free Software Foundation; either
6209 + version 2.1 of the License, or (at your option) any later version.
6210 +
6211 + The GNU C Library is distributed in the hope that it will be useful,
6212 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6213 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6214 + Lesser General Public License for more details.
6215 +
6216 + You should have received a copy of the GNU Lesser General Public
6217 + License along with the GNU C Library; if not, write to the Free
6218 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6219 + 02111-1307 USA. */
6220 +
6221 +#ifdef SHARED
6222 +# include <dl-vdso.h>
6223 +
6224 +void *getcpu_ifunc (void) __asm__ ("__getcpu");
6225 +
6226 +void *
6227 +getcpu_ifunc (void)
6228 +{
6229 + PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
6230 +
6231 + return _dl_vdso_vsym ("getcpu", &linux26);
6232 +}
6233 +__asm (".type __getcpu, %gnu_indirect_function");
6234 +#endif
6235 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/getdents.c b/sysdeps/unix/sysv/linux/x86_64/x32/getdents.c
6236 new file mode 100644
6237 index 0000000..7634853
6238 --- /dev/null
6239 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/getdents.c
6240 @@ -0,0 +1,161 @@
6241 +/* Copyright (C) 2011
6242 + Free Software Foundation, Inc.
6243 + This file is part of the GNU C Library.
6244 +
6245 + The GNU C Library is free software; you can redistribute it and/or
6246 + modify it under the terms of the GNU Lesser General Public
6247 + License as published by the Free Software Foundation; either
6248 + version 2.1 of the License, or (at your option) any later version.
6249 +
6250 + The GNU C Library is distributed in the hope that it will be useful,
6251 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6252 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6253 + Lesser General Public License for more details.
6254 +
6255 + You should have received a copy of the GNU Lesser General Public
6256 + License along with the GNU C Library; if not, write to the Free
6257 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6258 + 02111-1307 USA. */
6259 +
6260 +#include <alloca.h>
6261 +#include <errno.h>
6262 +#include <dirent.h>
6263 +#include <stddef.h>
6264 +#include <stdint.h>
6265 +#include <string.h>
6266 +#include <unistd.h>
6267 +#include <sys/types.h>
6268 +#include <sysdep.h>
6269 +#include <bp-checks.h>
6270 +
6271 +/* For Linux we need a special version of this file since the
6272 + definition of `struct dirent' is not the same for the kernel and
6273 + the libc. There is one additional field which might be introduced
6274 + in the kernel structure in the future.
6275 +
6276 + Here is the kernel definition of `struct dirent64' as of 2.1.20: */
6277 +
6278 +struct kernel_dirent64
6279 + {
6280 + uint64_t d_ino;
6281 + int64_t d_off;
6282 + unsigned short int d_reclen;
6283 + unsigned char d_type;
6284 + char d_name[256];
6285 + };
6286 +
6287 +#ifndef __GETDENTS
6288 +# define __GETDENTS __getdents
6289 +#endif
6290 +#ifndef DIRENT_TYPE
6291 +# define DIRENT_TYPE struct dirent
6292 +#endif
6293 +#ifndef DIRENT_SET_DP_INO
6294 +# define DIRENT_SET_DP_INO(dp, value) (dp)->d_ino = (value)
6295 +#endif
6296 +
6297 +/* The problem here is that we cannot simply read the next NBYTES
6298 + bytes. We need to take the additional field into account. We use
6299 + some heuristic. Assuming the directory contains names with 14
6300 + characters on average we can compute an estimated number of entries
6301 + which fit in the buffer. Taking this number allows us to specify a
6302 + reasonable number of bytes to read. If we should be wrong, we can
6303 + reset the file descriptor. In practice the kernel is limiting the
6304 + amount of data returned much more then the reduced buffer size. */
6305 +ssize_t
6306 +internal_function
6307 +__GETDENTS (int fd, char *buf, size_t nbytes)
6308 +{
6309 + ssize_t retval;
6310 + off64_t last_offset = -1;
6311 + union
6312 + {
6313 + struct kernel_dirent64 k;
6314 + DIRENT_TYPE u;
6315 + char b[1];
6316 + } *kbuf = (void *) buf, *outp, *inp;
6317 + size_t kbytes = nbytes;
6318 + if (offsetof (DIRENT_TYPE, d_name)
6319 + < offsetof (struct kernel_dirent64, d_name)
6320 + && nbytes <= sizeof (DIRENT_TYPE))
6321 + {
6322 + kbytes = nbytes + offsetof (struct kernel_dirent64, d_name)
6323 + - offsetof (DIRENT_TYPE, d_name);
6324 + kbuf = __alloca(kbytes);
6325 + }
6326 + retval = INLINE_SYSCALL (getdents64, 3, fd, CHECK_N(kbuf, kbytes),
6327 + kbytes);
6328 + const size_t size_diff = (offsetof (struct kernel_dirent64, d_name)
6329 + - offsetof (DIRENT_TYPE, d_name));
6330 +
6331 + /* Return the error if encountered. */
6332 + if (retval == -1)
6333 + return -1;
6334 +
6335 + /* If the structure returned by the kernel is identical to what we
6336 + need, don't do any conversions. */
6337 + if (offsetof (DIRENT_TYPE, d_name)
6338 + == offsetof (struct kernel_dirent64, d_name)
6339 + && sizeof (outp->u.d_ino) == sizeof (inp->k.d_ino)
6340 + && sizeof (outp->u.d_off) == sizeof (inp->k.d_off))
6341 + return retval;
6342 +
6343 + /* These two pointers might alias the same memory buffer.
6344 + Standard C requires that we always use the same type for them,
6345 + so we must use the union type. */
6346 + inp = kbuf;
6347 + outp = (void *) buf;
6348 +
6349 + while (&inp->b < &kbuf->b + retval)
6350 + {
6351 + const size_t alignment = __alignof__ (DIRENT_TYPE);
6352 + /* Since inp->k.d_reclen is already aligned for the kernel
6353 + structure this may compute a value that is bigger
6354 + than necessary. */
6355 + size_t old_reclen = inp->k.d_reclen;
6356 + size_t new_reclen = ((old_reclen - size_diff + alignment - 1)
6357 + & ~(alignment - 1));
6358 +
6359 + /* Copy the data out of the old structure into temporary space.
6360 + Then copy the name, which may overlap if BUF == KBUF. */
6361 + const uint64_t d_ino = inp->k.d_ino;
6362 + const int64_t d_off = inp->k.d_off;
6363 + const uint8_t d_type = inp->k.d_type;
6364 +
6365 + memmove (outp->u.d_name, inp->k.d_name,
6366 + old_reclen - offsetof (struct kernel_dirent64, d_name));
6367 +
6368 + /* Now we have copied the data from INP and access only OUTP. */
6369 +
6370 + DIRENT_SET_DP_INO (&outp->u, d_ino);
6371 + outp->u.d_off = d_off;
6372 + if ((sizeof (outp->u.d_ino) != sizeof (inp->k.d_ino)
6373 + && outp->u.d_ino != d_ino)
6374 + || (sizeof (outp->u.d_off) != sizeof (inp->k.d_off)
6375 + && outp->u.d_off != d_off))
6376 + {
6377 + /* Overflow. If there was at least one entry
6378 + before this one, return them without error,
6379 + otherwise signal overflow. */
6380 + if (last_offset != -1)
6381 + {
6382 + __lseek64 (fd, last_offset, SEEK_SET);
6383 + return outp->b - buf;
6384 + }
6385 + __set_errno (EOVERFLOW);
6386 + return -1;
6387 + }
6388 +
6389 + last_offset = d_off;
6390 + outp->u.d_reclen = new_reclen;
6391 + outp->u.d_type = d_type;
6392 +
6393 + inp = (void *) inp + old_reclen;
6394 + outp = (void *) outp + new_reclen;
6395 + }
6396 +
6397 + return outp->b - buf;
6398 +}
6399 +
6400 +#undef __getdents64
6401 +weak_alias (__getdents, __getdents64);
6402 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/gettimeofday.c b/sysdeps/unix/sysv/linux/x86_64/x32/gettimeofday.c
6403 new file mode 100644
6404 index 0000000..3ff95dc
6405 --- /dev/null
6406 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/gettimeofday.c
6407 @@ -0,0 +1,45 @@
6408 +/* Copyright (C) 2011 Free Software Foundation, Inc.
6409 + This file is part of the GNU C Library.
6410 +
6411 + The GNU C Library is free software; you can redistribute it and/or
6412 + modify it under the terms of the GNU Lesser General Public
6413 + License as published by the Free Software Foundation; either
6414 + version 2.1 of the License, or (at your option) any later version.
6415 +
6416 + The GNU C Library is distributed in the hope that it will be useful,
6417 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6418 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6419 + Lesser General Public License for more details.
6420 +
6421 + You should have received a copy of the GNU Lesser General Public
6422 + License along with the GNU C Library; if not, write to the Free
6423 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6424 + 02111-1307 USA. */
6425 +
6426 +#ifdef SHARED
6427 +# include <dl-vdso.h>
6428 +
6429 +void *gettimeofday_ifunc (void) __asm__ ("__gettimeofday");
6430 +
6431 +void *
6432 +gettimeofday_ifunc (void)
6433 +{
6434 + PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
6435 +
6436 + return _dl_vdso_vsym ("gettimeofday", &linux26);
6437 +}
6438 +__asm (".type __gettimeofday, %gnu_indirect_function");
6439 +#else
6440 +# include <errno.h>
6441 +# include <sysdep.h>
6442 +# include <sys/time.h>
6443 +
6444 +int
6445 +__gettimeofday (struct timeval *tv, struct timezone *tz)
6446 +{
6447 + return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
6448 +}
6449 +#endif
6450 +
6451 +weak_alias (__gettimeofday, gettimeofday)
6452 +strong_alias (__gettimeofday, __gettimeofday_internal)
6453 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/glob.c b/sysdeps/unix/sysv/linux/x86_64/x32/glob.c
6454 new file mode 100644
6455 index 0000000..e542747
6456 --- /dev/null
6457 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/glob.c
6458 @@ -0,0 +1 @@
6459 +#include <sysdeps/wordsize-64/glob.c>
6460 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c b/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
6461 new file mode 100644
6462 index 0000000..6eae5f4
6463 --- /dev/null
6464 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
6465 @@ -0,0 +1,40 @@
6466 +/* Copyright (C) 2011 Free Software Foundation, Inc.
6467 + This file is part of the GNU C Library.
6468 +
6469 + The GNU C Library is free software; you can redistribute it and/or
6470 + modify it under the terms of the GNU Lesser General Public
6471 + License as published by the Free Software Foundation; either
6472 + version 2.1 of the License, or (at your option) any later version.
6473 +
6474 + The GNU C Library is distributed in the hope that it will be useful,
6475 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6476 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6477 + Lesser General Public License for more details.
6478 +
6479 + You should have received a copy of the GNU Lesser General Public
6480 + License along with the GNU C Library; if not, write to the Free
6481 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6482 + 02111-1307 USA. */
6483 +
6484 +#ifdef SHARED
6485 +# include <dl-vdso.h>
6486 +# include <bits/libc-vdso.h>
6487 +
6488 +long int (*__vdso_clock_gettime) (clockid_t, struct timespec *)
6489 + __attribute__ ((nocommon));
6490 +strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden)
6491 +
6492 +static inline void
6493 +_libc_vdso_platform_setup (void)
6494 +{
6495 + PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
6496 +
6497 + void *p = _dl_vdso_vsym ("clock_gettime", &linux26);
6498 + PTR_MANGLE (p);
6499 + __GI___vdso_clock_gettime = p;
6500 +}
6501 +
6502 +# define VDSO_SETUP _libc_vdso_platform_setup
6503 +#endif
6504 +
6505 +#include "../../init-first.c"
6506 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/iofgetpos.c b/sysdeps/unix/sysv/linux/x86_64/x32/iofgetpos.c
6507 new file mode 100644
6508 index 0000000..de2ff01
6509 --- /dev/null
6510 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/iofgetpos.c
6511 @@ -0,0 +1 @@
6512 +#include <sysdeps/wordsize-64/iofgetpos.c>
6513 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/iofgetpos64.c b/sysdeps/unix/sysv/linux/x86_64/x32/iofgetpos64.c
6514 new file mode 100644
6515 index 0000000..34aabfc
6516 --- /dev/null
6517 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/iofgetpos64.c
6518 @@ -0,0 +1 @@
6519 +#include <sysdeps/wordsize-64/iofgetpos64.c>
6520 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/iofopen.c b/sysdeps/unix/sysv/linux/x86_64/x32/iofopen.c
6521 new file mode 100644
6522 index 0000000..e39bb55
6523 --- /dev/null
6524 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/iofopen.c
6525 @@ -0,0 +1 @@
6526 +#include <sysdeps/wordsize-64/iofopen.c>
6527 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/iofopen64.c b/sysdeps/unix/sysv/linux/x86_64/x32/iofopen64.c
6528 new file mode 100644
6529 index 0000000..af0c6ae
6530 --- /dev/null
6531 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/iofopen64.c
6532 @@ -0,0 +1 @@
6533 +#include <sysdeps/wordsize-64/iofopen64.c>
6534 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/iofsetpos.c b/sysdeps/unix/sysv/linux/x86_64/x32/iofsetpos.c
6535 new file mode 100644
6536 index 0000000..a4c99c9
6537 --- /dev/null
6538 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/iofsetpos.c
6539 @@ -0,0 +1 @@
6540 +#include <sysdeps/wordsize-64/iofsetpos.c>
6541 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/iofsetpos64.c b/sysdeps/unix/sysv/linux/x86_64/x32/iofsetpos64.c
6542 new file mode 100644
6543 index 0000000..e83fbba
6544 --- /dev/null
6545 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/iofsetpos64.c
6546 @@ -0,0 +1 @@
6547 +#include <sysdeps/wordsize-64/iofsetpos64.c>
6548 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/llseek.S b/sysdeps/unix/sysv/linux/x86_64/x32/llseek.S
6549 new file mode 100644
6550 index 0000000..ca33fd1
6551 --- /dev/null
6552 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/llseek.S
6553 @@ -0,0 +1,33 @@
6554 +/* Copyright (C) 2011 Free Software Foundation, Inc.
6555 + This file is part of the GNU C Library.
6556 +
6557 + The GNU C Library is free software; you can redistribute it and/or
6558 + modify it under the terms of the GNU Lesser General Public
6559 + License as published by the Free Software Foundation; either
6560 + version 2.1 of the License, or (at your option) any later version.
6561 +
6562 + The GNU C Library is distributed in the hope that it will be useful,
6563 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6564 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6565 + Lesser General Public License for more details.
6566 +
6567 + You should have received a copy of the GNU Lesser General Public
6568 + License along with the GNU C Library; if not, write to the Free
6569 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6570 + 02111-1307 USA. */
6571 +
6572 +#define SYSCALL_RETURN_INT64
6573 +#include <sysdep.h>
6574 +
6575 +#define SYSCALL_NAME lseek
6576 +#define SYSCALL_NARGS 3
6577 +#define SYSCALL_SYMBOL __libc_lseek64
6578 +#define SYSCALL_CANCELLABLE 1
6579 +#include <syscall-template.S>
6580 +weak_alias (__libc_lseek64, __lseek64)
6581 +libc_hidden_weak (__lseek64)
6582 +weak_alias (__libc_lseek64, lseek64)
6583 +libc_hidden_weak (lseek64)
6584 +weak_alias (__libc_lseek64, __lseek)
6585 +libc_hidden_weak (__lseek)
6586 +weak_alias (__libc_lseek64, lseek)
6587 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/lockf.c b/sysdeps/unix/sysv/linux/x86_64/x32/lockf.c
6588 new file mode 100644
6589 index 0000000..42306a0
6590 --- /dev/null
6591 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/lockf.c
6592 @@ -0,0 +1 @@
6593 +#include <sysdeps/wordsize-64/lockf.c>
6594 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/lockf64.c b/sysdeps/unix/sysv/linux/x86_64/x32/lockf64.c
6595 new file mode 100644
6596 index 0000000..3b4b55a
6597 --- /dev/null
6598 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/lockf64.c
6599 @@ -0,0 +1 @@
6600 +#include <sysdeps/wordsize-64/lockf64.c>
6601 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/mkostemp.c b/sysdeps/unix/sysv/linux/x86_64/x32/mkostemp.c
6602 new file mode 100644
6603 index 0000000..177f68a
6604 --- /dev/null
6605 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/mkostemp.c
6606 @@ -0,0 +1 @@
6607 +#include <sysdeps/wordsize-64/mkostemp.c>
6608 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/mkostemp64.c b/sysdeps/unix/sysv/linux/x86_64/x32/mkostemp64.c
6609 new file mode 100644
6610 index 0000000..68455a8
6611 --- /dev/null
6612 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/mkostemp64.c
6613 @@ -0,0 +1 @@
6614 +#include <sysdeps/wordsize-64/mkostemp64.c>
6615 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/mkstemp.c b/sysdeps/unix/sysv/linux/x86_64/x32/mkstemp.c
6616 new file mode 100644
6617 index 0000000..4bc129b
6618 --- /dev/null
6619 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/mkstemp.c
6620 @@ -0,0 +1 @@
6621 +#include <sysdeps/wordsize-64/mkstemp.c>
6622 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/mkstemp64.c b/sysdeps/unix/sysv/linux/x86_64/x32/mkstemp64.c
6623 new file mode 100644
6624 index 0000000..76a8363
6625 --- /dev/null
6626 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/mkstemp64.c
6627 @@ -0,0 +1 @@
6628 +#include <sysdeps/wordsize-64/mkstemp64.c>
6629 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/posix_fadvise.c b/sysdeps/unix/sysv/linux/x86_64/x32/posix_fadvise.c
6630 new file mode 100644
6631 index 0000000..b56b1b9
6632 --- /dev/null
6633 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/posix_fadvise.c
6634 @@ -0,0 +1,53 @@
6635 +/* Copyright (C) 2011 Free Software Foundation, Inc.
6636 + This file is part of the GNU C Library.
6637 +
6638 + The GNU C Library is free software; you can redistribute it and/or
6639 + modify it under the terms of the GNU Lesser General Public
6640 + License as published by the Free Software Foundation; either
6641 + version 2.1 of the License, or (at your option) any later version.
6642 +
6643 + The GNU C Library is distributed in the hope that it will be useful,
6644 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6645 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6646 + Lesser General Public License for more details.
6647 +
6648 + You should have received a copy of the GNU Lesser General Public
6649 + License along with the GNU C Library; if not, write to the Free
6650 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6651 + 02111-1307 USA. */
6652 +
6653 +#include <errno.h>
6654 +#include <fcntl.h>
6655 +#include <sysdep.h>
6656 +
6657 +#undef LOAD_ARGS_2
6658 +#define LOAD_ARGS_2(a1, a2) \
6659 + long long int __arg2 = (long long int) (a2); \
6660 + LOAD_ARGS_1 (a1)
6661 +#undef LOAD_REGS_2
6662 +#define LOAD_REGS_2 \
6663 + register long long int _a2 asm ("rsi") = __arg2; \
6664 + LOAD_REGS_1
6665 +
6666 +#undef LOAD_ARGS_3
6667 +#define LOAD_ARGS_3(a1, a2, a3) \
6668 + long long int __arg3 = (long long int) (a3); \
6669 + LOAD_ARGS_2 (a1, a2)
6670 +#undef LOAD_REGS_3
6671 +#define LOAD_REGS_3 \
6672 + register long long int _a3 asm ("rdx") = __arg3; \
6673 + LOAD_REGS_2
6674 +
6675 +/* Advice the system about the expected behaviour of the application with
6676 + respect to the file associated with FD. */
6677 +
6678 +int
6679 +posix_fadvise (int fd, off_t offset, off_t len, int advise)
6680 +{
6681 + INTERNAL_SYSCALL_DECL (err);
6682 + int ret = INTERNAL_SYSCALL (fadvise64, err, 4, fd, offset, len, advise);
6683 + if (INTERNAL_SYSCALL_ERROR_P (ret, err))
6684 + return INTERNAL_SYSCALL_ERRNO (ret, err);
6685 + return 0;
6686 +}
6687 +strong_alias (posix_fadvise, posix_fadvise64)
6688 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/posix_fallocate.c b/sysdeps/unix/sysv/linux/x86_64/x32/posix_fallocate.c
6689 new file mode 100644
6690 index 0000000..80d4de1
6691 --- /dev/null
6692 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/posix_fallocate.c
6693 @@ -0,0 +1,59 @@
6694 +/* Copyright (C) 2011 Free Software Foundation, Inc.
6695 + This file is part of the GNU C Library.
6696 +
6697 + The GNU C Library is free software; you can redistribute it and/or
6698 + modify it under the terms of the GNU Lesser General Public
6699 + License as published by the Free Software Foundation; either
6700 + version 2.1 of the License, or (at your option) any later version.
6701 +
6702 + The GNU C Library is distributed in the hope that it will be useful,
6703 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6704 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6705 + Lesser General Public License for more details.
6706 +
6707 + You should have received a copy of the GNU Lesser General Public
6708 + License along with the GNU C Library; if not, write to the Free
6709 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6710 + 02111-1307 USA. */
6711 +
6712 +#include <fcntl.h>
6713 +#include <sysdep.h>
6714 +
6715 +#define posix_fallocate static internal_fallocate
6716 +#include <sysdeps/posix/posix_fallocate.c>
6717 +#undef posix_fallocate
6718 +
6719 +#undef LOAD_ARGS_2
6720 +#define LOAD_ARGS_2(a1, a2) \
6721 + long long int __arg2 = (long long int) (a2); \
6722 + LOAD_ARGS_1 (a1)
6723 +#undef LOAD_REGS_2
6724 +#define LOAD_REGS_2 \
6725 + register long long int _a2 asm ("rsi") = __arg2; \
6726 + LOAD_REGS_1
6727 +
6728 +#undef LOAD_ARGS_3
6729 +#define LOAD_ARGS_3(a1, a2, a3) \
6730 + long long int __arg3 = (long long int) (a3); \
6731 + LOAD_ARGS_2 (a1, a2)
6732 +#undef LOAD_REGS_3
6733 +#define LOAD_REGS_3 \
6734 + register long long int _a3 asm ("rdx") = __arg3; \
6735 + LOAD_REGS_2
6736 +
6737 +/* Reserve storage for the data of the file associated with FD. */
6738 +int
6739 +posix_fallocate (int fd, __off_t offset, __off_t len)
6740 +{
6741 + INTERNAL_SYSCALL_DECL (err);
6742 + int res = INTERNAL_SYSCALL (fallocate, err, 4, fd, 0, offset, len);
6743 +
6744 + if (! INTERNAL_SYSCALL_ERROR_P (res, err))
6745 + return 0;
6746 +
6747 + if (INTERNAL_SYSCALL_ERRNO (res, err) != EOPNOTSUPP)
6748 + return INTERNAL_SYSCALL_ERRNO (res, err);
6749 +
6750 + return internal_fallocate (fd, offset, len);
6751 +}
6752 +strong_alias (posix_fallocate, posix_fallocate64)
6753 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/preadv.c b/sysdeps/unix/sysv/linux/x86_64/x32/preadv.c
6754 new file mode 100644
6755 index 0000000..7399dd3
6756 --- /dev/null
6757 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/preadv.c
6758 @@ -0,0 +1,49 @@
6759 +/* Copyright (C) 2011 Free Software Foundation, Inc.
6760 + This file is part of the GNU C Library.
6761 +
6762 + The GNU C Library is free software; you can redistribute it and/or
6763 + modify it under the terms of the GNU Lesser General Public
6764 + License as published by the Free Software Foundation; either
6765 + version 2.1 of the License, or (at your option) any later version.
6766 +
6767 + The GNU C Library is distributed in the hope that it will be useful,
6768 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6769 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6770 + Lesser General Public License for more details.
6771 +
6772 + You should have received a copy of the GNU Lesser General Public
6773 + License along with the GNU C Library; if not, write to the Free
6774 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6775 + 02111-1307 USA. */
6776 +
6777 +#include <errno.h>
6778 +#include <sysdep.h>
6779 +#define preadv64 __redirect_preadv64
6780 +#include <sys/uio.h>
6781 +#include <sysdep-cancel.h>
6782 +
6783 +#undef LOAD_ARGS_4
6784 +#define LOAD_ARGS_4(a1, a2, a3, a4) \
6785 + long long int __arg4 = (long long int) (a4); \
6786 + LOAD_ARGS_3 (a1, a2, a3)
6787 +#undef LOAD_REGS_4
6788 +#define LOAD_REGS_4 \
6789 + register long long int _a4 asm ("r10") = __arg4; \
6790 + LOAD_REGS_3
6791 +
6792 +ssize_t
6793 +preadv (int fd, const struct iovec *vector, int count, off_t offset)
6794 +{
6795 + ssize_t result;
6796 + if (SINGLE_THREAD_P)
6797 + result = INLINE_SYSCALL (preadv, 4, fd, vector, count, offset);
6798 + else
6799 + {
6800 + int oldtype = LIBC_CANCEL_ASYNC ();
6801 + result = INLINE_SYSCALL (preadv, 4, fd, vector, count, offset);
6802 + LIBC_CANCEL_RESET (oldtype);
6803 + }
6804 + return result;
6805 +}
6806 +#undef preadv64
6807 +strong_alias (preadv, preadv64)
6808 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/pselect.c b/sysdeps/unix/sysv/linux/x86_64/x32/pselect.c
6809 new file mode 100644
6810 index 0000000..01a0a91
6811 --- /dev/null
6812 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/pselect.c
6813 @@ -0,0 +1,70 @@
6814 +/* Copyright (C) 2011 Free Software Foundation, Inc.
6815 + This file is part of the GNU C Library.
6816 +
6817 + The GNU C Library is free software; you can redistribute it and/or
6818 + modify it under the terms of the GNU Lesser General Public
6819 + License as published by the Free Software Foundation; either
6820 + version 2.1 of the License, or (at your option) any later version.
6821 +
6822 + The GNU C Library is distributed in the hope that it will be useful,
6823 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6824 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6825 + Lesser General Public License for more details.
6826 +
6827 + You should have received a copy of the GNU Lesser General Public
6828 + License along with the GNU C Library; if not, write to the Free
6829 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6830 + 02111-1307 USA. */
6831 +
6832 +#include <errno.h>
6833 +#include <signal.h>
6834 +#include <time.h>
6835 +#include <sys/poll.h>
6836 +#include <sysdep-cancel.h>
6837 +
6838 +
6839 +int
6840 +__pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
6841 + const struct timespec *timeout, const sigset_t *sigmask)
6842 +{
6843 + /* The Linux kernel can in some situations update the timeout value.
6844 + We do not want that so use a local variable. */
6845 + struct timespec tval;
6846 + if (timeout != NULL)
6847 + {
6848 + tval = *timeout;
6849 + timeout = &tval;
6850 + }
6851 +
6852 + /* Note: the system call expects 7 values but on most architectures
6853 + we can only pass in 6 directly. If there is an architecture with
6854 + support for more parameters a new version of this file needs to
6855 + be created. */
6856 + struct
6857 + {
6858 + const sigset_t *ss;
6859 + unsigned long long ss_len;
6860 + } data;
6861 +
6862 + data.ss = sigmask;
6863 + data.ss_len = _NSIG / 8;
6864 +
6865 + int result;
6866 +
6867 + if (SINGLE_THREAD_P)
6868 + result = INLINE_SYSCALL (pselect6, 6, nfds, readfds, writefds,
6869 + exceptfds, timeout, &data);
6870 + else
6871 + {
6872 + int oldtype = LIBC_CANCEL_ASYNC ();
6873 +
6874 + result = INLINE_SYSCALL (pselect6, 6, nfds, readfds, writefds,
6875 + exceptfds, timeout, &data);
6876 +
6877 + LIBC_CANCEL_RESET (oldtype);
6878 + }
6879 +
6880 + return result;
6881 +}
6882 +weak_alias (__pselect, pselect)
6883 +strong_alias (__pselect, __libc_pselect)
6884 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/pwritev.c b/sysdeps/unix/sysv/linux/x86_64/x32/pwritev.c
6885 new file mode 100644
6886 index 0000000..5aaa400
6887 --- /dev/null
6888 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/pwritev.c
6889 @@ -0,0 +1,50 @@
6890 +/* Copyright (C) 2011 Free Software Foundation, Inc.
6891 + This file is part of the GNU C Library.
6892 +
6893 + The GNU C Library is free software; you can redistribute it and/or
6894 + modify it under the terms of the GNU Lesser General Public
6895 + License as published by the Free Software Foundation; either
6896 + version 2.1 of the License, or (at your option) any later version.
6897 +
6898 + The GNU C Library is distributed in the hope that it will be useful,
6899 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6900 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6901 + Lesser General Public License for more details.
6902 +
6903 + You should have received a copy of the GNU Lesser General Public
6904 + License along with the GNU C Library; if not, write to the Free
6905 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6906 + 02111-1307 USA. */
6907 +
6908 +#include <errno.h>
6909 +#include <sysdep.h>
6910 +/* Hide the pwritev64 declaration. */
6911 +#define pwritev64 __redirect_pwritev64
6912 +#include <sys/uio.h>
6913 +#include <sysdep-cancel.h>
6914 +
6915 +#undef LOAD_ARGS_4
6916 +#define LOAD_ARGS_4(a1, a2, a3, a4) \
6917 + long long int __arg4 = (long long int) (a4); \
6918 + LOAD_ARGS_3 (a1, a2, a3)
6919 +#undef LOAD_REGS_4
6920 +#define LOAD_REGS_4 \
6921 + register long long int _a4 asm ("r10") = __arg4; \
6922 + LOAD_REGS_3
6923 +
6924 +ssize_t
6925 +pwritev (int fd, const struct iovec *vector, int count, off_t offset)
6926 +{
6927 + ssize_t result;
6928 + if (SINGLE_THREAD_P)
6929 + result = INLINE_SYSCALL (pwritev, 4, fd, vector, count, offset);
6930 + else
6931 + {
6932 + int oldtype = LIBC_CANCEL_ASYNC ();
6933 + result = INLINE_SYSCALL (pwritev, 4, fd, vector, count, offset);
6934 + LIBC_CANCEL_RESET (oldtype);
6935 + }
6936 + return result;
6937 +}
6938 +#undef pwritev64
6939 +strong_alias (pwritev, pwritev64)
6940 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/scandir.c b/sysdeps/unix/sysv/linux/x86_64/x32/scandir.c
6941 new file mode 100644
6942 index 0000000..9288ca2
6943 --- /dev/null
6944 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/scandir.c
6945 @@ -0,0 +1 @@
6946 +#include <sysdeps/wordsize-64/scandir.c>
6947 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/scandir64.c b/sysdeps/unix/sysv/linux/x86_64/x32/scandir64.c
6948 new file mode 100644
6949 index 0000000..6d22057
6950 --- /dev/null
6951 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/scandir64.c
6952 @@ -0,0 +1 @@
6953 +#include <sysdeps/wordsize-64/scandir64.c>
6954 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/scandirat.c b/sysdeps/unix/sysv/linux/x86_64/x32/scandirat.c
6955 new file mode 100644
6956 index 0000000..5b88993
6957 --- /dev/null
6958 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/scandirat.c
6959 @@ -0,0 +1 @@
6960 +#include <sysdeps/wordsize-64/scandirat.c>
6961 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/scandirat64.c b/sysdeps/unix/sysv/linux/x86_64/x32/scandirat64.c
6962 new file mode 100644
6963 index 0000000..0d7893d
6964 --- /dev/null
6965 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/scandirat64.c
6966 @@ -0,0 +1 @@
6967 +#include <sysdeps/wordsize-64/scandirat64.c>
6968 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c
6969 new file mode 100644
6970 index 0000000..38bbf9a
6971 --- /dev/null
6972 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c
6973 @@ -0,0 +1,3 @@
6974 +#ifndef SHARED
6975 +#include "../../sched_getcpu.c"
6976 +#endif
6977 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
6978 new file mode 100644
6979 index 0000000..a4040ef
6980 --- /dev/null
6981 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
6982 @@ -0,0 +1,47 @@
6983 +/* Copyright (C) 2011 Free Software Foundation, Inc.
6984 + This file is part of the GNU C Library.
6985 +
6986 + The GNU C Library is free software; you can redistribute it and/or
6987 + modify it under the terms of the GNU Lesser General Public
6988 + License as published by the Free Software Foundation; either
6989 + version 2.1 of the License, or (at your option) any later version.
6990 +
6991 + The GNU C Library is distributed in the hope that it will be useful,
6992 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6993 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6994 + Lesser General Public License for more details.
6995 +
6996 + You should have received a copy of the GNU Lesser General Public
6997 + License along with the GNU C Library; if not, write to the Free
6998 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6999 + 02111-1307 USA. */
7000 +
7001 +#ifdef SHARED
7002 +#include <sysdep.h>
7003 +#include <tls.h>
7004 +#define _ERRNO_H 1
7005 +#include <bits/errno.h>
7006 +
7007 +ENTRY (sched_getcpu)
7008 + /* Align stack and create local variable for result. */
7009 + sub $0x8, %esp
7010 + cfi_adjust_cfa_offset(8)
7011 +
7012 + mov %esp, %edi
7013 + xor %esi, %esi
7014 + mov $VGETCPU_CACHE_OFFSET, %edx
7015 + add %fs:0, %edx
7016 +
7017 + call __getcpu@PLT
7018 +
7019 + cmp $-4095, %eax
7020 + jae SYSCALL_ERROR_LABEL
7021 +
7022 + mov (%rsp), %eax
7023 +
7024 +L(pseudo_end):
7025 + add $0x8, %esp
7026 + cfi_adjust_cfa_offset(-8)
7027 + ret
7028 +PSEUDO_END(sched_getcpu)
7029 +#endif
7030 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sendfile64.c b/sysdeps/unix/sysv/linux/x86_64/x32/sendfile64.c
7031 new file mode 100644
7032 index 0000000..4c451bd
7033 --- /dev/null
7034 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/sendfile64.c
7035 @@ -0,0 +1 @@
7036 +/* sendfile64 is alias of sendfile syscall. */
7037 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
7038 new file mode 100644
7039 index 0000000..a5d4007
7040 --- /dev/null
7041 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
7042 @@ -0,0 +1,23 @@
7043 +# Copied from 64bit syscalls.list without llseek, which is implemented in
7044 +# llseek.S to properly handle 64bit parameter and return value.
7045 +
7046 +# File name Caller Syscall name # args Strong name Weak names
7047 +
7048 +lseek llseek -
7049 +pread - pread Ci:ibni __libc_pread __libc_pread64 __pread pread __pread64 pread64
7050 +pwrite - pwrite Ci:ibni __libc_pwrite __libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
7051 +fstatfs - fstatfs i:ip __fstatfs fstatfs fstatfs64 __fstatfs64
7052 +statfs - statfs i:sp __statfs statfs statfs64
7053 +mmap - mmap b:aniiii __mmap mmap __mmap64 mmap64
7054 +ftruncate - ftruncate i:ii __ftruncate ftruncate ftruncate64 __ftruncate64
7055 +truncate - truncate i:si truncate truncate64
7056 +getrlimit - getrlimit i:ip __getrlimit getrlimit getrlimit64
7057 +setrlimit - setrlimit i:ip __setrlimit setrlimit setrlimit64
7058 +readahead - readahead i:iii __readahead readahead
7059 +sendfile - sendfile i:iipi sendfile sendfile64
7060 +sync_file_range - sync_file_range Ci:iiii sync_file_range
7061 +creat - creat Ci:si __libc_creat creat creat64
7062 +open - open Ci:siv __libc_open __open open __open64 open64
7063 +prlimit EXTRA prlimit64 i:iipp prlimit prlimit64
7064 +
7065 +fanotify_mark EXTRA fanotify_mark i:iiiis fanotify_mark
7066 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sysctl.c b/sysdeps/unix/sysv/linux/x86_64/x32/sysctl.c
7067 new file mode 100644
7068 index 0000000..634c289
7069 --- /dev/null
7070 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/sysctl.c
7071 @@ -0,0 +1 @@
7072 +/* X32 doesn't have _sysctl. */
7073 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h
7074 new file mode 100644
7075 index 0000000..486c30d
7076 --- /dev/null
7077 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h
7078 @@ -0,0 +1,132 @@
7079 +/* Copyright (C) 2011 Free Software Foundation, Inc.
7080 + This file is part of the GNU C Library.
7081 +
7082 + The GNU C Library is free software; you can redistribute it and/or
7083 + modify it under the terms of the GNU Lesser General Public
7084 + License as published by the Free Software Foundation; either
7085 + version 2.1 of the License, or (at your option) any later version.
7086 +
7087 + The GNU C Library is distributed in the hope that it will be useful,
7088 + but WITHOUT ANY WARRANTY; without even the implied warranty of
7089 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7090 + Lesser General Public License for more details.
7091 +
7092 + You should have received a copy of the GNU Lesser General Public
7093 + License along with the GNU C Library; if not, write to the Free
7094 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
7095 + 02111-1307 USA. */
7096 +
7097 +#ifndef _LINUX_X32_SYSDEP_H
7098 +#define _LINUX_X32_SYSDEP_H 1
7099 +
7100 +/* There is some commonality. */
7101 +#include <sysdeps/unix/sysv/linux/x86_64/sysdep.h>
7102 +#include <sysdeps/x86_64/x32/sysdep.h>
7103 +
7104 +#ifdef __ASSEMBLER__
7105 +
7106 +# ifdef SYSCALL_RETURN_INT64
7107 +# define SYSCALL_SET_ERROR_RETURN orq $-1, %rax
7108 +# else
7109 +# define SYSCALL_SET_ERROR_RETURN orl $-1, %eax
7110 +# endif
7111 +
7112 +# ifndef PIC
7113 +/* Nothing here. */
7114 +# elif RTLD_PRIVATE_ERRNO
7115 +# undef SYSCALL_ERROR_HANDLER
7116 +# define SYSCALL_ERROR_HANDLER \
7117 +0: \
7118 + lea rtld_errno(%rip), %ecx; \
7119 + xorl %edx, %edx; \
7120 + subl %eax, %edx; \
7121 + movl %edx, (%rcx); \
7122 + SYSCALL_SET_ERROR_RETURN; \
7123 + jmp L(pseudo_end);
7124 +# elif USE___THREAD
7125 +# undef SYSCALL_ERROR_HANDLER
7126 +# define SYSCALL_ERROR_HANDLER \
7127 +0: \
7128 + movq SYSCALL_ERROR_ERRNO@GOTTPOFF(%rip), %rcx;\
7129 + xorl %edx, %edx; \
7130 + subl %eax, %edx; \
7131 + movl %edx, %fs:(%rcx); \
7132 + SYSCALL_SET_ERROR_RETURN; \
7133 + jmp L(pseudo_end);
7134 +# elif defined _LIBC_REENTRANT
7135 +/* Store (- %eax) into errno through the GOT.
7136 + Note that errno occupies only 4 bytes. */
7137 +# undef SYSCALL_ERROR_HANDLER
7138 +# define SYSCALL_ERROR_HANDLER \
7139 +0: \
7140 + xorl %edx, %edx; \
7141 + subl %eax, %edx; \
7142 + pushq %rdx; \
7143 + cfi_adjust_cfa_offset(8); \
7144 + PUSH_ERRNO_LOCATION_RETURN; \
7145 + call BP_SYM (__errno_location)@PLT; \
7146 + POP_ERRNO_LOCATION_RETURN; \
7147 + popq %rdx; \
7148 + cfi_adjust_cfa_offset(-8); \
7149 + movl %edx, (%rax); \
7150 + SYSCALL_SET_ERROR_RETURN; \
7151 + jmp L(pseudo_end);
7152 +
7153 +/* A quick note: it is assumed that the call to `__errno_location' does
7154 + not modify the stack! */
7155 +# else /* Not _LIBC_REENTRANT. */
7156 +# undef SYSCALL_ERROR_HANDLER
7157 +# define SYSCALL_ERROR_HANDLER \
7158 +0:movq errno@GOTPCREL(%rip), %rcx; \
7159 + xorl %edx, %edx; \
7160 + subl %eax, %edx; \
7161 + movl %edx, (%rcx); \
7162 + SYSCALL_SET_ERROR_RETURN; \
7163 + jmp L(pseudo_end);
7164 +# endif /* PIC */
7165 +
7166 +#endif /* __ASSEMBLER__ */
7167 +
7168 +/* Pointer mangling support. */
7169 +#undef PTR_MANGLE
7170 +#undef PTR_DEMANGLE
7171 +
7172 +#if defined NOT_IN_libc && defined IS_IN_rtld
7173 +/* We cannot use the thread descriptor because in ld.so we use setjmp
7174 + earlier than the descriptor is initialized. */
7175 +# ifdef __ASSEMBLER__
7176 +# define PTR_MANGLE(reg) xorl __pointer_chk_guard_local(%rip), reg; \
7177 + roll $17, reg
7178 +# define PTR_DEMANGLE(reg) rorl $17, reg; \
7179 + xorl __pointer_chk_guard_local(%rip), reg
7180 +# else
7181 +# define PTR_MANGLE(reg) asm ("xorl __pointer_chk_guard_local(%%rip), %0\n" \
7182 + "roll $17, %0" \
7183 + : "=r" (reg) : "0" (reg))
7184 +# define PTR_DEMANGLE(reg) asm ("rorl $17, %0\n" \
7185 + "xorl __pointer_chk_guard_local(%%rip), %0" \
7186 + : "=r" (reg) : "0" (reg))
7187 +# endif
7188 +#else
7189 +# ifdef __ASSEMBLER__
7190 +# define PTR_MANGLE(reg) xorl %fs:POINTER_GUARD, reg; \
7191 + roll $17, reg
7192 +# define PTR_DEMANGLE(reg) rorl $17, reg; \
7193 + xorl %fs:POINTER_GUARD, reg
7194 +# else
7195 +# define PTR_MANGLE(var) asm ("xorl %%fs:%c2, %0\n" \
7196 + "roll $17, %0" \
7197 + : "=r" (var) \
7198 + : "0" (var), \
7199 + "i" (offsetof (tcbhead_t, \
7200 + pointer_guard)))
7201 +# define PTR_DEMANGLE(var) asm ("rorl $17, %0\n" \
7202 + "xorl %%fs:%c2, %0" \
7203 + : "=r" (var) \
7204 + : "0" (var), \
7205 + "i" (offsetof (tcbhead_t, \
7206 + pointer_guard)))
7207 +# endif
7208 +#endif
7209 +
7210 +#endif /* linux/x86_64/x32/sysdep.h */
7211 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/time.c b/sysdeps/unix/sysv/linux/x86_64/x32/time.c
7212 new file mode 100644
7213 index 0000000..b7feb93
7214 --- /dev/null
7215 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/time.c
7216 @@ -0,0 +1,77 @@
7217 +/* Copyright (C) 2011 Free Software Foundation, Inc.
7218 + This file is part of the GNU C Library.
7219 +
7220 + The GNU C Library is free software; you can redistribute it and/or
7221 + modify it under the terms of the GNU Lesser General Public
7222 + License as published by the Free Software Foundation; either
7223 + version 2.1 of the License, or (at your option) any later version.
7224 +
7225 + The GNU C Library is distributed in the hope that it will be useful,
7226 + but WITHOUT ANY WARRANTY; without even the implied warranty of
7227 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7228 + Lesser General Public License for more details.
7229 +
7230 + You should have received a copy of the GNU Lesser General Public
7231 + License along with the GNU C Library; if not, write to the Free
7232 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
7233 + 02111-1307 USA. */
7234 +
7235 +#include <errno.h>
7236 +#include <sysdep.h>
7237 +#include <time.h>
7238 +
7239 +# undef INLINE_SYSCALL
7240 +# define INLINE_SYSCALL(name, nr, args...) \
7241 + ({ \
7242 + unsigned long long int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
7243 + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \
7244 + { \
7245 + __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
7246 + resultvar = (unsigned long long int) -1LL; \
7247 + } \
7248 + (long long int) resultvar; })
7249 +
7250 +# undef INTERNAL_SYSCALL_NCS
7251 +# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
7252 + ({ \
7253 + unsigned long long int resultvar; \
7254 + LOAD_ARGS_##nr (args) \
7255 + LOAD_REGS_##nr \
7256 + asm volatile ( \
7257 + "syscall\n\t" \
7258 + : "=a" (resultvar) \
7259 + : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx"); \
7260 + (long long int) resultvar; })
7261 +
7262 +# undef INTERNAL_SYSCALL_ERROR_P
7263 +# define INTERNAL_SYSCALL_ERROR_P(val, err) \
7264 + ((unsigned long long int) (long long int) (val) >= -4095LL)
7265 +
7266 +#ifdef SHARED
7267 +# include <dl-vdso.h>
7268 +
7269 +void *time_ifunc (void) __asm__ ("__GI_time");
7270 +
7271 +static time_t
7272 +time_syscall (time_t *t)
7273 +{
7274 + return INLINE_SYSCALL (time, 1, t);
7275 +}
7276 +
7277 +void *
7278 +time_ifunc (void)
7279 +{
7280 + PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
7281 +
7282 + return _dl_vdso_vsym ("time", &linux26) ?: (void *) time_syscall;
7283 +}
7284 +__asm (".type __GI_time, %gnu_indirect_function");
7285 +#else
7286 +time_t
7287 +time (time_t *t)
7288 +{
7289 + return INLINE_SYSCALL (time, 1, t);
7290 +}
7291 +#endif
7292 +
7293 +libc_hidden_def (time)
7294 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/tmpfile.c b/sysdeps/unix/sysv/linux/x86_64/x32/tmpfile.c
7295 new file mode 100644
7296 index 0000000..f24f361
7297 --- /dev/null
7298 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/tmpfile.c
7299 @@ -0,0 +1 @@
7300 +#include <sysdeps/wordsize-64/tmpfile.c>
7301 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/tmpfile64.c b/sysdeps/unix/sysv/linux/x86_64/x32/tmpfile64.c
7302 new file mode 100644
7303 index 0000000..55feef2
7304 --- /dev/null
7305 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/tmpfile64.c
7306 @@ -0,0 +1 @@
7307 +#include <sysdeps/wordsize-64/tmpfile64.c>
7308 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/versionsort.c b/sysdeps/unix/sysv/linux/x86_64/x32/versionsort.c
7309 new file mode 100644
7310 index 0000000..af5a668
7311 --- /dev/null
7312 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/versionsort.c
7313 @@ -0,0 +1 @@
7314 +#include <sysdeps/wordsize-64/versionsort.c>
7315 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/versionsort64.c b/sysdeps/unix/sysv/linux/x86_64/x32/versionsort64.c
7316 new file mode 100644
7317 index 0000000..fe220c9
7318 --- /dev/null
7319 +++ b/sysdeps/unix/sysv/linux/x86_64/x32/versionsort64.c
7320 @@ -0,0 +1 @@
7321 +#include <sysdeps/wordsize-64/versionsort64.c>
7322 diff --git a/sysdeps/x86_64/64/Implies b/sysdeps/x86_64/64/Implies
7323 new file mode 100644
7324 index 0000000..8ec4217
7325 --- /dev/null
7326 +++ b/sysdeps/x86_64/64/Implies
7327 @@ -0,0 +1,6 @@
7328 +x86_64/fpu
7329 +wordsize-64
7330 +ieee754/ldbl-96
7331 +ieee754/dbl-64/wordsize-64
7332 +ieee754/dbl-64
7333 +ieee754/flt-32
7334 diff --git a/sysdeps/x86_64/64/bits/wordsize.h b/sysdeps/x86_64/64/bits/wordsize.h
7335 new file mode 100644
7336 index 0000000..cb59cd2
7337 --- /dev/null
7338 +++ b/sysdeps/x86_64/64/bits/wordsize.h
7339 @@ -0,0 +1,7 @@
7340 +/* Determine the wordsize from the preprocessor defines. */
7341 +
7342 +#if defined __LP64__
7343 +# define __WORDSIZE 64
7344 +#else
7345 +# define __WORDSIZE 32
7346 +#endif
7347 diff --git a/sysdeps/x86_64/64/shlib-versions b/sysdeps/x86_64/64/shlib-versions
7348 new file mode 100644
7349 index 0000000..f793bda
7350 --- /dev/null
7351 +++ b/sysdeps/x86_64/64/shlib-versions
7352 @@ -0,0 +1,2 @@
7353 +x86_64-.*-linux.* DEFAULT GLIBC_2.2.5
7354 +x86_64-.*-linux.* ld=ld-linux-x86-64.so.2 GLIBC_2.2.5
7355 diff --git a/sysdeps/x86_64/Implies b/sysdeps/x86_64/Implies
7356 deleted file mode 100644
7357 index 2e0a323..0000000
7358 --- a/sysdeps/x86_64/Implies
7359 +++ /dev/null
7360 @@ -1,5 +0,0 @@
7361 -wordsize-64
7362 -ieee754/ldbl-96
7363 -ieee754/dbl-64/wordsize-64
7364 -ieee754/dbl-64
7365 -ieee754/flt-32
7366 diff --git a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S
7367 index b045c04..fa9e96b 100644
7368 --- a/sysdeps/x86_64/__longjmp.S
7369 +++ b/sysdeps/x86_64/__longjmp.S
7370 @@ -30,9 +30,9 @@ ENTRY(__longjmp)
7371 movq (JB_RBP*8)(%rdi),%r9
7372 movq (JB_PC*8)(%rdi),%rdx
7373 #ifdef PTR_DEMANGLE
7374 - PTR_DEMANGLE (%r8)
7375 - PTR_DEMANGLE (%r9)
7376 - PTR_DEMANGLE (%rdx)
7377 + PTR_DEMANGLE (%R8_LP)
7378 + PTR_DEMANGLE (%R9_LP)
7379 + PTR_DEMANGLE (%RDX_LP)
7380 #endif
7381 /* We add unwind information for the target here. */
7382 cfi_def_cfa(%rdi, 0)
7383 diff --git a/sysdeps/x86_64/bits/atomic.h b/sysdeps/x86_64/bits/atomic.h
7384 index 7c138eb..2ded147 100644
7385 --- a/sysdeps/x86_64/bits/atomic.h
7386 +++ b/sysdeps/x86_64/bits/atomic.h
7387 @@ -87,8 +87,8 @@ typedef uintmax_t uatomic_max_t;
7388 ({ __typeof (*mem) ret; \
7389 __asm __volatile (LOCK_PREFIX "cmpxchgq %q2, %1" \
7390 : "=a" (ret), "=m" (*mem) \
7391 - : "r" ((long int) (newval)), "m" (*mem), \
7392 - "0" ((long int) (oldval))); \
7393 + : "r" ((long long int) (newval)), "m" (*mem), \
7394 + "0" ((long long int) (oldval))); \
7395 ret; })
7396 #endif
7397
7398 @@ -133,8 +133,8 @@ typedef uintmax_t uatomic_max_t;
7399 "lock\n" \
7400 "0:\tcmpxchgq %q2, %1" \
7401 : "=a" (ret), "=m" (*mem) \
7402 - : "q" ((long int) (newval)), "m" (*mem), \
7403 - "0" ((long int)oldval), \
7404 + : "q" ((long long int) (newval)), "m" (*mem), \
7405 + "0" ((long long int) (oldval)), \
7406 "i" (offsetof (tcbhead_t, multiple_threads))); \
7407 ret; })
7408
7409 @@ -157,7 +157,7 @@ typedef uintmax_t uatomic_max_t;
7410 else \
7411 __asm __volatile ("xchgq %q0, %1" \
7412 : "=r" (result), "=m" (*mem) \
7413 - : "0" ((long) (newvalue)), "m" (*mem)); \
7414 + : "0" ((long long) (newvalue)), "m" (*mem)); \
7415 result; })
7416
7417
7418 @@ -181,7 +181,7 @@ typedef uintmax_t uatomic_max_t;
7419 else \
7420 __asm __volatile (lock "xaddq %q0, %1" \
7421 : "=r" (result), "=m" (*mem) \
7422 - : "0" ((long) (value)), "m" (*mem), \
7423 + : "0" ((long long) (value)), "m" (*mem), \
7424 "i" (offsetof (tcbhead_t, multiple_threads))); \
7425 result; })
7426
7427 @@ -224,7 +224,7 @@ typedef uintmax_t uatomic_max_t;
7428 else \
7429 __asm __volatile (lock "addq %q1, %0" \
7430 : "=m" (*mem) \
7431 - : "ir" ((long) (value)), "m" (*mem), \
7432 + : "ir" ((long long) (value)), "m" (*mem), \
7433 "i" (offsetof (tcbhead_t, multiple_threads))); \
7434 } while (0)
7435
7436 @@ -255,7 +255,7 @@ typedef uintmax_t uatomic_max_t;
7437 else \
7438 __asm __volatile (LOCK_PREFIX "addq %q2, %0; sets %1" \
7439 : "=m" (*mem), "=qm" (__result) \
7440 - : "ir" ((long) (value)), "m" (*mem)); \
7441 + : "ir" ((long long) (value)), "m" (*mem)); \
7442 __result; })
7443
7444
7445 @@ -276,7 +276,7 @@ typedef uintmax_t uatomic_max_t;
7446 else \
7447 __asm __volatile (LOCK_PREFIX "addq %q2, %0; setz %1" \
7448 : "=m" (*mem), "=qm" (__result) \
7449 - : "ir" ((long) (value)), "m" (*mem)); \
7450 + : "ir" ((long long) (value)), "m" (*mem)); \
7451 __result; })
7452
7453
7454 diff --git a/sysdeps/x86_64/bits/byteswap.h b/sysdeps/x86_64/bits/byteswap.h
7455 index e350fb8..fa0e863 100644
7456 --- a/sysdeps/x86_64/bits/byteswap.h
7457 +++ b/sysdeps/x86_64/bits/byteswap.h
7458 @@ -25,8 +25,6 @@
7459 #ifndef _BITS_BYTESWAP_H
7460 #define _BITS_BYTESWAP_H 1
7461
7462 -#include <bits/wordsize.h>
7463 -
7464 /* Swap bytes in 16 bit value. */
7465 #define __bswap_constant_16(x) \
7466 ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
7467 @@ -58,12 +56,11 @@
7468 (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
7469
7470 #if defined __GNUC__ && __GNUC__ >= 2
7471 -# if __WORDSIZE == 64 || (defined __i486__ || defined __pentium__ \
7472 - || defined __pentiumpro__ || defined __pentium4__ \
7473 - || defined __k8__ || defined __athlon__ \
7474 - || defined __k6__ || defined __nocona__ \
7475 - || defined __core2__ || defined __geode__ \
7476 - || defined __amdfam10__)
7477 +# if defined __x86_64__ || defined __i486__ || defined __pentium__ \
7478 + || defined __pentiumpro__ || defined __pentium4__ || defined __k8__ \
7479 + || defined __athlon__ || defined __k6__ || defined __nocona__ \
7480 + || defined __core2__ || defined __corei7__ || defined __geode__ \
7481 + || defined __amdfam10__
7482 /* To swap the bytes in a word the i486 processors and up provide the
7483 `bswap' opcode. On i386 we have to use three instructions. */
7484 # define __bswap_32(x) \
7485 @@ -108,10 +105,10 @@
7486 | (((x) & 0x000000000000ff00ull) << 40) \
7487 | (((x) & 0x00000000000000ffull) << 56))
7488
7489 -# if __WORDSIZE == 64
7490 +# ifdef __x86_64__
7491 # define __bswap_64(x) \
7492 (__extension__ \
7493 - ({ register unsigned long __v, __x = (x); \
7494 + ({ register unsigned long long int __v, __x = (x); \
7495 if (__builtin_constant_p (__x)) \
7496 __v = __bswap_constant_64 (__x); \
7497 else \
7498 diff --git a/sysdeps/x86_64/bits/link.h b/sysdeps/x86_64/bits/link.h
7499 index 14cc92b..df32930 100644
7500 --- a/sysdeps/x86_64/bits/link.h
7501 +++ b/sysdeps/x86_64/bits/link.h
7502 @@ -21,7 +21,7 @@
7503 #endif
7504
7505
7506 -#if __ELF_NATIVE_CLASS == 32
7507 +#ifndef __x86_64__
7508 /* Registers for entry into PLT on IA-32. */
7509 typedef struct La_i86_regs
7510 {
7511 @@ -125,6 +125,22 @@ extern unsigned int la_x86_64_gnu_pltexit (Elf64_Sym *__sym,
7512 La_x86_64_retval *__outregs,
7513 const char *__symname);
7514
7515 +extern Elf32_Addr la_x32_gnu_pltenter (Elf32_Sym *__sym,
7516 + unsigned int __ndx,
7517 + uintptr_t *__refcook,
7518 + uintptr_t *__defcook,
7519 + La_x86_64_regs *__regs,
7520 + unsigned int *__flags,
7521 + const char *__symname,
7522 + long int *__framesizep);
7523 +extern unsigned int la_x32_gnu_pltexit (Elf32_Sym *__sym,
7524 + unsigned int __ndx,
7525 + uintptr_t *__refcook,
7526 + uintptr_t *__defcook,
7527 + const La_x86_64_regs *__inregs,
7528 + La_x86_64_retval *__outregs,
7529 + const char *__symname);
7530 +
7531 __END_DECLS
7532
7533 #endif
7534 diff --git a/sysdeps/x86_64/bits/mathdef.h b/sysdeps/x86_64/bits/mathdef.h
7535 index 9146392..9e23501 100644
7536 --- a/sysdeps/x86_64/bits/mathdef.h
7537 +++ b/sysdeps/x86_64/bits/mathdef.h
7538 @@ -1,4 +1,4 @@
7539 -/* Copyright (C) 2001, 2004, 2010 Free Software Foundation, Inc.
7540 +/* Copyright (C) 2001, 2004, 2010, 2011 Free Software Foundation, Inc.
7541 This file is part of the GNU C Library.
7542
7543 The GNU C Library is free software; you can redistribute it and/or
7544 @@ -23,9 +23,7 @@
7545 #if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
7546 # define _MATH_H_MATHDEF 1
7547
7548 -# include <bits/wordsize.h>
7549 -
7550 -# if __WORDSIZE == 64 || (defined __FLT_EVAL_METHOD__ && __FLT_EVAL_METHOD__ == 0)
7551 +# if defined __x86_64__ || (defined __FLT_EVAL_METHOD__ && __FLT_EVAL_METHOD__ == 0)
7552 /* The x86-64 architecture computes values with the precission of the
7553 used type. Similarly for -m32 -mfpmath=sse. */
7554 typedef float float_t; /* `float' expressions are evaluated as `float'. */
7555 diff --git a/sysdeps/x86_64/bits/setjmp.h b/sysdeps/x86_64/bits/setjmp.h
7556 index c9b98b2..72cfd65 100644
7557 --- a/sysdeps/x86_64/bits/setjmp.h
7558 +++ b/sysdeps/x86_64/bits/setjmp.h
7559 @@ -24,12 +24,10 @@
7560 # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
7561 #endif
7562
7563 -#include <bits/wordsize.h>
7564 -
7565 #ifndef _ASM
7566
7567 -# if __WORDSIZE == 64
7568 -typedef long int __jmp_buf[8];
7569 +# if __x86_64__
7570 +typedef long long int __jmp_buf[8];
7571 # else
7572 typedef int __jmp_buf[6];
7573 # endif
7574 diff --git a/sysdeps/x86_64/bits/wordsize.h b/sysdeps/x86_64/bits/wordsize.h
7575 deleted file mode 100644
7576 index a40a0d8..0000000
7577 --- a/sysdeps/x86_64/bits/wordsize.h
7578 +++ /dev/null
7579 @@ -1,8 +0,0 @@
7580 -/* Determine the wordsize from the preprocessor defines. */
7581 -
7582 -#if defined __x86_64__
7583 -# define __WORDSIZE 64
7584 -# define __WORDSIZE_COMPAT32 1
7585 -#else
7586 -# define __WORDSIZE 32
7587 -#endif
7588 diff --git a/sysdeps/x86_64/dl-irel.h b/sysdeps/x86_64/dl-irel.h
7589 index d2d5c06..ac90c94 100644
7590 --- a/sysdeps/x86_64/dl-irel.h
7591 +++ b/sysdeps/x86_64/dl-irel.h
7592 @@ -28,14 +28,14 @@
7593
7594 static inline void
7595 __attribute ((always_inline))
7596 -elf_irela (const Elf64_Rela *reloc)
7597 +elf_irela (const ElfW(Rela) *reloc)
7598 {
7599 - Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
7600 - const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
7601 + ElfW(Addr) *const reloc_addr = (void *) reloc->r_offset;
7602 + const unsigned long int r_type = ELF32_R_TYPE (reloc->r_info);
7603
7604 if (__builtin_expect (r_type == R_X86_64_IRELATIVE, 1))
7605 {
7606 - Elf64_Addr value = ((Elf64_Addr (*) (void)) reloc->r_addend) ();
7607 + ElfW(Addr) value = ((ElfW(Addr) (*) (void)) reloc->r_addend) ();
7608 *reloc_addr = value;
7609 }
7610 else
7611 diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
7612 index f615e95..74a8109 100644
7613 --- a/sysdeps/x86_64/dl-machine.h
7614 +++ b/sysdeps/x86_64/dl-machine.h
7615 @@ -30,7 +30,7 @@
7616
7617 /* Return nonzero iff ELF header is compatible with the running host. */
7618 static inline int __attribute__ ((unused))
7619 -elf_machine_matches_host (const Elf64_Ehdr *ehdr)
7620 +elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
7621 {
7622 return ehdr->e_machine == EM_X86_64;
7623 }
7624 @@ -39,24 +39,24 @@ elf_machine_matches_host (const Elf64_Ehdr *ehdr)
7625 /* Return the link-time address of _DYNAMIC. Conveniently, this is the
7626 first element of the GOT. This must be inlined in a function which
7627 uses global data. */
7628 -static inline Elf64_Addr __attribute__ ((unused))
7629 +static inline ElfW(Addr) __attribute__ ((unused))
7630 elf_machine_dynamic (void)
7631 {
7632 - Elf64_Addr addr;
7633 + ElfW(Addr) addr;
7634
7635 /* This works because we have our GOT address available in the small PIC
7636 model. */
7637 - addr = (Elf64_Addr) &_DYNAMIC;
7638 + addr = (ElfW(Addr)) &_DYNAMIC;
7639
7640 return addr;
7641 }
7642
7643
7644 /* Return the run-time load address of the shared object. */
7645 -static inline Elf64_Addr __attribute__ ((unused))
7646 +static inline ElfW(Addr) __attribute__ ((unused))
7647 elf_machine_load_address (void)
7648 {
7649 - Elf64_Addr addr;
7650 + ElfW(Addr) addr;
7651
7652 /* The easy way is just the same as on x86:
7653 leaq _dl_start, %0
7654 @@ -73,10 +73,10 @@ elf_machine_load_address (void)
7655 load offset which is zero if the binary was loaded at the address
7656 it is prelinked for. */
7657
7658 - asm ("leaq _dl_start(%%rip), %0\n\t"
7659 - "subq 1f(%%rip), %0\n\t"
7660 + asm ("lea _dl_start(%%rip), %0\n\t"
7661 + "sub 1f(%%rip), %0\n\t"
7662 ".section\t.data.rel.ro\n"
7663 - "1:\t.quad _dl_start\n\t"
7664 + "1:\t" ASM_ADDR " _dl_start\n\t"
7665 ".previous\n\t"
7666 : "=r" (addr) : : "cc");
7667
7668 @@ -90,8 +90,8 @@ static inline int __attribute__ ((unused, always_inline))
7669 elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
7670 {
7671 Elf64_Addr *got;
7672 - extern void _dl_runtime_resolve (Elf64_Word) attribute_hidden;
7673 - extern void _dl_runtime_profile (Elf64_Word) attribute_hidden;
7674 + extern void _dl_runtime_resolve (ElfW(Word)) attribute_hidden;
7675 + extern void _dl_runtime_profile (ElfW(Word)) attribute_hidden;
7676
7677 if (l->l_info[DT_JMPREL] && lazy)
7678 {
7679 @@ -106,9 +106,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
7680 if (got[1])
7681 {
7682 l->l_mach.plt = got[1] + l->l_addr;
7683 - l->l_mach.gotplt = (Elf64_Addr) &got[3];
7684 + l->l_mach.gotplt = (ElfW(Addr)) &got[3];
7685 }
7686 - got[1] = (Elf64_Addr) l; /* Identify this shared object. */
7687 + /* Identify this shared object. */
7688 + *(ElfW(Addr) *) (got + 1) = (ElfW(Addr)) l;
7689
7690 /* The got[2] entry contains the address of a function which gets
7691 called to get the address of a so far unresolved function and
7692 @@ -118,7 +119,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
7693 end in this function. */
7694 if (__builtin_expect (profile, 0))
7695 {
7696 - got[2] = (Elf64_Addr) &_dl_runtime_profile;
7697 + *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_profile;
7698
7699 if (GLRO(dl_profile) != NULL
7700 && _dl_name_match_p (GLRO(dl_profile), l))
7701 @@ -129,12 +130,12 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
7702 else
7703 /* This function will get called to fix up the GOT entry indicated by
7704 the offset on the stack, and then jump to the resolved address. */
7705 - got[2] = (Elf64_Addr) &_dl_runtime_resolve;
7706 + *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve;
7707 }
7708
7709 if (l->l_info[ADDRIDX (DT_TLSDESC_GOT)] && lazy)
7710 - *(Elf64_Addr*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_GOT)]) + l->l_addr)
7711 - = (Elf64_Addr) &_dl_tlsdesc_resolve_rela;
7712 + *(ElfW(Addr)*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_GOT)]) + l->l_addr)
7713 + = (ElfW(Addr)) &_dl_tlsdesc_resolve_rela;
7714
7715 return lazy;
7716 }
7717 @@ -213,7 +214,7 @@ _dl_start_user:\n\
7718 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
7719 #define ELF_MACHINE_JMP_SLOT R_X86_64_JUMP_SLOT
7720
7721 -/* The x86-64 never uses Elf64_Rel relocations. */
7722 +/* The x86-64 never uses Elf64_Rel/Elf32_Rel relocations. */
7723 #define ELF_MACHINE_NO_REL 1
7724
7725 /* We define an initialization functions. This is called very early in
7726 @@ -228,19 +229,19 @@ dl_platform_init (void)
7727 GLRO(dl_platform) = NULL;
7728 }
7729
7730 -static inline Elf64_Addr
7731 +static inline ElfW(Addr)
7732 elf_machine_fixup_plt (struct link_map *map, lookup_t t,
7733 - const Elf64_Rela *reloc,
7734 - Elf64_Addr *reloc_addr, Elf64_Addr value)
7735 + const ElfW(Rela) *reloc,
7736 + ElfW(Addr) *reloc_addr, ElfW(Addr) value)
7737 {
7738 return *reloc_addr = value;
7739 }
7740
7741 /* Return the final value of a plt relocation. On x86-64 the
7742 JUMP_SLOT relocation ignores the addend. */
7743 -static inline Elf64_Addr
7744 -elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
7745 - Elf64_Addr value)
7746 +static inline ElfW(Addr)
7747 +elf_machine_plt_value (struct link_map *map, const ElfW(Rela) *reloc,
7748 + ElfW(Addr) value)
7749 {
7750 return value;
7751 }
7752 @@ -259,12 +260,12 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
7753
7754 auto inline void
7755 __attribute__ ((always_inline))
7756 -elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
7757 - const Elf64_Sym *sym, const struct r_found_version *version,
7758 +elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
7759 + const ElfW(Sym) *sym, const struct r_found_version *version,
7760 void *const reloc_addr_arg)
7761 {
7762 - Elf64_Addr *const reloc_addr = reloc_addr_arg;
7763 - const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
7764 + ElfW(Addr) *const reloc_addr = reloc_addr_arg;
7765 + const unsigned long int r_type = ELF32_R_TYPE (reloc->r_info);
7766
7767 # if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
7768 if (__builtin_expect (r_type == R_X86_64_RELATIVE, 0))
7769 @@ -285,22 +286,28 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
7770 }
7771 else
7772 # endif
7773 +# if !defined RTLD_BOOTSTRAP && !defined __LP64__
7774 + if (__builtin_expect (r_type == R_X86_64_RELATIVE64, 0))
7775 + *((Elf64_Addr *) (uintptr_t) reloc_addr)
7776 + = (Elf64_Addr) map->l_addr + reloc->r_addend;
7777 + else
7778 +# endif
7779 if (__builtin_expect (r_type == R_X86_64_NONE, 0))
7780 return;
7781 else
7782 {
7783 # ifndef RTLD_BOOTSTRAP
7784 - const Elf64_Sym *const refsym = sym;
7785 + const ElfW(Sym) *const refsym = sym;
7786 # endif
7787 struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
7788 - Elf64_Addr value = (sym == NULL ? 0
7789 - : (Elf64_Addr) sym_map->l_addr + sym->st_value);
7790 + ElfW(Addr) value = (sym == NULL ? 0
7791 + : (ElfW(Addr)) sym_map->l_addr + sym->st_value);
7792
7793 if (sym != NULL
7794 && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC,
7795 0)
7796 && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1))
7797 - value = ((Elf64_Addr (*) (void)) value) ();
7798 + value = ((ElfW(Addr) (*) (void)) value) ();
7799
7800 # if defined RTLD_BOOTSTRAP && !USE___THREAD
7801 assert (r_type == R_X86_64_GLOB_DAT || r_type == R_X86_64_JUMP_SLOT);
7802 @@ -333,7 +340,13 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
7803 /* During relocation all TLS symbols are defined and used.
7804 Therefore the offset is already correct. */
7805 if (sym != NULL)
7806 +# ifdef __LP64__
7807 *reloc_addr = sym->st_value + reloc->r_addend;
7808 +# else
7809 + *(Elf64_Sxword *) reloc_addr
7810 + = (Elf64_Sxword)
7811 + ((Elf32_Sword) (sym->st_value + reloc->r_addend));
7812 +# endif
7813 # endif
7814 break;
7815 case R_X86_64_TLSDESC:
7816 @@ -383,15 +396,27 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
7817 /* We know the offset of the object the symbol is contained in.
7818 It is a negative value which will be added to the
7819 thread pointer. */
7820 +# ifdef __LP64__
7821 *reloc_addr = (sym->st_value + reloc->r_addend
7822 - sym_map->l_tls_offset);
7823 +# else
7824 + *(Elf64_Sxword *) reloc_addr
7825 + = (Elf64_Sxword)
7826 + ((Elf32_Sword) (sym->st_value + reloc->r_addend
7827 + - sym_map->l_tls_offset));
7828 +# endif
7829 }
7830 break;
7831 # endif
7832
7833 # ifndef RTLD_BOOTSTRAP
7834 case R_X86_64_64:
7835 +# ifdef __LP64__
7836 *reloc_addr = value + reloc->r_addend;
7837 +# else
7838 + *((Elf64_Addr *) (uintptr_t) reloc_addr)
7839 + = (Elf64_Addr) value + reloc->r_addend;
7840 +# endif
7841 break;
7842 case R_X86_64_32:
7843 value += reloc->r_addend;
7844 @@ -417,7 +442,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
7845 # ifndef RESOLVE_CONFLICT_FIND_MAP
7846 /* Not needed for dl-conflict.c. */
7847 case R_X86_64_PC32:
7848 - value += reloc->r_addend - (Elf64_Addr) reloc_addr;
7849 + value += reloc->r_addend - (ElfW(Addr)) reloc_addr;
7850 *(unsigned int *) reloc_addr = value;
7851 if (__builtin_expect (value != (int) value, 0))
7852 {
7853 @@ -445,7 +470,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
7854 # endif
7855 case R_X86_64_IRELATIVE:
7856 value = map->l_addr + reloc->r_addend;
7857 - value = ((Elf64_Addr (*) (void)) value) ();
7858 + value = ((ElfW(Addr) (*) (void)) value) ();
7859 *reloc_addr = value;
7860 break;
7861 default:
7862 @@ -459,21 +484,21 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
7863
7864 auto inline void
7865 __attribute ((always_inline))
7866 -elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
7867 +elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
7868 void *const reloc_addr_arg)
7869 {
7870 - Elf64_Addr *const reloc_addr = reloc_addr_arg;
7871 - assert (ELF64_R_TYPE (reloc->r_info) == R_X86_64_RELATIVE);
7872 + ElfW(Addr) *const reloc_addr = reloc_addr_arg;
7873 + assert (ELF32_R_TYPE (reloc->r_info) == R_X86_64_RELATIVE);
7874 *reloc_addr = l_addr + reloc->r_addend;
7875 }
7876
7877 auto inline void
7878 __attribute ((always_inline))
7879 elf_machine_lazy_rel (struct link_map *map,
7880 - Elf64_Addr l_addr, const Elf64_Rela *reloc)
7881 + ElfW(Addr) l_addr, const ElfW(Rela) *reloc)
7882 {
7883 - Elf64_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
7884 - const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
7885 + ElfW(Addr) *const reloc_addr = (void *) (l_addr + reloc->r_offset);
7886 + const unsigned long int r_type = ELF32_R_TYPE (reloc->r_info);
7887
7888 /* Check for unexpected PLT reloc type. */
7889 if (__builtin_expect (r_type == R_X86_64_JUMP_SLOT, 1))
7890 @@ -483,7 +508,7 @@ elf_machine_lazy_rel (struct link_map *map,
7891 else
7892 *reloc_addr =
7893 map->l_mach.plt
7894 - + (((Elf64_Addr) reloc_addr) - map->l_mach.gotplt) * 2;
7895 + + (((ElfW(Addr)) reloc_addr) - map->l_mach.gotplt) * 2;
7896 }
7897 else if (__builtin_expect (r_type == R_X86_64_TLSDESC, 1))
7898 {
7899 @@ -496,8 +521,8 @@ elf_machine_lazy_rel (struct link_map *map,
7900 }
7901 else if (__builtin_expect (r_type == R_X86_64_IRELATIVE, 0))
7902 {
7903 - Elf64_Addr value = map->l_addr + reloc->r_addend;
7904 - value = ((Elf64_Addr (*) (void)) value) ();
7905 + ElfW(Addr) value = map->l_addr + reloc->r_addend;
7906 + value = ((ElfW(Addr) (*) (void)) value) ();
7907 *reloc_addr = value;
7908 }
7909 else
7910 diff --git a/sysdeps/x86_64/dl-tls.h b/sysdeps/x86_64/dl-tls.h
7911 index c382cd8..5ddaaef 100644
7912 --- a/sysdeps/x86_64/dl-tls.h
7913 +++ b/sysdeps/x86_64/dl-tls.h
7914 @@ -21,8 +21,8 @@
7915 /* Type used for the representation of TLS information in the GOT. */
7916 typedef struct dl_tls_index
7917 {
7918 - unsigned long int ti_module;
7919 - unsigned long int ti_offset;
7920 + unsigned long long int ti_module;
7921 + unsigned long long int ti_offset;
7922 } tls_index;
7923
7924
7925 diff --git a/sysdeps/x86_64/dl-tlsdesc.h b/sysdeps/x86_64/dl-tlsdesc.h
7926 index 9e64aab..dcff33e 100644
7927 --- a/sysdeps/x86_64/dl-tlsdesc.h
7928 +++ b/sysdeps/x86_64/dl-tlsdesc.h
7929 @@ -31,13 +31,19 @@
7930 struct tlsdesc
7931 {
7932 ptrdiff_t (*entry)(struct tlsdesc *on_rax);
7933 +#ifndef __LP64__
7934 + int pad1;
7935 +#endif
7936 void *arg;
7937 +#ifndef __LP64__
7938 + int pad2;
7939 +#endif
7940 };
7941
7942 typedef struct dl_tls_index
7943 {
7944 - unsigned long int ti_module;
7945 - unsigned long int ti_offset;
7946 + unsigned long long int ti_module;
7947 + unsigned long long int ti_offset;
7948 } tls_index;
7949
7950 /* Type used as the argument in a TLS descriptor for a symbol that
7951 diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S
7952 index 258c609..01a41de 100644
7953 --- a/sysdeps/x86_64/dl-trampoline.S
7954 +++ b/sysdeps/x86_64/dl-trampoline.S
7955 @@ -21,6 +21,10 @@
7956 #include <sysdep.h>
7957 #include <link-defines.h>
7958
7959 +#if (RTLD_SAVESPACE_SSE % 32) != 0
7960 +# error "RTLD_SAVESPACE_SSE must be 32byte aligned"
7961 +#endif
7962 +
7963 .text
7964 .globl _dl_runtime_resolve
7965 .type _dl_runtime_resolve, @function
7966 diff --git a/sysdeps/x86_64/dl-trampoline.h b/sysdeps/x86_64/dl-trampoline.h
7967 index 1c39579..483fda2 100644
7968 --- a/sysdeps/x86_64/dl-trampoline.h
7969 +++ b/sysdeps/x86_64/dl-trampoline.h
7970 @@ -45,7 +45,7 @@
7971 movq 48(%rbx), %rdx # Load return address if needed.
7972 movq 40(%rbx), %rsi # Copy args pushed by PLT in register.
7973 movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_index
7974 - leaq 16(%rbx), %r8
7975 + leaq 16(%rbx), %r8 # Address of framesize
7976 call _dl_profile_fixup # Call resolver.
7977
7978 movq %rax, %r11 # Save return value.
7979 @@ -141,8 +141,8 @@
7980
7981 1:
7982 #endif
7983 - movq 16(%rbx), %r10 # Anything in framesize?
7984 - testq %r10, %r10
7985 + mov 16(%rbx), %R10_LP # Anything in framesize?
7986 + test %R10_LP, %R10_LP
7987 jns 3f
7988
7989 /* There's nothing in the frame size, so there
7990 diff --git a/sysdeps/x86_64/elf/start.S b/sysdeps/x86_64/elf/start.S
7991 index 3c2caf9..6c5af7b 100644
7992 --- a/sysdeps/x86_64/elf/start.S
7993 +++ b/sysdeps/x86_64/elf/start.S
7994 @@ -45,15 +45,16 @@
7995 before this code runs.
7996
7997 %rsp The stack contains the arguments and environment:
7998 - 0(%rsp) argc
7999 - 8(%rsp) argv[0]
8000 + 0(%rsp) argc
8001 + LP_SIZE(%rsp) argv[0]
8002 ...
8003 - (8*argc)(%rsp) NULL
8004 - (8*(argc+1))(%rsp) envp[0]
8005 + (LP_SIZE*argc)(%rsp) NULL
8006 + (LP_SIZE*(argc+1))(%rsp) envp[0]
8007 ...
8008 - NULL
8009 + NULL
8010 */
8011
8012 +#include <sysdep.h>
8013 #include "bp-sym.h"
8014
8015 .text
8016 @@ -78,12 +79,17 @@ _start:
8017 rtld_fini: %r9
8018 stack_end: stack. */
8019
8020 - movq %rdx, %r9 /* Address of the shared library termination
8021 + mov %RDX_LP, %R9_LP /* Address of the shared library termination
8022 function. */
8023 +#ifdef __LP64__
8024 popq %rsi /* Pop the argument count. */
8025 - movq %rsp, %rdx /* argv starts just at the current stack top. */
8026 +#else
8027 + mov (%rsp),%esi /* Simulate popping 4byte argument count. */
8028 + addl $4,%esp
8029 +#endif
8030 + mov %RSP_LP, %RDX_LP /* argv starts just at the current stack top. */
8031 /* Align the stack to a 16 byte boundary to follow the ABI. */
8032 - andq $~15, %rsp
8033 + and $~15, %RSP_LP
8034
8035 pushq %rax /* Push garbage because we push 8 more bytes. */
8036
8037 @@ -93,20 +99,20 @@ _start:
8038
8039 #ifdef SHARED
8040 /* Pass address of our own entry points to .fini and .init. */
8041 - movq __libc_csu_fini@GOTPCREL(%rip), %r8
8042 - movq __libc_csu_init@GOTPCREL(%rip), %rcx
8043 + mov __libc_csu_fini@GOTPCREL(%rip), %R8_LP
8044 + mov __libc_csu_init@GOTPCREL(%rip), %RCX_LP
8045
8046 - movq BP_SYM (main)@GOTPCREL(%rip), %rdi
8047 + mov BP_SYM (main)@GOTPCREL(%rip), %RDI_LP
8048
8049 /* Call the user's main function, and exit with its value.
8050 But let the libc call main. */
8051 call BP_SYM (__libc_start_main)@PLT
8052 #else
8053 /* Pass address of our own entry points to .fini and .init. */
8054 - movq $__libc_csu_fini, %r8
8055 - movq $__libc_csu_init, %rcx
8056 + mov $__libc_csu_fini, %R8_LP
8057 + mov $__libc_csu_init, %RCX_LP
8058
8059 - movq $BP_SYM (main), %rdi
8060 + mov $BP_SYM (main), %RDI_LP
8061
8062 /* Call the user's main function, and exit with its value.
8063 But let the libc call main. */
8064 diff --git a/sysdeps/x86_64/ffsll.c b/sysdeps/x86_64/ffsll.c
8065 index 7213c03..f243cf7 100644
8066 --- a/sysdeps/x86_64/ffsll.c
8067 +++ b/sysdeps/x86_64/ffsll.c
8068 @@ -1,7 +1,8 @@
8069 /* ffsll -- find first set bit in a word, counted from least significant end.
8070 For AMD x86-64.
8071 This file is part of the GNU C Library.
8072 - Copyright (C) 1991,92,93,94,97,98,2001 Free Software Foundation, Inc.
8073 + Copyright (C) 1991,92,93,94,97,98,2001,2011
8074 + Free Software Foundation, Inc.
8075 Contributed by Ulrich Drepper <drepper@××××××.com>.
8076
8077 The GNU C Library is free software; you can redistribute it and/or
8078 @@ -37,5 +38,7 @@ ffsll (long long int x)
8079 return cnt + 1;
8080 }
8081
8082 +#ifdef __LP64__
8083 #undef ffsl
8084 weak_alias (ffsll, ffsl)
8085 +#endif
8086 diff --git a/sysdeps/x86_64/fpu/bits/fenv.h b/sysdeps/x86_64/fpu/bits/fenv.h
8087 index 11859f0..9027d40 100644
8088 --- a/sysdeps/x86_64/fpu/bits/fenv.h
8089 +++ b/sysdeps/x86_64/fpu/bits/fenv.h
8090 @@ -20,9 +20,6 @@
8091 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
8092 #endif
8093
8094 -#include <bits/wordsize.h>
8095 -
8096 -
8097 /* Define bits representing the exception. We use the bit positions
8098 of the appropriate bits in the FPU control word. */
8099 enum
8100 @@ -82,7 +79,7 @@ typedef struct
8101 unsigned int __data_offset;
8102 unsigned short int __data_selector;
8103 unsigned short int __unused5;
8104 -#if __WORDSIZE == 64
8105 +#if __x86_64__
8106 unsigned int __mxcsr;
8107 #endif
8108 }
8109 diff --git a/sysdeps/x86_64/fpu/bits/mathinline.h b/sysdeps/x86_64/fpu/bits/mathinline.h
8110 index dc58f67..5a31052 100644
8111 --- a/sysdeps/x86_64/fpu/bits/mathinline.h
8112 +++ b/sysdeps/x86_64/fpu/bits/mathinline.h
8113 @@ -22,8 +22,6 @@
8114 # error "Never use <bits/mathinline.h> directly; include <math.h> instead."
8115 #endif
8116
8117 -#include <bits/wordsize.h>
8118 -
8119 #ifndef __extern_inline
8120 # define __MATH_INLINE __inline
8121 #else
8122 @@ -37,7 +35,7 @@
8123 __MATH_INLINE int
8124 __NTH (__signbitf (float __x))
8125 {
8126 -#if __WORDSIZE == 32
8127 +#ifndef __x86_64__
8128 __extension__ union { float __f; int __i; } __u = { __f: __x };
8129 return __u.__i < 0;
8130 #else
8131 @@ -49,7 +47,7 @@ __NTH (__signbitf (float __x))
8132 __MATH_INLINE int
8133 __NTH (__signbit (double __x))
8134 {
8135 -#if __WORDSIZE == 32
8136 +#ifndef __x86_64__
8137 __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
8138 return __u.__i[1] < 0;
8139 #else
8140 diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
8141 index 4be7536..a85deb4 100644
8142 --- a/sysdeps/x86_64/fpu/math_private.h
8143 +++ b/sysdeps/x86_64/fpu/math_private.h
8144 @@ -25,7 +25,7 @@ while (0)
8145 #undef EXTRACT_WORDS64
8146 #define EXTRACT_WORDS64(i,d) \
8147 do { \
8148 - long int i_; \
8149 + long long int i_; \
8150 asm ("movd %1, %0" : "=rm" (i_) : "x" (d)); \
8151 (i) = i_; \
8152 } while (0)
8153 @@ -34,7 +34,7 @@ do { \
8154 #undef INSERT_WORDS64
8155 #define INSERT_WORDS64(d,i) \
8156 do { \
8157 - long int i_ = i; \
8158 + long long int i_ = i; \
8159 asm ("movd %1, %0" : "=x" (d) : "rm" (i_)); \
8160 } while (0)
8161
8162 diff --git a/sysdeps/x86_64/jmpbuf-unwind.h b/sysdeps/x86_64/jmpbuf-unwind.h
8163 index 299a4a8..ce31ea5 100644
8164 --- a/sysdeps/x86_64/jmpbuf-unwind.h
8165 +++ b/sysdeps/x86_64/jmpbuf-unwind.h
8166 @@ -29,7 +29,9 @@
8167 ((void *) (address) < (void *) demangle ((jmpbuf)[JB_RSP]))
8168
8169 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
8170 - _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
8171 + _JMPBUF_UNWINDS_ADJ (_jmpbuf, \
8172 + (void *) (_Unwind_Ptr) _Unwind_GetCFA (_context), \
8173 + _adj)
8174
8175 static inline uintptr_t __attribute__ ((unused))
8176 _jmpbuf_sp (__jmp_buf regs)
8177 diff --git a/sysdeps/x86_64/lib-names.awk b/sysdeps/x86_64/lib-names.awk
8178 new file mode 100644
8179 index 0000000..e402c6e
8180 --- /dev/null
8181 +++ b/sysdeps/x86_64/lib-names.awk
8182 @@ -0,0 +1,114 @@
8183 +# awk script for soversions.i -> gnu/lib-names.h; see Makeconfig.
8184 +
8185 +$1 != "DEFAULT" { multi = 1 }
8186 +
8187 +#
8188 +{
8189 + lib = $2;
8190 + version = $3;
8191 + if ($3 !~ /^[0-9]/) {
8192 + soname = $3;
8193 + extra = $3;
8194 + sub(/\.so.*$/, "", extra);
8195 + }
8196 + else {
8197 + soname = lib ".so." $3;
8198 + extra = "";
8199 + }
8200 + soname = "\"" soname "\"";
8201 + lib = toupper(lib);
8202 + extra = toupper(extra);
8203 + gsub(/-/, "_", lib);
8204 + gsub(/-/, "_", extra);
8205 + if (extra) {
8206 + if (extra == "LD_LINUX_X32") {
8207 + x32_macros[$1 FS lib "_SO"] = soname;
8208 + x32_macros[$1 FS extra "_SO"] = soname;
8209 + x86_64_macros[$1 FS lib "_SO"] = "\"ld-linux-x86-64.so.2\"";
8210 + x86_64_macros[$1 FS "LD_LINUX_X86_64_SO"] = "\"ld-linux-x86-64.so.2\"";
8211 + }
8212 + else if (extra == "LD_LINUX_X86_64") {
8213 + x86_64_macros[$1 FS lib "_SO"] = soname;
8214 + x86_64_macros[$1 FS extra "_SO"] = soname;
8215 + x32_macros[$1 FS lib "_SO"] = "\"ld-linux-x32.so.2\"";
8216 + x32_macros[$1 FS "LD_LINUX_X32_SO"] = "\"ld-linux-x32.so.2\"";
8217 + }
8218 + else {
8219 + macros[$1 FS lib "_SO"] = soname;
8220 + macros[$1 FS extra "_SO"] = soname;
8221 + }
8222 + }
8223 + else {
8224 + macros[$1 FS lib "_SO"] = soname;
8225 + }
8226 +}
8227 +
8228 +END {
8229 + print "/* This file is automatically generated.";
8230 + print " It defines macros to allow user program to find the shared";
8231 + print " library files which come as part of GNU libc. */";
8232 + print "#ifndef __GNU_LIB_NAMES_H";
8233 + print "#define __GNU_LIB_NAMES_H 1";
8234 + print "";
8235 +
8236 + pfx = multi ? "# define " : "#define ";
8237 + for (elt in macros) {
8238 + split(elt, x);
8239 + line = sprintf("%-40s%s", pfx x[2], macros[elt]);
8240 + if (x[1] in lines)
8241 + lines[x[1]] = lines[x[1]] "\n" line;
8242 + else
8243 + lines[x[1]] = line;
8244 + }
8245 +
8246 + if (multi) {
8247 + # Print these in a fixed order so the result is identical
8248 + # on both sides of the coin.
8249 + pfx = "# define ";
8250 + for (elt in x32_macros) {
8251 + split(elt, x);
8252 + line = sprintf("%-40s%s", pfx x[2], x32_macros[elt]);
8253 + if (x[1] in x32_lines)
8254 + x32_lines[x[1]] = x32_lines[x[1]] "\n" line;
8255 + else
8256 + x32_lines[x[1]] = line;
8257 + }
8258 + for (elt in x86_64_macros) {
8259 + split(elt, x);
8260 + line = sprintf("%-40s%s", pfx x[2], x86_64_macros[elt]);
8261 + if (x[1] in x86_64_lines)
8262 + x86_64_lines[x[1]] = x86_64_lines[x[1]] "\n" line;
8263 + else
8264 + x86_64_lines[x[1]] = line;
8265 + }
8266 + if (!("WORDSIZE32" in lines))
8267 + lines["WORDSIZE32"] = lines["DEFAULT"];
8268 + if (!("WORDSIZE64" in lines))
8269 + lines["WORDSIZE64"] = lines["DEFAULT"];
8270 + if (!("WORDSIZE32" in x32_lines))
8271 + x32_lines["WORDSIZE32"] = x32_lines["DEFAULT"];
8272 + if (!("WORDSIZE64" in x32_lines))
8273 + x32_lines["WORDSIZE64"] = x32_lines["DEFAULT"];
8274 + if (!("WORDSIZE32" in x86_64_lines))
8275 + x86_64_lines["WORDSIZE32"] = x86_64_lines["DEFAULT"];
8276 + if (!("WORDSIZE64" in x86_64_lines))
8277 + x86_64_lines["WORDSIZE64"] = x86_64_lines["DEFAULT"];
8278 + print "#include <bits/wordsize.h>\n";
8279 + print "#ifndef __x86_64__";
8280 + cmd = "LC_ALL=C sort"; print lines["WORDSIZE32"] | cmd; close(cmd);
8281 + print "#else"
8282 + print "# if __WORDSIZE == 32"
8283 + cmd = "LC_ALL=C sort"; print x32_lines["WORDSIZE64"] | cmd; close(cmd);
8284 + print "# else"
8285 + cmd = "LC_ALL=C sort"; print x86_64_lines["WORDSIZE64"] | cmd; close(cmd);
8286 + print "# endif"
8287 + cmd = "LC_ALL=C sort"; print lines["WORDSIZE64"] | cmd; close(cmd);
8288 + print "#endif";
8289 + }
8290 + else {
8291 + cmd = "LC_ALL=C sort"; print lines["DEFAULT"] | cmd; close(cmd);
8292 + }
8293 +
8294 + print "";
8295 + print "#endif /* gnu/lib-names.h */"
8296 +}
8297 diff --git a/sysdeps/x86_64/memcpy.S b/sysdeps/x86_64/memcpy.S
8298 index 724d44e..5511e04 100644
8299 --- a/sysdeps/x86_64/memcpy.S
8300 +++ b/sysdeps/x86_64/memcpy.S
8301 @@ -255,7 +255,7 @@ L(32after):
8302
8303 L(fasttry): /* first 1/2 L1 */
8304 #ifndef NOT_IN_libc /* only up to this algorithm outside of libc.so */
8305 - movq __x86_64_data_cache_size_half(%rip), %r11
8306 + mov __x86_64_data_cache_size_half(%rip), %R11_LP
8307 cmpq %rdx, %r11 /* calculate the smaller of */
8308 cmovaq %rdx, %r11 /* remaining bytes and 1/2 L1 */
8309 #endif
8310 @@ -304,7 +304,7 @@ L(fastafter):
8311 /* Handle large blocks smaller than 1/2 L2. */
8312
8313 L(pretry): /* first 1/2 L2 */
8314 - movq __x86_64_shared_cache_size_half (%rip), %r8
8315 + mov __x86_64_shared_cache_size_half (%rip), %R8_LP
8316 cmpq %rdx, %r8 /* calculate the lesser of */
8317 cmovaq %rdx, %r8 /* remaining bytes and 1/2 L2 */
8318
8319 diff --git a/sysdeps/x86_64/multiarch/memcmp-sse4.S b/sysdeps/x86_64/multiarch/memcmp-sse4.S
8320 index fc439bb..1b951d6 100644
8321 --- a/sysdeps/x86_64/multiarch/memcmp-sse4.S
8322 +++ b/sysdeps/x86_64/multiarch/memcmp-sse4.S
8323 @@ -309,9 +309,9 @@ L(less32bytesin256):
8324 ALIGN (4)
8325 L(512bytesormore):
8326 #ifdef DATA_CACHE_SIZE_HALF
8327 - mov $DATA_CACHE_SIZE_HALF, %r8
8328 + mov $DATA_CACHE_SIZE_HALF, %R8_LP
8329 #else
8330 - mov __x86_64_data_cache_size_half(%rip), %r8
8331 + mov __x86_64_data_cache_size_half(%rip), %R8_LP
8332 #endif
8333 mov %r8, %r9
8334 shr $1, %r8
8335 @@ -625,9 +625,9 @@ L(less32bytesin256in2alinged):
8336 ALIGN (4)
8337 L(512bytesormorein2aligned):
8338 #ifdef DATA_CACHE_SIZE_HALF
8339 - mov $DATA_CACHE_SIZE_HALF, %r8
8340 + mov $DATA_CACHE_SIZE_HALF, %R8_LP
8341 #else
8342 - mov __x86_64_data_cache_size_half(%rip), %r8
8343 + mov __x86_64_data_cache_size_half(%rip), %R8_LP
8344 #endif
8345 mov %r8, %r9
8346 shr $1, %r8
8347 diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
8348 index bdd114a..a4b1fe4 100644
8349 --- a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
8350 +++ b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
8351 @@ -107,9 +107,9 @@ L(144bytesormore):
8352 and $0xf, %r9
8353 jz L(shl_0)
8354 #ifdef DATA_CACHE_SIZE
8355 - mov $DATA_CACHE_SIZE, %rcx
8356 + mov $DATA_CACHE_SIZE, %RCX_LP
8357 #else
8358 - mov __x86_64_data_cache_size(%rip), %rcx
8359 + mov __x86_64_data_cache_size(%rip), %RCX_LP
8360 #endif
8361 cmp %rcx, %rdx
8362 jae L(gobble_mem_fwd)
8363 @@ -123,9 +123,9 @@ L(144bytesormore):
8364 ALIGN (4)
8365 L(copy_backward):
8366 #ifdef DATA_CACHE_SIZE
8367 - mov $DATA_CACHE_SIZE, %rcx
8368 + mov $DATA_CACHE_SIZE, %RCX_LP
8369 #else
8370 - mov __x86_64_data_cache_size(%rip), %rcx
8371 + mov __x86_64_data_cache_size(%rip), %RCX_LP
8372 #endif
8373 shl $1, %rcx
8374 cmp %rcx, %rdx
8375 @@ -157,9 +157,9 @@ L(shl_0):
8376 shr $8, %r9
8377 add %rdx, %r9
8378 #ifdef DATA_CACHE_SIZE
8379 - cmp $DATA_CACHE_SIZE_HALF, %r9
8380 + cmp $DATA_CACHE_SIZE_HALF, %R9_LP
8381 #else
8382 - cmp __x86_64_data_cache_size_half(%rip), %r9
8383 + cmp __x86_64_data_cache_size_half(%rip), %R9_LP
8384 #endif
8385 jae L(gobble_mem_fwd)
8386 sub $0x80, %rdx
8387 @@ -1479,9 +1479,9 @@ L(gobble_mem_fwd):
8388 add $16, %rdi
8389
8390 #ifdef SHARED_CACHE_SIZE_HALF
8391 - mov $SHARED_CACHE_SIZE_HALF, %rcx
8392 + mov $SHARED_CACHE_SIZE_HALF, %RCX_LP
8393 #else
8394 - mov __x86_64_shared_cache_size_half(%rip), %rcx
8395 + mov __x86_64_shared_cache_size_half(%rip), %RCX_LP
8396 #endif
8397 #ifdef USE_AS_MEMMOVE
8398 mov %rsi, %r9
8399 @@ -1586,9 +1586,9 @@ L(gobble_mem_bwd):
8400
8401
8402 #ifdef SHARED_CACHE_SIZE_HALF
8403 - mov $SHARED_CACHE_SIZE_HALF, %rcx
8404 + mov $SHARED_CACHE_SIZE_HALF, %RCX_LP
8405 #else
8406 - mov __x86_64_shared_cache_size_half(%rip), %rcx
8407 + mov __x86_64_shared_cache_size_half(%rip), %RCX_LP
8408 #endif
8409 #ifdef USE_AS_MEMMOVE
8410 mov %rdi, %r9
8411 diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3.S b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
8412 index cd7e45f..0c5a82b 100644
8413 --- a/sysdeps/x86_64/multiarch/memcpy-ssse3.S
8414 +++ b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
8415 @@ -98,9 +98,9 @@ L(80bytesormore):
8416 sub %rcx, %rsi
8417
8418 #ifdef SHARED_CACHE_SIZE_HALF
8419 - mov $SHARED_CACHE_SIZE_HALF, %rcx
8420 + mov $SHARED_CACHE_SIZE_HALF, %RCX_LP
8421 #else
8422 - mov __x86_64_shared_cache_size_half(%rip), %rcx
8423 + mov __x86_64_shared_cache_size_half(%rip), %RCX_LP
8424 #endif
8425 cmp %rcx, %rdx
8426 mov %rsi, %r9
8427 @@ -108,9 +108,9 @@ L(80bytesormore):
8428 and $0xf, %r9
8429 jz L(shl_0)
8430 #ifdef DATA_CACHE_SIZE_HALF
8431 - mov $DATA_CACHE_SIZE_HALF, %rcx
8432 + mov $DATA_CACHE_SIZE_HALF, %RCX_LP
8433 #else
8434 - mov __x86_64_data_cache_size_half(%rip), %rcx
8435 + mov __x86_64_data_cache_size_half(%rip), %RCX_LP
8436 #endif
8437 BRANCH_TO_JMPTBL_ENTRY (L(shl_table), %r9, 4)
8438
8439 @@ -128,9 +128,9 @@ L(copy_backward):
8440 sub %rcx, %rsi
8441
8442 #ifdef SHARED_CACHE_SIZE_HALF
8443 - mov $SHARED_CACHE_SIZE_HALF, %rcx
8444 + mov $SHARED_CACHE_SIZE_HALF, %RCX_LP
8445 #else
8446 - mov __x86_64_shared_cache_size_half(%rip), %rcx
8447 + mov __x86_64_shared_cache_size_half(%rip), %RCX_LP
8448 #endif
8449
8450 cmp %rcx, %rdx
8451 @@ -139,9 +139,9 @@ L(copy_backward):
8452 and $0xf, %r9
8453 jz L(shl_0_bwd)
8454 #ifdef DATA_CACHE_SIZE_HALF
8455 - mov $DATA_CACHE_SIZE_HALF, %rcx
8456 + mov $DATA_CACHE_SIZE_HALF, %RCX_LP
8457 #else
8458 - mov __x86_64_data_cache_size_half(%rip), %rcx
8459 + mov __x86_64_data_cache_size_half(%rip), %RCX_LP
8460 #endif
8461 BRANCH_TO_JMPTBL_ENTRY (L(shl_table_bwd), %r9, 4)
8462
8463 @@ -176,9 +176,9 @@ L(shl_0_less_64bytes):
8464 ALIGN (4)
8465 L(shl_0_gobble):
8466 #ifdef DATA_CACHE_SIZE_HALF
8467 - cmp $DATA_CACHE_SIZE_HALF, %rdx
8468 + cmp $DATA_CACHE_SIZE_HALF, %RDX_LP
8469 #else
8470 - cmp __x86_64_data_cache_size_half(%rip), %rdx
8471 + cmp __x86_64_data_cache_size_half(%rip), %RDX_LP
8472 #endif
8473 lea -128(%rdx), %rdx
8474 jae L(shl_0_gobble_mem_loop)
8475 @@ -317,9 +317,9 @@ L(shl_0_less_64bytes_bwd):
8476 ALIGN (4)
8477 L(shl_0_gobble_bwd):
8478 #ifdef DATA_CACHE_SIZE_HALF
8479 - cmp $DATA_CACHE_SIZE_HALF, %rdx
8480 + cmp $DATA_CACHE_SIZE_HALF, %RDX_LP
8481 #else
8482 - cmp __x86_64_data_cache_size_half(%rip), %rdx
8483 + cmp __x86_64_data_cache_size_half(%rip), %RDX_LP
8484 #endif
8485 lea -128(%rdx), %rdx
8486 jae L(shl_0_gobble_mem_bwd_loop)
8487 diff --git a/sysdeps/x86_64/multiarch/strcmp.S b/sysdeps/x86_64/multiarch/strcmp.S
8488 index 8879855..9049b07 100644
8489 --- a/sysdeps/x86_64/multiarch/strcmp.S
8490 +++ b/sysdeps/x86_64/multiarch/strcmp.S
8491 @@ -170,7 +170,7 @@ weak_alias (__strncasecmp, strncasecmp)
8492 # ifdef USE_AS_STRCASECMP_L
8493 ENTRY (__strcasecmp_sse42)
8494 movq __libc_tsd_LOCALE@gottpoff(%rip),%rax
8495 - movq %fs:(%rax),%rdx
8496 + mov %fs:(%rax),%RDX_LP
8497
8498 // XXX 5 byte should be before the function
8499 /* 5-byte NOP. */
8500 @@ -181,7 +181,7 @@ END (__strcasecmp_sse42)
8501 # ifdef USE_AS_STRNCASECMP_L
8502 ENTRY (__strncasecmp_sse42)
8503 movq __libc_tsd_LOCALE@gottpoff(%rip),%rax
8504 - movq %fs:(%rax),%rcx
8505 + mov %fs:(%rax),%RCX_LP
8506
8507 // XXX 5 byte should be before the function
8508 /* 5-byte NOP. */
8509 @@ -201,9 +201,9 @@ STRCMP_SSE42:
8510 /* We have to fall back on the C implementation for locales
8511 with encodings not matching ASCII for single bytes. */
8512 # if LOCALE_T___LOCALES != 0 || LC_CTYPE != 0
8513 - movq LOCALE_T___LOCALES+LC_CTYPE*8(%rdx), %rax
8514 + mov LOCALE_T___LOCALES+LC_CTYPE*LP_SIZE(%rdx), %RAX_LP
8515 # else
8516 - movq (%rdx), %rax
8517 + mov (%rdx), %RAX_LP
8518 # endif
8519 testl $0, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
8520 jne __strcasecmp_l_nonascii
8521 @@ -212,9 +212,9 @@ STRCMP_SSE42:
8522 /* We have to fall back on the C implementation for locales
8523 with encodings not matching ASCII for single bytes. */
8524 # if LOCALE_T___LOCALES != 0 || LC_CTYPE != 0
8525 - movq LOCALE_T___LOCALES+LC_CTYPE*8(%rcx), %rax
8526 + mov LOCALE_T___LOCALES+LC_CTYPE*LP_SIZE(%rcx), %RAX_LP
8527 # else
8528 - movq (%rcx), %rax
8529 + mov (%rcx), %RAX_LP
8530 # endif
8531 testl $0, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
8532 jne __strncasecmp_l_nonascii
8533 diff --git a/sysdeps/x86_64/preconfigure b/sysdeps/x86_64/preconfigure
8534 new file mode 100644
8535 index 0000000..c54eeab
8536 --- /dev/null
8537 +++ b/sysdeps/x86_64/preconfigure
8538 @@ -0,0 +1,18 @@
8539 +case "$base_machine" in
8540 +x86_64)
8541 + stubs_biarch_h=sysdeps/x86_64/stubs-biarch.h
8542 + lib_names_awk=sysdeps/x86_64/lib-names.awk
8543 + use_default_syscall_macros=no
8544 + if echo __LP64__ | ${CC-cc} $CFLAGS $CPPFLAGS -E - | grep __LP64__ > /dev/null; then
8545 + machine=x86_64/x32
8546 + data_machine=x32
8547 + libc_cv_slibdir="/libx32"
8548 + if test "$libdir" = '${exec_prefix}/lib'; then
8549 + libdir='${exec_prefix}/libx32';
8550 + # Locale data can be shared.
8551 + libc_cv_localedir='${exec_prefix}/lib/locale'
8552 + fi
8553 + else
8554 + machine=x86_64/64
8555 + fi
8556 +esac
8557 diff --git a/sysdeps/x86_64/setjmp.S b/sysdeps/x86_64/setjmp.S
8558 index a66b0e6..68340f1 100644
8559 --- a/sysdeps/x86_64/setjmp.S
8560 +++ b/sysdeps/x86_64/setjmp.S
8561 @@ -26,7 +26,7 @@ ENTRY (__sigsetjmp)
8562 movq %rbx, (JB_RBX*8)(%rdi)
8563 #ifdef PTR_MANGLE
8564 movq %rbp, %rax
8565 - PTR_MANGLE (%rax)
8566 + PTR_MANGLE (%RAX_LP)
8567 movq %rax, (JB_RBP*8)(%rdi)
8568 #else
8569 movq %rbp, (JB_RBP*8)(%rdi)
8570 @@ -37,12 +37,12 @@ ENTRY (__sigsetjmp)
8571 movq %r15, (JB_R15*8)(%rdi)
8572 leaq 8(%rsp), %rdx /* Save SP as it will be after we return. */
8573 #ifdef PTR_MANGLE
8574 - PTR_MANGLE (%rdx)
8575 + PTR_MANGLE (%RDX_LP)
8576 #endif
8577 movq %rdx, (JB_RSP*8)(%rdi)
8578 movq (%rsp), %rax /* Save PC we are returning to now. */
8579 #ifdef PTR_MANGLE
8580 - PTR_MANGLE (%rax)
8581 + PTR_MANGLE (%RAX_LP)
8582 #endif
8583 movq %rax, (JB_PC*8)(%rdi)
8584
8585 diff --git a/sysdeps/x86_64/stackinfo.h b/sysdeps/x86_64/stackinfo.h
8586 index d4fc25f..179e421 100644
8587 --- a/sysdeps/x86_64/stackinfo.h
8588 +++ b/sysdeps/x86_64/stackinfo.h
8589 @@ -35,10 +35,10 @@
8590 for which they need to act as barriers as well, hence the additional
8591 (unnecessary) parameters. */
8592 #define stackinfo_get_sp() \
8593 - ({ void *p__; asm volatile ("mov %%rsp, %0" : "=r" (p__)); p__; })
8594 + ({ void *p__; asm volatile ("mov %%" RSP_LP ", %0" : "=r" (p__)); p__; })
8595 #define stackinfo_sub_sp(ptr) \
8596 ({ ptrdiff_t d__; \
8597 - asm volatile ("sub %%rsp, %0" : "=r" (d__) : "0" (ptr)); \
8598 + asm volatile ("sub %%" RSP_LP " , %0" : "=r" (d__) : "0" (ptr)); \
8599 d__; })
8600
8601 #endif /* stackinfo.h */
8602 diff --git a/sysdeps/x86_64/strcmp.S b/sysdeps/x86_64/strcmp.S
8603 index 165073e..9849fb6 100644
8604 --- a/sysdeps/x86_64/strcmp.S
8605 +++ b/sysdeps/x86_64/strcmp.S
8606 @@ -97,7 +97,7 @@
8607
8608 ENTRY2 (__strcasecmp)
8609 movq __libc_tsd_LOCALE@gottpoff(%rip),%rax
8610 - movq %fs:(%rax),%rdx
8611 + mov %fs:(%rax),%RDX_LP
8612
8613 // XXX 5 byte should be before the function
8614 /* 5-byte NOP. */
8615 @@ -116,7 +116,7 @@ libc_hidden_def (__strcasecmp)
8616
8617 ENTRY2 (__strncasecmp)
8618 movq __libc_tsd_LOCALE@gottpoff(%rip),%rax
8619 - movq %fs:(%rax),%rcx
8620 + mov %fs:(%rax),%RCX_LP
8621
8622 // XXX 5 byte should be before the function
8623 /* 5-byte NOP. */
8624 @@ -153,9 +153,9 @@ END (BP_SYM (STRCMP))
8625 /* We have to fall back on the C implementation for locales
8626 with encodings not matching ASCII for single bytes. */
8627 # if LOCALE_T___LOCALES != 0 || LC_CTYPE != 0
8628 - movq LOCALE_T___LOCALES+LC_CTYPE*8(%rdx), %rax
8629 + mov LOCALE_T___LOCALES+LC_CTYPE*LP_SIZE(%rdx), %RAX_LP
8630 # else
8631 - movq (%rdx), %rax
8632 + mov (%rdx), %RAX_LP
8633 # endif
8634 testl $0, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
8635 jne __strcasecmp_l_nonascii
8636 @@ -163,9 +163,9 @@ END (BP_SYM (STRCMP))
8637 /* We have to fall back on the C implementation for locales
8638 with encodings not matching ASCII for single bytes. */
8639 # if LOCALE_T___LOCALES != 0 || LC_CTYPE != 0
8640 - movq LOCALE_T___LOCALES+LC_CTYPE*8(%rcx), %rax
8641 + mov LOCALE_T___LOCALES+LC_CTYPE*LP_SIZE(%rcx), %RAX_LP
8642 # else
8643 - movq (%rcx), %rax
8644 + mov (%rcx), %RAX_LP
8645 # endif
8646 testl $0, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
8647 jne __strncasecmp_l_nonascii
8648 diff --git a/sysdeps/x86_64/stubs-biarch.h b/sysdeps/x86_64/stubs-biarch.h
8649 new file mode 100644
8650 index 0000000..2579ec6
8651 --- /dev/null
8652 +++ b/sysdeps/x86_64/stubs-biarch.h
8653 @@ -0,0 +1,8 @@
8654 +/* This file selects the right generated file of `__stub_FUNCTION' macros
8655 + based on the architecture being compiled for. */
8656 +
8657 +#ifdef __x86_64__
8658 +# include <gnu/stubs-64.h>
8659 +#else
8660 +# include <gnu/stubs-32.h>
8661 +#endif
8662 diff --git a/sysdeps/x86_64/sysdep.h b/sysdeps/x86_64/sysdep.h
8663 index 1d35f8f..d02ad9a 100644
8664 --- a/sysdeps/x86_64/sysdep.h
8665 +++ b/sysdeps/x86_64/sysdep.h
8666 @@ -114,4 +114,66 @@ lose: \
8667 # endif
8668 #endif
8669
8670 +/* Long and pointer size in bytes. */
8671 +#define LP_SIZE 8
8672 +
8673 +/* Instruction to move long and pointer. */
8674 +#define MOVE_LP movq
8675 +
8676 +/* Instruction to add long and pointer. */
8677 +#define ADD_LP addq
8678 +
8679 +/* Instruction to substract long and pointer. */
8680 +#define SUB_LP subq
8681 +
8682 +/* Instruction to compare against long and pointer. */
8683 +#define CMP_LP cmpq
8684 +
8685 +/* Assembler address directive. */
8686 +#define ASM_ADDR .quad
8687 +
8688 +/* Registers to hold long and pointer. */
8689 +#define RAX_LP rax
8690 +#define RBP_LP rbp
8691 +#define RBX_LP rbx
8692 +#define RCX_LP rcx
8693 +#define RDI_LP rdi
8694 +#define RDX_LP rdx
8695 +#define RSI_LP rsi
8696 +#define RSP_LP rsp
8697 +#define R8_LP r8
8698 +#define R9_LP r9
8699 +#define R10_LP r10
8700 +#define R11_LP r11
8701 +#define R12_LP r12
8702 +#define R13_LP r13
8703 +#define R14_LP r14
8704 +#define R15_LP r15
8705 +
8706 +#else /* __ASSEMBLER__ */
8707 +
8708 +/* Long and pointer size in bytes. */
8709 +#define LP_SIZE "8"
8710 +
8711 +/* Assembler address directive. */
8712 +#define ASM_ADDR ".quad"
8713 +
8714 +/* Registers to hold long and pointer. */
8715 +#define RAX_LP "rax"
8716 +#define RBP_LP "rbp"
8717 +#define RBX_LP "rbx"
8718 +#define RCX_LP "rcx"
8719 +#define RDI_LP "rdi"
8720 +#define RDX_LP "rdx"
8721 +#define RSI_LP "rsi"
8722 +#define RSP_LP "rsp"
8723 +#define R8_LP "r8"
8724 +#define R9_LP "r9"
8725 +#define R10_LP "r10"
8726 +#define R11_LP "r11"
8727 +#define R12_LP "r12"
8728 +#define R13_LP "r13"
8729 +#define R14_LP "r14"
8730 +#define R15_LP "r15"
8731 +
8732 #endif /* __ASSEMBLER__ */
8733 diff --git a/sysdeps/x86_64/x32/Implies b/sysdeps/x86_64/x32/Implies
8734 new file mode 100644
8735 index 0000000..6d48462
8736 --- /dev/null
8737 +++ b/sysdeps/x86_64/x32/Implies
8738 @@ -0,0 +1,6 @@
8739 +x86_64/fpu
8740 +wordsize-32
8741 +ieee754/ldbl-96
8742 +ieee754/dbl-64/wordsize-64
8743 +ieee754/dbl-64
8744 +ieee754/flt-32
8745 diff --git a/sysdeps/x86_64/x32/Makefile b/sysdeps/x86_64/x32/Makefile
8746 new file mode 100644
8747 index 0000000..5b3ac54
8748 --- /dev/null
8749 +++ b/sysdeps/x86_64/x32/Makefile
8750 @@ -0,0 +1,3 @@
8751 +ifeq ($(subdir),malloc)
8752 +CFLAGS-malloc.c += -DMALLOC_ALIGNMENT=16
8753 +endif
8754 diff --git a/sysdeps/x86_64/x32/bits/wordsize.h b/sysdeps/x86_64/x32/bits/wordsize.h
8755 new file mode 100644
8756 index 0000000..cb59cd2
8757 --- /dev/null
8758 +++ b/sysdeps/x86_64/x32/bits/wordsize.h
8759 @@ -0,0 +1,7 @@
8760 +/* Determine the wordsize from the preprocessor defines. */
8761 +
8762 +#if defined __LP64__
8763 +# define __WORDSIZE 64
8764 +#else
8765 +# define __WORDSIZE 32
8766 +#endif
8767 diff --git a/sysdeps/x86_64/x32/divdi3.c b/sysdeps/x86_64/x32/divdi3.c
8768 new file mode 100644
8769 index 0000000..bc7b4c4
8770 --- /dev/null
8771 +++ b/sysdeps/x86_64/x32/divdi3.c
8772 @@ -0,0 +1 @@
8773 +/* Fortunately nothing to do. */
8774 diff --git a/sysdeps/x86_64/x32/dl-machine.h b/sysdeps/x86_64/x32/dl-machine.h
8775 new file mode 100644
8776 index 0000000..2364910
8777 --- /dev/null
8778 +++ b/sysdeps/x86_64/x32/dl-machine.h
8779 @@ -0,0 +1,86 @@
8780 +/* Machine-dependent ELF dynamic relocation inline functions. x32 version.
8781 + Copyright (C) 2011 Free Software Foundation, Inc.
8782 + This file is part of the GNU C Library.
8783 +
8784 + The GNU C Library is free software; you can redistribute it and/or
8785 + modify it under the terms of the GNU Lesser General Public
8786 + License as published by the Free Software Foundation; either
8787 + version 2.1 of the License, or (at your option) any later version.
8788 +
8789 + The GNU C Library is distributed in the hope that it will be useful,
8790 + but WITHOUT ANY WARRANTY; without even the implied warranty of
8791 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8792 + Lesser General Public License for more details.
8793 +
8794 + You should have received a copy of the GNU Lesser General Public
8795 + License along with the GNU C Library; if not, write to the Free
8796 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
8797 + 02111-1307 USA. */
8798 +
8799 +#include <sysdeps/x86_64/dl-machine.h>
8800 +
8801 +#ifndef x32_dl_machine_h
8802 +#define x32_dl_machine_h
8803 +
8804 +#undef ARCH_LA_PLTENTER
8805 +#undef ARCH_LA_PLTEXIT
8806 +#undef RTLD_START
8807 +
8808 +/* Names of the architecture-specific auditing callback functions. */
8809 +#define ARCH_LA_PLTENTER x32_gnu_pltenter
8810 +#define ARCH_LA_PLTEXIT x32_gnu_pltexit
8811 +
8812 +/* Initial entry point code for the dynamic linker.
8813 + The C function `_dl_start' is the real entry point;
8814 + its return value is the user program's entry point. */
8815 +#define RTLD_START asm ("\n\
8816 +.text\n\
8817 + .align 16\n\
8818 +.globl _start\n\
8819 +.globl _dl_start_user\n\
8820 +_start:\n\
8821 + movl %esp, %edi\n\
8822 + call _dl_start\n\
8823 +_dl_start_user:\n\
8824 + # Save the user entry point address in %r12.\n\
8825 + movl %eax, %r12d\n\
8826 + # See if we were run as a command with the executable file\n\
8827 + # name as an extra leading argument.\n\
8828 + movl _dl_skip_args(%rip), %eax\n\
8829 + # Pop the original argument count.\n\
8830 + movl (%rsp), %edx\n\
8831 + addl $4,%esp\n\
8832 + # Adjust the stack pointer to skip _dl_skip_args words.\n\
8833 + lea (%rsp,%rax,4), %esp\n\
8834 + # Subtract _dl_skip_args from argc.\n\
8835 + subl %eax, %edx\n\
8836 + # Push argc back on the stack.\n\
8837 + subl $4,%esp\n\
8838 + movl %edx, (%rsp)\n\
8839 + # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\
8840 + # argc -> rsi\n\
8841 + movl %edx, %esi\n\
8842 + # Save %rsp value in %r13.\n\
8843 + movl %esp, %r13d\n\
8844 + # And align stack for the _dl_init_internal call. \n\
8845 + and $-16, %esp\n\
8846 + # _dl_loaded -> rdi\n\
8847 + movl _rtld_local(%rip), %edi\n\
8848 + # env -> rcx\n\
8849 + lea 8(%r13,%rdx,4), %ecx\n\
8850 + # argv -> rdx\n\
8851 + lea 4(%r13), %edx\n\
8852 + # Clear %rbp to mark outermost frame obviously even for constructors.\n\
8853 + xorl %ebp, %ebp\n\
8854 + # Call the function to run the initializers.\n\
8855 + call _dl_init_internal@PLT\n\
8856 + # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\
8857 + lea _dl_fini(%rip), %edx\n\
8858 + # And make sure %rsp points to argc stored on the stack.\n\
8859 + movl %r13d, %esp\n\
8860 + # Jump to the user's entry point.\n\
8861 + jmp *%r12\n\
8862 +.previous\n\
8863 +");
8864 +
8865 +#endif /* !x32_dl_machine_h */
8866 diff --git a/sysdeps/x86_64/x32/ffs.c b/sysdeps/x86_64/x32/ffs.c
8867 new file mode 100644
8868 index 0000000..393f501
8869 --- /dev/null
8870 +++ b/sysdeps/x86_64/x32/ffs.c
8871 @@ -0,0 +1 @@
8872 +#include <sysdeps/i386/i686/ffs.c>
8873 diff --git a/sysdeps/x86_64/x32/gmp-mparam.h b/sysdeps/x86_64/x32/gmp-mparam.h
8874 new file mode 100644
8875 index 0000000..33cb36e
8876 --- /dev/null
8877 +++ b/sysdeps/x86_64/x32/gmp-mparam.h
8878 @@ -0,0 +1,33 @@
8879 +/* gmp-mparam.h -- Compiler/machine parameter header file.
8880 +
8881 +Copyright (C) 2011 Free Software Foundation, Inc.
8882 +
8883 +This file is part of the GNU MP Library.
8884 +
8885 +The GNU MP Library is free software; you can redistribute it and/or modify
8886 +it under the terms of the GNU Lesser General Public License as published by
8887 +the Free Software Foundation; either version 2.1 of the License, or (at your
8888 +option) any later version.
8889 +
8890 +The GNU MP Library is distributed in the hope that it will be useful, but
8891 +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
8892 +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
8893 +License for more details.
8894 +
8895 +You should have received a copy of the GNU Lesser General Public License
8896 +along with the GNU MP Library; see the file COPYING.LIB. If not, write to
8897 +the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
8898 +
8899 +#if defined __GMP_H__ && ! defined _LONG_LONG_LIMB
8900 +#error "Included too late for _LONG_LONG_LIMB to take effect"
8901 +#endif
8902 +
8903 +#define _LONG_LONG_LIMB
8904 +#define BITS_PER_MP_LIMB 64
8905 +#define BYTES_PER_MP_LIMB 8
8906 +#define BITS_PER_LONGINT __WORDSIZE
8907 +#define BITS_PER_INT 32
8908 +#define BITS_PER_SHORTINT 16
8909 +#define BITS_PER_CHAR 8
8910 +/* Prefer long long. */
8911 +#define PREFER_LONG_LONG
8912 diff --git a/sysdeps/x86_64/x32/shlib-versions b/sysdeps/x86_64/x32/shlib-versions
8913 new file mode 100644
8914 index 0000000..a0d353d
8915 --- /dev/null
8916 +++ b/sysdeps/x86_64/x32/shlib-versions
8917 @@ -0,0 +1,2 @@
8918 +x86_64-.*-linux.* DEFAULT GLIBC_2.11
8919 +x86_64-.*-linux.* ld=ld-linux-x32.so.2 GLIBC_2.11
8920 diff --git a/sysdeps/x86_64/x32/symbol-hacks.h b/sysdeps/x86_64/x32/symbol-hacks.h
8921 new file mode 100644
8922 index 0000000..bc7b4c4
8923 --- /dev/null
8924 +++ b/sysdeps/x86_64/x32/symbol-hacks.h
8925 @@ -0,0 +1 @@
8926 +/* Fortunately nothing to do. */
8927 diff --git a/sysdeps/x86_64/x32/sysdep.h b/sysdeps/x86_64/x32/sysdep.h
8928 new file mode 100644
8929 index 0000000..0bb21f8
8930 --- /dev/null
8931 +++ b/sysdeps/x86_64/x32/sysdep.h
8932 @@ -0,0 +1,98 @@
8933 +/* Assembler macros for x32.
8934 + Copyright (C) 2011 Free Software Foundation, Inc.
8935 + This file is part of the GNU C Library.
8936 +
8937 + The GNU C Library is free software; you can redistribute it and/or
8938 + modify it under the terms of the GNU Lesser General Public
8939 + License as published by the Free Software Foundation; either
8940 + version 2.1 of the License, or (at your option) any later version.
8941 +
8942 + The GNU C Library is distributed in the hope that it will be useful,
8943 + but WITHOUT ANY WARRANTY; without even the implied warranty of
8944 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8945 + Lesser General Public License for more details.
8946 +
8947 + You should have received a copy of the GNU Lesser General Public
8948 + License along with the GNU C Library; if not, write to the Free
8949 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
8950 + 02111-1307 USA. */
8951 +
8952 +#undef ASM_ADDR
8953 +#undef LP_SIZE
8954 +
8955 +#undef RAX_LP
8956 +#undef RBP_LP
8957 +#undef RBX_LP
8958 +#undef RCX_LP
8959 +#undef RDI_LP
8960 +#undef RDX_LP
8961 +#undef RSP_LP
8962 +#undef RSI_LP
8963 +#undef R8_LP
8964 +#undef R9_LP
8965 +#undef R10_LP
8966 +#undef R11_LP
8967 +#undef R12_LP
8968 +#undef R13_LP
8969 +#undef R14_LP
8970 +#undef R15_LP
8971 +
8972 +#ifdef __ASSEMBLER__
8973 +
8974 +# define LP_SIZE 4
8975 +
8976 +# undef MOVE_LP
8977 +# define MOVE_LP movl
8978 +
8979 +# undef ADD_LP
8980 +# define ADD_LP addl
8981 +
8982 +# undef SUB_LP
8983 +# define SUB_LP subl
8984 +
8985 +# undef CMP_LP
8986 +# define CMP_LP cmpl
8987 +
8988 +# define ASM_ADDR .long
8989 +
8990 +# define RAX_LP eax
8991 +# define RBP_LP ebp
8992 +# define RBX_LP ebx
8993 +# define RCX_LP ecx
8994 +# define RDI_LP edi
8995 +# define RDX_LP edx
8996 +# define RSI_LP esi
8997 +# define RSP_LP esp
8998 +# define R8_LP r8d
8999 +# define R9_LP r9d
9000 +# define R10_LP r10d
9001 +# define R11_LP r11d
9002 +# define R12_LP r12d
9003 +# define R13_LP r13d
9004 +# define R14_LP r14d
9005 +# define R15_LP r15d
9006 +
9007 +#else /* __ASSEMBLER__ */
9008 +
9009 +# define LP_SIZE "4"
9010 +
9011 +# define ASM_ADDR ".long"
9012 +
9013 +# define RAX_LP "eax"
9014 +# define RBP_LP "ebp"
9015 +# define RBX_LP "ebx"
9016 +# define RCX_LP "ecx"
9017 +# define RDI_LP "edi"
9018 +# define RDX_LP "edx"
9019 +# define RSI_LP "esi"
9020 +# define RSP_LP "esp"
9021 +# define R8_LP "r8d"
9022 +# define R9_LP "r9d"
9023 +# define R10_LP "r10d"
9024 +# define R11_LP "r11d"
9025 +# define R12_LP "r12d"
9026 +# define R13_LP "r13d"
9027 +# define R14_LP "r14d"
9028 +# define R15_LP "r15d"
9029 +
9030 +#endif /* __ASSEMBLER__ */
9031 diff --git a/time/mktime.c b/time/mktime.c
9032 index e47d696..af0457f 100644
9033 --- a/time/mktime.c
9034 +++ b/time/mktime.c
9035 @@ -169,7 +169,7 @@ ydhms_diff (long int year1, long int yday1, int hour1, int min1, int sec1,
9036 {
9037 verify (C99_integer_division, -1 / 2 == 0);
9038 verify (long_int_year_and_yday_are_wide_enough,
9039 - INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX);
9040 + INT_MAX <= TIME_T_MAX / 2 || TIME_T_MAX <= UINT_MAX);
9041
9042 /* Compute intervening leap days correctly even if year is negative.
9043 Take care to avoid integer overflow here. */
9044 diff --git a/time/offtime.c b/time/offtime.c
9045 index c0b1db5..312ad42 100644
9046 --- a/time/offtime.c
9047 +++ b/time/offtime.c
9048 @@ -36,6 +36,8 @@ __offtime (t, offset, tp)
9049 const unsigned short int *ip;
9050
9051 days = *t / SECS_PER_DAY;
9052 + if (days != *t / SECS_PER_DAY)
9053 + goto overflow;
9054 rem = *t % SECS_PER_DAY;
9055 rem += offset;
9056 while (rem < 0)
9057 @@ -66,6 +68,9 @@ __offtime (t, offset, tp)
9058 /* Guess a corrected year, assuming 365 days per year. */
9059 long int yg = y + days / 365 - (days % 365 < 0);
9060
9061 + if (yg < 0)
9062 + goto overflow;
9063 +
9064 /* Adjust DAYS and Y to match the guessed year. */
9065 days -= ((yg - y) * 365
9066 + LEAPS_THRU_END_OF (yg - 1)
9067 @@ -75,6 +80,7 @@ __offtime (t, offset, tp)
9068 tp->tm_year = y - 1900;
9069 if (tp->tm_year != y - 1900)
9070 {
9071 +overflow:
9072 /* The year cannot be represented due to overflow. */
9073 __set_errno (EOVERFLOW);
9074 return 0;
9075 diff --git a/time/time.h b/time/time.h
9076 index fee8d27..c448ee2 100644
9077 --- a/time/time.h
9078 +++ b/time/time.h
9079 @@ -120,7 +120,7 @@ typedef __timer_t timer_t;
9080 struct timespec
9081 {
9082 __time_t tv_sec; /* Seconds. */
9083 - long int tv_nsec; /* Nanoseconds. */
9084 + __snseconds_t tv_nsec; /* Nanoseconds. */
9085 };
9086
9087 #endif /* timespec not defined and <time.h> or need timespec. */