Changeset 0c96e6cb in mainline for uspace/lib


Ignore:
Timestamp:
2013-10-18T11:00:23Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b5851913
Parents:
39bcc99 (diff), 9f9450bb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge GCC port updates

libposix changes

  • unimplemented methods do not abort, they warn instead
  • add pthread.h, no implementation yet
  • speed-up symbol redefinition (objcopy can work with static libraries as well)
  • add some functions already implemented in libc to libposix

toolchain changes

  • experimental support for HelenOS-specific toolchain
    • toolchain.sh —helenos-target
    • adds *-helenos*- target, e.g. we can have amd64-helenos-gcc
    • added as another choice to HelenOS.config, updated other scripts accordingly
  • added non-root compilation
    • install into PKG/ to be later copied to real root (package-like installation)
Location:
uspace/lib
Files:
5 added
3 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/bitops.c

    r39bcc99 r0c96e6cb  
    3333#include <bitops.h>
    3434
    35 extern int __popcountsi2(int a)
     35int __popcountsi2(int a)
    3636{
    37         return __builtin_popcount(a);
     37        int bits = 0;
     38        for (unsigned int i = 0; i < sizeof(a) * 8; i++)         {
     39                if (((a >> i) & 1) != 0) {
     40                        bits++;
     41                }
     42        }
     43        return bits;                                                                   
    3844}
    3945
  • uspace/lib/posix/Makefile

    r39bcc99 r0c96e6cb  
    4242FIXED_C_LIBRARY = libc4posix.a
    4343
    44 REDEFS_HIDE_LIBC = redefs-hide-libc.xargs
    45 REDEFS_SHOW_LIBPOSIX = redefs-show-posix.xargs
     44REDEFS_HIDE_LIBC = redefs-hide-libc-symbols.list
     45REDEFS_SHOW_LIBPOSIX = redefs-show-posix-symbols.list
    4646COLLISIONS_LIST = collisions.list
    4747
     
    6161        source/locale.c \
    6262        source/math.c \
     63        source/pthread/condvar.c \
     64        source/pthread/keys.c \
     65        source/pthread/mutex.c \
     66        source/pthread/threads.c \
    6367        source/pwd.c \
    6468        source/signal.c \
     
    8185
    8286$(FIXED_C_LIBRARY): $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX)
    83         ./tools/transform-symbols.sh \
    84                 $(OBJCOPY) $(AR) echo \
    85                 $(LIBC_FILE) $@ \
    86                 $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX)
     87        $(OBJCOPY) --redefine-syms=$(REDEFS_HIDE_LIBC) $(LIBC_FILE) $@
     88        $(OBJCOPY) --redefine-syms=$(REDEFS_SHOW_LIBPOSIX) $@ $@
    8789
    8890$(FIXED_POSIX_LIBRARY): $(LIBRARY).a $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX)
    89         ./tools/transform-symbols.sh \
    90                 $(OBJCOPY) $(AR) echo \
    91                 $(LIBRARY).a $@ \
    92                 $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX)
     91        $(OBJCOPY) --redefine-syms=$(REDEFS_HIDE_LIBC) $(LIBRARY).a $@
     92        $(OBJCOPY) --redefine-syms=$(REDEFS_SHOW_LIBPOSIX) $@ $@
    9393
    9494$(REDEFS_HIDE_LIBC): $(COLLISIONS_LIST)
    95         ./tools/create-redefines.sh "" "__helenos_libc_" <$(COLLISIONS_LIST) >$@
    96        
     95        sed 's/.*/& __helenos_libc_&/' <$(COLLISIONS_LIST) >$@
     96
    9797$(REDEFS_SHOW_LIBPOSIX): $(COLLISIONS_LIST)
    98         ./tools/create-redefines.sh "posix_" "" <$(COLLISIONS_LIST) >$@
     98        sed 's/.*/posix_& &/' <$(COLLISIONS_LIST) >$@
    9999
    100100$(COLLISIONS_LIST):
    101         ./tools/get-collision-list.sh ./include/posix >$@
     101        find ./include/posix -name '*.h' -exec \
     102                sed -n -e '/^#/d' -e 's/__POSIX_DEF__/\n&/gp' {} \; | \
     103                sed -n -e 's/__POSIX_DEF__(\([^)]*\)).*/\1/p' | \
     104                sort -u >$@
  • uspace/lib/posix/include/posix/float.h

    r39bcc99 r0c96e6cb  
    6161        #undef FLT_RADIX
    6262        #define FLT_RADIX __FLT_RADIX__
     63        #undef FLT_MIN
     64        #define FLT_MIN __FLT_MIN__
     65        #undef FLT_MAX
     66        #define FLT_MAX __FLT_MAX__
     67        #undef FLT_EPSILON
     68        #define FLT_EPSILON __FLT_EPSILON__
     69        #undef FLT_MANT_DIG
     70        #define FLT_MANT_DIG __FLT_MANT_DIG__
     71        #undef LDBL_MANT_DIG
     72        #define LDBL_MANT_DIG __LDBL_MANT_DIG__
    6373#else
    6474/* For something else than GCC, following definitions are provided.
  • uspace/lib/posix/include/posix/stdint.h

    r39bcc99 r0c96e6cb  
    108108
    109109
     110/*
     111 * Fast* and least* integer types.
     112 *
     113 * The definitions below are definitely safe if not the best.
     114 */
     115typedef uint8_t uint_least8_t;
     116typedef uint16_t uint_least16_t;
     117typedef uint32_t uint_least32_t;
     118typedef uint64_t uint_least64_t;
     119
     120typedef int8_t int_least8_t;
     121typedef int16_t int_least16_t;
     122typedef int32_t int_least32_t;
     123typedef int64_t int_least64_t;
     124
     125typedef uint8_t uint_fast8_t;
     126typedef uint16_t uint_fast16_t;
     127typedef uint32_t uint_fast32_t;
     128typedef uint64_t uint_fast64_t;
     129
     130typedef int8_t int_fast8_t;
     131typedef int16_t int_fast16_t;
     132typedef int32_t int_fast32_t;
     133typedef int64_t int_fast64_t;
     134
    110135#endif /* POSIX_STDINT_H_ */
    111136
  • uspace/lib/posix/include/posix/stdio.h

    r39bcc99 r0c96e6cb  
    123123
    124124extern void setvbuf(FILE *, void *, int, size_t);
    125 
     125extern void setbuf(FILE *, void *);
    126126
    127127/* POSIX specific stuff. */
  • uspace/lib/posix/include/posix/time.h

    r39bcc99 r0c96e6cb  
    104104extern char *__POSIX_DEF__(ctime_r)(const time_t *timer, char *buf);
    105105extern char *__POSIX_DEF__(ctime)(const time_t *timer);
     106extern time_t time(time_t *t);
    106107
    107108/* Clocks */
  • uspace/lib/posix/source/internal/common.h

    r39bcc99 r0c96e6cb  
    3939#include <stdlib.h>
    4040
    41 #define not_implemented() (fprintf(stderr, \
    42     "Function %s() in file %s at line %d is not implemented\n", \
    43     __func__, __FILE__, __LINE__), abort())
     41#define not_implemented() do { \
     42                static int __not_implemented_counter = 0; \
     43                if (__not_implemented_counter == 0) { \
     44                        fprintf(stderr, "%s() not implemented in %s:%d, something will NOT work.\n", \
     45                                __func__, __FILE__, __LINE__); \
     46                } \
     47                __not_implemented_counter++; \
     48        } while (0)
    4449
    4550/* A little helper macro to avoid typing this over and over. */
  • uspace/lib/posix/source/math.c

    r39bcc99 r0c96e6cb  
    4949        // TODO: low priority, just a compile-time dependency of binutils
    5050        not_implemented();
     51        return 0.0;
    5152}
    5253
     
    6162        // TODO: low priority, just a compile-time dependency of binutils
    6263        not_implemented();
     64        return 0.0;
    6365}
    6466
     
    7274        // TODO: Python dependency
    7375        not_implemented();
     76        return 0.0;
    7477}
    7578
     
    8487        // TODO: Python dependency
    8588        not_implemented();
     89        return 0.0;
    8690}
    8791
     
    9599        // TODO: Python dependency
    96100        not_implemented();
     101        return 0.0;
    97102}
    98103
     
    106111        // TODO: Python dependency
    107112        not_implemented();
     113        return 0.0;
    108114}
    109115
     
    118124        // TODO: Python dependency
    119125        not_implemented();
     126        return 0.0;
    120127}
    121128
     
    130137        // TODO: Python dependency
    131138        not_implemented();
     139        return 0.0;
    132140}
    133141
     
    141149        // TODO: Python dependency
    142150        not_implemented();
     151        return 0.0;
    143152}
    144153
     
    153162        // TODO: Python dependency
    154163        not_implemented();
     164        return 0.0;
    155165}
    156166
     
    164174        // TODO: Python dependency
    165175        not_implemented();
     176        return 0.0;
    166177}
    167178
     
    175186        // TODO: Python dependency
    176187        not_implemented();
     188        return 0.0;
    177189}
    178190
     
    186198        // TODO: Python dependency
    187199        not_implemented();
     200        return 0.0;
    188201}
    189202
  • uspace/lib/posix/source/stdlib.c

    r39bcc99 r0c96e6cb  
    6363        // TODO: low priority, just a compile-time dependency of binutils
    6464        not_implemented();
    65         return 1;
     65        return 0;
    6666}
    6767
  • uspace/lib/posix/source/unistd.c

    r39bcc99 r0c96e6cb  
    389389        // TODO: low priority, just a compile-time dependency of binutils
    390390        not_implemented();
     391        return -1;
    391392}
    392393
     
    399400        // TODO: low priority, just a compile-time dependency of binutils
    400401        not_implemented();
     402        return -1;
    401403}
    402404
     
    411413        // TODO: low priority, just a compile-time dependency of binutils
    412414        not_implemented();
     415        return -1;
    413416}
    414417
     
    423426        // TODO: low priority, just a compile-time dependency of binutils
    424427        not_implemented();
     428        return -1;
    425429}
    426430
     
    434438        // TODO: low priority, just a compile-time dependency of binutils
    435439        not_implemented();
     440        return -1;
    436441}
    437442
Note: See TracChangeset for help on using the changeset viewer.