mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
3.5 KiB

  1. Some fixes for compilation with gcc-3.4.
  2. - Rene Rebe <rene@rocklinux.org>
  3. diff -ur dietlibc-0.25-orig/lib/alloc.c dietlibc-0.25/lib/alloc.c
  4. --- dietlibc-0.25-orig/lib/alloc.c 2004-01-27 15:24:11.000000000 +0100
  5. +++ dietlibc-0.25/lib/alloc.c 2004-05-05 03:14:54.000000000 +0200
  6. @@ -44,14 +44,13 @@
  7. /* a simple mmap :) */
  8. +static void*
  9. #ifdef __i386__
  10. /* regparm exists only on i386 */
  11. -static void *do_mmap(size_t size) __attribute__((regparm(1)));
  12. -static size_t get_index(size_t _size) __attribute__((regparm(1)));
  13. -static void* __small_malloc(size_t _size) __attribute__((regparm(1)));
  14. +__attribute__((regparm(1)))
  15. #endif
  16. -
  17. -static void *do_mmap(size_t size) {
  18. +do_mmap(size_t size)
  19. +{
  20. return mmap(0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, (size_t)0);
  21. }
  22. @@ -70,7 +69,13 @@
  23. static inline int __ind_shift() { return (MEM_BLOCK_SIZE==4096)?4:5; }
  24. -static size_t get_index(size_t _size) {
  25. +static size_t
  26. +#ifdef __i386__
  27. +/* regparm exists only on i386 */
  28. +__attribute__((regparm(1)))
  29. +#endif
  30. +get_index(size_t _size)
  31. +{
  32. register size_t idx=0;
  33. if (_size) {
  34. register size_t size=((_size-1)&(MEM_BLOCK_SIZE-1))>>__ind_shift();
  35. @@ -80,9 +85,13 @@
  36. }
  37. /* small mem */
  38. -static void __small_free(void*_ptr,size_t _size) __attribute__((regparm(2)));
  39. -
  40. -static void __small_free(void*_ptr,size_t _size) {
  41. +static void
  42. +#ifdef __i386__
  43. +/* regparm exists only on i386 */
  44. +__attribute__((regparm(1)))
  45. +#endif
  46. +__small_free(void*_ptr,size_t _size)
  47. +{
  48. __alloc_t* ptr=BLOCK_START(_ptr);
  49. size_t size=_size;
  50. size_t idx=get_index(size);
  51. @@ -93,7 +102,13 @@
  52. __small_mem[idx]=ptr;
  53. }
  54. -static void* __small_malloc(size_t _size) {
  55. +static void*
  56. +#ifdef __i386__
  57. +/* regparm exists only on i386 */
  58. +__attribute__((regparm(1)))
  59. +#endif
  60. +__small_malloc(size_t _size)
  61. +{
  62. __alloc_t *ptr;
  63. size_t size=_size;
  64. size_t idx;
  65. diff -ur dietlibc-0.25-orig/libpthread/pthread_internal.c dietlibc-0.25/libpthread/pthread_internal.c
  66. --- dietlibc-0.25-orig/libpthread/pthread_internal.c 2003-09-29 16:00:59.000000000 +0200
  67. +++ dietlibc-0.25/libpthread/pthread_internal.c 2004-05-05 03:18:08.000000000 +0200
  68. @@ -49,10 +49,11 @@
  69. static inline unsigned long hash_tid(int tid) { return (tid&(NR_BUCKETS-1)); }
  70. /* O(1) */
  71. +static void
  72. #if defined(__i386__)
  73. -static void __thread_add_tid_(_pthread_descr*root,_pthread_descr thread) __attribute__((regparm(2)));
  74. +__attribute__((regparm(2)))
  75. #endif
  76. -static void __thread_add_tid_(_pthread_descr*root,_pthread_descr thread) {
  77. +__thread_add_tid_(_pthread_descr*root,_pthread_descr thread) {
  78. _pthread_descr tmp=*root;
  79. thread->prev=root;
  80. thread->next=tmp;
  81. @@ -75,13 +76,9 @@
  82. /* find thread by thread-id O(n) (LOCK struct if found) */
  83. /* O(n*) linear to the number of thread in the same bucket */
  84. -#if defined(__i386__)
  85. -static _pthread_descr __thread_find_(int pid) __attribute__((regparm(1)));
  86. -_pthread_descr __thread_find(int pid) { return __thread_find_(pid); }
  87. -#else
  88. -_pthread_descr __thread_find(int pid) __attribute__((alias("__thread_find_")));
  89. -#endif
  90. -static _pthread_descr __thread_find_(int pid) {
  91. +
  92. +static _pthread_descr
  93. +__thread_find_(int pid) {
  94. _pthread_descr cur;
  95. if (__thread_started==PTHREAD_ONCE_INIT) { /* uninitialised */
  96. LOCK(&_main_thread);
  97. @@ -96,6 +93,13 @@
  98. return cur;
  99. }
  100. +#if defined(__i386__)
  101. +_pthread_descr
  102. +__thread_find(int pid) { return __thread_find_(pid); }
  103. +#else
  104. +_pthread_descr __thread_find(int pid) __attribute__((alias("__thread_find_")));
  105. +#endif
  106. +
  107. /* get thread-self descriptor O(1)/O(n*) */
  108. _pthread_descr __thread_self(void) {
  109. /* O(1) "search" */