Changes in / [ee820ff:5fe3f954] in mainline


Ignore:
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    ree820ff r5fe3f954  
    380380uspace/lib/label/test-liblabel
    381381uspace/lib/pcut/test-libpcut-*
    382 uspace/lib/posix/gcc.specs
     382uspace/lib/posix/collisions.list
    383383uspace/lib/posix/include/libc
    384 uspace/lib/posix/link.ld
    385384uspace/lib/posix/redefs-hide-libc-symbols.list
     385uspace/lib/posix/redefs-hide-libc.xargs
     386uspace/lib/posix/redefs-show-posix-symbols.list
     387uspace/lib/posix/redefs-show-posix.xargs
    386388uspace/lib/posix/test-libposix
    387389uspace/lib/uri/test-liburi
  • Makefile

    ree820ff r5fe3f954  
    4848ERRNO_INPUT = abi/include/abi/errno.in
    4949
    50 .PHONY: all precheck cscope cscope_parts autotool config_auto config_default config distclean clean check releasefile release common boot kernel uspace export-posix
     50.PHONY: all precheck cscope cscope_parts autotool config_auto config_default config distclean clean check releasefile release common boot kernel uspace
    5151
    5252all: kernel uspace
     
    6060uspace: common
    6161        $(MAKE) -r -C uspace PRECHECK=$(PRECHECK)
    62 
    63 export-posix: common
    64 ifndef EXPORT_DIR
    65         @echo ERROR: Variable EXPORT_DIR is not defined. && false
    66 else
    67         $(MAKE) -r -C uspace export EXPORT_DIR=$(abspath $(EXPORT_DIR))
    68 endif
    6962
    7063precheck: clean
  • boot/arch/arm32/src/asm.S

    ree820ff r5fe3f954  
    6868        mrc     p15, 0, r4, c1, c0, 0
    6969       
    70         # Disable D-cache before the kernel is started.
     70        # D-cache before the kernel is started.
    7171        bic     r4, r4, #(1 << CP15_C1_DC)
    7272
  • kernel/arch/amd64/src/amd64.c

    ree820ff r5fe3f954  
    216216#endif
    217217        ns16550_instance_t *ns16550_instance
    218             = ns16550_init(NS16550_BASE, 0, IRQ_NS16550, NULL, NULL,
     218            = ns16550_init((ns16550_t *) NS16550_BASE, IRQ_NS16550, NULL, NULL,
    219219            ns16550_out_ptr);
    220220        if (ns16550_instance) {
  • kernel/arch/arm32/include/arch/security_ext.h

    ree820ff r5fe3f954  
    8282
    8383#endif
    84 
    8584/** @}
    8685 */
  • kernel/arch/ia32/include/arch/drivers/i8259.h

    ree820ff r5fe3f954  
    4444#define PIC_PIC1PORT2  ((ioport8_t *) 0xa1U)
    4545
    46 /* ICW1 bits */
    47 #define PIC_ICW1           (1 << 4)
    48 #define PIC_ICW1_NEEDICW4  (1 << 0)
    49 
    50 /* OCW4 bits */
    51 #define PIC_OCW4           (0 << 3)
    52 #define PIC_OCW4_NSEOI     (1 << 5)
     46#define PIC_NEEDICW4  (1 << 0)
     47#define PIC_ICW1      (1 << 4)
    5348
    5449extern void i8259_init(void);
  • kernel/arch/ia32/src/drivers/i8259.c

    ree820ff r5fe3f954  
    5050{
    5151        /* ICW1: this is ICW1, ICW4 to follow */
    52         pio_write_8(PIC_PIC0PORT1, PIC_ICW1 | PIC_ICW1_NEEDICW4);
     52        pio_write_8(PIC_PIC0PORT1, PIC_ICW1 | PIC_NEEDICW4);
    5353
    5454        /* ICW2: IRQ 0 maps to INT IRQBASE */
     
    6262
    6363        /* ICW1: ICW1, ICW4 to follow */
    64         pio_write_8(PIC_PIC1PORT1, PIC_ICW1 | PIC_ICW1_NEEDICW4);
     64        pio_write_8(PIC_PIC1PORT1, PIC_ICW1 | PIC_NEEDICW4);
    6565
    6666        /* ICW2: IRQ 8 maps to INT (IVT_IRQBASE + 8) */
     
    122122void pic_eoi(void)
    123123{
    124         pio_write_8(PIC_PIC0PORT1, PIC_OCW4 | PIC_OCW4_NSEOI);
    125         pio_write_8(PIC_PIC1PORT1, PIC_OCW4 | PIC_OCW4_NSEOI);
     124        pio_write_8((ioport8_t *) 0x20, 0x20);
     125        pio_write_8((ioport8_t *) 0xa0, 0x20);
    126126}
    127127
  • kernel/arch/ia32/src/ia32.c

    ree820ff r5fe3f954  
    201201#endif
    202202        ns16550_instance_t *ns16550_instance
    203             = ns16550_init(NS16550_BASE, 0, IRQ_NS16550, NULL, NULL,
     203            = ns16550_init((ns16550_t *) NS16550_BASE, IRQ_NS16550, NULL, NULL,
    204204            ns16550_out_ptr);
    205205        if (ns16550_instance) {
  • kernel/arch/ia64/src/ia64.c

    ree820ff r5fe3f954  
    181181#ifdef CONFIG_NS16550
    182182        ns16550_instance_t *ns16550_instance
    183             = ns16550_init(NS16550_BASE, 0, NS16550_IRQ, NULL, NULL,
     183            = ns16550_init((ns16550_t *) NS16550_BASE, NS16550_IRQ, NULL, NULL,
    184184            NULL);
    185185        if (ns16550_instance) {
  • kernel/arch/sparc64/src/drivers/kbd.c

    ree820ff r5fe3f954  
    118118        size_t offset = pa - aligned_addr;
    119119       
    120         ioport8_t *ns16550 = (ioport8_t *) (km_map(aligned_addr, offset + size,
     120        ns16550_t *ns16550 = (ns16550_t *) (km_map(aligned_addr, offset + size,
    121121            PAGE_WRITE | PAGE_NOT_CACHEABLE) + offset);
    122122       
    123         ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, 0, inr, cir,
     123        ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, inr, cir,
    124124            cir_arg, NULL);
    125125        if (ns16550_instance) {
  • kernel/genarch/include/genarch/drivers/ns16550/ns16550.h

    ree820ff r5fe3f954  
    5050
    5151/** NS16550 registers. */
    52 typedef enum {
    53         NS16550_REG_RBR = 0,  /**< Receiver Buffer Register (read). */
    54         NS16550_REG_THR = 0,  /**< Transmitter Holder Register (write). */
    55         NS16550_REG_IER = 1,  /**< Interrupt Enable Register. */
    56         NS16550_REG_IIR = 2,  /**< Interrupt Ident Register (read). */
    57         NS16550_REG_FCR = 2,  /**< FIFO control register (write). */
    58         NS16550_REG_LCR = 3,  /**< Line Control register. */
    59         NS16550_REG_MCR = 4,  /**< Modem Control Register. */
    60         NS16550_REG_LSR = 5,  /**< Line Status Register. */
    61 } ns16550_reg_t;
     52typedef struct {
     53        union {
     54                ioport8_t rbr;      /**< Receiver Buffer Register (read). */
     55                ioport8_t thr;      /**< Transmitter Holder Register (write). */
     56        } __attribute__ ((packed));
     57        ioport8_t ier;      /**< Interrupt Enable Register. */
     58        union {
     59                ioport8_t iir;  /**< Interrupt Ident Register (read). */
     60                ioport8_t fcr;  /**< FIFO control register (write). */
     61        } __attribute__ ((packed));
     62        ioport8_t lcr;      /**< Line Control register. */
     63        ioport8_t mcr;      /**< Modem Control Register. */
     64        ioport8_t lsr;      /**< Line Status Register. */
     65} __attribute__ ((packed)) ns16550_t;
    6266
    6367/** Structure representing the ns16550 device. */
    6468typedef struct {
    6569        irq_t irq;
    66         volatile ioport8_t *ns16550;
     70        ns16550_t *ns16550;
    6771        indev_t *input;
    6872        outdev_t *output;
    6973        parea_t parea;
    70         int reg_shift;
    7174} ns16550_instance_t;
    7275
    73 extern ns16550_instance_t *ns16550_init(ioport8_t *, unsigned, inr_t, cir_t,
    74     void *, outdev_t **);
     76extern ns16550_instance_t *ns16550_init(ns16550_t *, inr_t, cir_t, void *,
     77    outdev_t **);
    7578extern void ns16550_wire(ns16550_instance_t *, indev_t *);
    7679
  • kernel/genarch/src/drivers/ns16550/ns16550.c

    ree820ff r5fe3f954  
    11/*
    22 * Copyright (c) 2009 Jakub Jermar
    3  * Copyright (c) 2018 CZ.NIC, z.s.p.o.
    43 * All rights reserved.
    54 *
     
    4746#define LSR_TH_READY    0x20
    4847
    49 static uint8_t ns16550_reg_read(ns16550_instance_t *inst, ns16550_reg_t reg)
    50 {
    51         return pio_read_8(&inst->ns16550[reg << inst->reg_shift]);
    52 }
    53 
    54 static void ns16550_reg_write(ns16550_instance_t *inst, ns16550_reg_t reg,
    55     uint8_t val)
    56 {
    57         pio_write_8(&inst->ns16550[reg << inst->reg_shift], val);
    58 }
    59 
    6048static irq_ownership_t ns16550_claim(irq_t *irq)
    6149{
    6250        ns16550_instance_t *instance = irq->instance;
    63 
    64         if (ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_DATA_READY)
     51        ns16550_t *dev = instance->ns16550;
     52       
     53        if (pio_read_8(&dev->lsr) & LSR_DATA_READY)
    6554                return IRQ_ACCEPT;
    6655        else
     
    7160{
    7261        ns16550_instance_t *instance = irq->instance;
     62        ns16550_t *dev = instance->ns16550;
    7363       
    74         while (ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_DATA_READY) {
    75                 uint8_t data = ns16550_reg_read(instance, NS16550_REG_RBR);
     64        if (pio_read_8(&dev->lsr) & LSR_DATA_READY) {
     65                uint8_t data = pio_read_8(&dev->rbr);
    7666                indev_push_character(instance->input, data);
    7767        }
     
    7969
    8070/**< Clear input buffer. */
    81 static void ns16550_clear_buffer(ns16550_instance_t *instance)
     71static void ns16550_clear_buffer(ns16550_t *dev)
    8272{
    83         while (ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_DATA_READY)
    84                 (void) ns16550_reg_read(instance, NS16550_REG_RBR);
     73        while ((pio_read_8(&dev->lsr) & LSR_DATA_READY))
     74                (void) pio_read_8(&dev->rbr);
    8575}
    8676
    87 static void ns16550_sendb(ns16550_instance_t *instance, uint8_t byte)
     77static void ns16550_sendb(ns16550_t *dev, uint8_t byte)
    8878{
    89         while (!(ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_TH_READY))
     79        while (!(pio_read_8(&dev->lsr) & LSR_TH_READY))
    9080                ;
    91         ns16550_reg_write(instance, NS16550_REG_THR, byte);
     81        pio_write_8(&dev->thr, byte);
    9282}
    9383
     
    9888        if ((!instance->parea.mapped) || (console_override)) {
    9989                if (ascii_check(ch))
    100                         ns16550_sendb(instance, (uint8_t) ch);
     90                        ns16550_sendb(instance->ns16550, (uint8_t) ch);
    10191                else
    102                         ns16550_sendb(instance, U_SPECIAL);
     92                        ns16550_sendb(instance->ns16550, U_SPECIAL);
    10393        }
    10494}
     
    111101/** Initialize ns16550.
    112102 *
    113  * @param dev        Address of the beginning of the device in I/O space.
    114  * @param reg_shift  Spacing between individual register addresses, in log2.
    115  *                   The individual register location is calculated as
    116  *                   `base + (register offset << reg_shift)`.
    117  * @param inr        Interrupt number.
    118  * @param cir        Clear interrupt function.
    119  * @param cir_arg    First argument to cir.
    120  * @param output     Where to store pointer to the output device
    121  *                   or NULL if the caller is not interested in
    122  *                   writing to the serial port.
     103 * @param dev      Addrress of the beginning of the device in I/O space.
     104 * @param inr      Interrupt number.
     105 * @param cir      Clear interrupt function.
     106 * @param cir_arg  First argument to cir.
     107 * @param output   Where to store pointer to the output device
     108 *                 or NULL if the caller is not interested in
     109 *                 writing to the serial port.
    123110 *
    124111 * @return Keyboard instance or NULL on failure.
    125112 *
    126113 */
    127 ns16550_instance_t *ns16550_init(ioport8_t *dev, unsigned reg_shift, inr_t inr,
    128     cir_t cir, void *cir_arg, outdev_t **output)
     114ns16550_instance_t *ns16550_init(ns16550_t *dev, inr_t inr, cir_t cir,
     115    void *cir_arg, outdev_t **output)
    129116{
    130117        ns16550_instance_t *instance
     
    132119        if (instance) {
    133120                instance->ns16550 = dev;
    134                 instance->reg_shift = reg_shift;
    135121                instance->input = NULL;
    136122                instance->output = NULL;
     
    176162        irq_register(&instance->irq);
    177163       
    178         ns16550_clear_buffer(instance);
     164        ns16550_clear_buffer(instance->ns16550);
    179165       
    180166        /* Enable interrupts */
    181         ns16550_reg_write(instance, NS16550_REG_IER, IER_ERBFI);
    182         ns16550_reg_write(instance, NS16550_REG_MCR, MCR_OUT2);
     167        pio_write_8(&instance->ns16550->ier, IER_ERBFI);
     168        pio_write_8(&instance->ns16550->mcr, MCR_OUT2);
    183169}
    184170
  • kernel/generic/include/macros.h

    ree820ff r5fe3f954  
    6262        if (sz2)
    6363                return ((s1 >= s2) && (s1 <= e2));
    64        
    6564        if (sz1)
    6665                return ((s2 >= s1) && (s2 <= e1));
     
    8786        if (sz1 == 0)
    8887                return (s1 == s2) && (sz2 == 0);
    89        
    90         e1 = s1 + sz1 - 1;
     88        e1 = s1 + sz1 - 1;     
    9189        if (sz2 == 0)
    9290                return (s1 <= s2) && (s2 <= e1);
    93        
    9491        e2 = s2 + sz2 - 1;
    9592
     
    10097#endif /* __ASM__ */
    10198
    102 #define ispwr2(x)  (((x) & ((x) - 1)) == 0)
     99#define ispwr2(x)       (((x) & ((x) - 1)) == 0)
    103100
    104101#define isdigit(d)     (((d) >= '0') && ((d) <= '9'))
     
    145142
    146143/* Test for sum overflow into positive numbers. */
    147 #define overflows_into_positive(a, b) \
     144#define overflows_into_positive(a, b)   \
    148145        (overflows((a), (b)) && ((a) + (b) > 0))
    149146
     
    160157        })
    161158
     159
     160#ifndef member_to_inst
    162161#define member_to_inst(ptr_member, type, member_identif) \
    163         ((type *) (((void *) (ptr_member)) - \
    164             ((void *) &(((type *) 0)->member_identif))))
     162        ((type*) (((void*)(ptr_member)) - ((void*)&(((type*)0)->member_identif))))
     163#endif
     164
    165165
    166166#endif
  • kernel/generic/src/mm/slab.c

    ree820ff r5fe3f954  
    125125/** Cache for cache descriptors */
    126126static slab_cache_t slab_cache_cache;
    127 
    128 /** Cache for per-CPU magazines of caches */
    129 static slab_cache_t slab_mag_cache;
    130127
    131128/** Cache for external slab descriptors
     
    592589        assert(_slab_initialized >= 2);
    593590       
    594         cache->mag_cache = slab_alloc(&slab_mag_cache, FRAME_ATOMIC);
     591        cache->mag_cache = malloc(sizeof(slab_mag_cache_t) * config.cpu_count,
     592            FRAME_ATOMIC);
    595593        if (!cache->mag_cache)
    596594                return false;
     
    725723}
    726724
    727 /** Return object to cache, use slab if known
    728  *
    729  */
    730 NO_TRACE static void _slab_free(slab_cache_t *cache, void *obj, slab_t *slab)
    731 {
    732         ipl_t ipl = interrupts_disable();
    733        
    734         if ((cache->flags & SLAB_CACHE_NOMAGAZINE) ||
    735             (magazine_obj_put(cache, obj)))
    736                 slab_obj_destroy(cache, obj, slab);
    737        
    738         interrupts_restore(ipl);
    739         atomic_dec(&cache->allocated_objs);
    740 }
    741 
    742725/** Check that there are no slabs and remove cache from system
    743726 *
     
    768751                panic("Destroying cache that is not empty.");
    769752       
    770         if (!(cache->flags & SLAB_CACHE_NOMAGAZINE)) {
    771                 slab_t *mag_slab = obj2slab(cache->mag_cache);
    772                 _slab_free(mag_slab->cache, cache->mag_cache, mag_slab);
    773         }
     753        if (!(cache->flags & SLAB_CACHE_NOMAGAZINE))
     754                free(cache->mag_cache);
    774755       
    775756        slab_free(&slab_cache_cache, cache);
     
    798779       
    799780        return result;
     781}
     782
     783/** Return object to cache, use slab if known
     784 *
     785 */
     786NO_TRACE static void _slab_free(slab_cache_t *cache, void *obj, slab_t *slab)
     787{
     788        ipl_t ipl = interrupts_disable();
     789       
     790        if ((cache->flags & SLAB_CACHE_NOMAGAZINE) ||
     791            (magazine_obj_put(cache, obj)))
     792                slab_obj_destroy(cache, obj, slab);
     793       
     794        interrupts_restore(ipl);
     795        atomic_dec(&cache->allocated_objs);
    800796}
    801797
     
    935931#endif
    936932       
    937         _slab_cache_create(&slab_mag_cache, "slab_mag_cache",
    938             sizeof(slab_mag_cache_t) * config.cpu_count, sizeof(uintptr_t),
    939             NULL, NULL, SLAB_CACHE_NOMAGAZINE | SLAB_CACHE_SLINSIDE);
    940        
    941933        irq_spinlock_lock(&slab_cache_lock, false);
    942934       
  • tools/autotool.py

    ree820ff r5fe3f954  
    615615                                path = "%s/%s/bin" % (cross_prefix, platform)
    616616               
    617                 common['TARGET'] = target
    618617                prefix = "%s-" % target
    619618               
  • tools/toolchain.sh

    ree820ff r5fe3f954  
    554554       
    555555        # Symlink clang and lld to the install path.
    556         CLANG="`which clang 2> /dev/null || echo "/usr/bin/clang"`"
    557         LLD="`which ld.lld 2> /dev/null || echo "/usr/bin/ld.lld"`"
     556        CLANG=`which clang 2> /dev/null || echo "/usr/bin/clang"`
     557        LLD=`which ld.lld 2> /dev/null || echo "/usr/bin/ld.lld"`
    558558       
    559559        ln -s $CLANG "${INSTALL_DIR}/${PREFIX}/bin/${TARGET}-clang"
  • uspace/Makefile

    ree820ff r5fe3f954  
    258258CLEANS := $(addsuffix .clean,$(DIRS) $(LIBS) $(BASE_LIBS))
    259259
    260 .PHONY: all $(BASE_BUILDS) $(BUILDS) $(BUILDS_TESTS) $(CLEANS) clean export
     260.PHONY: all $(BASE_BUILDS) $(BUILDS) $(BUILDS_TESTS) $(CLEANS) clean
    261261
    262262all: $(BUILDS) $(BUILDS_TESTS)
     
    264264$(BUILDS_TESTS): $(BASE_BUILDS) $(BUILDS)
    265265        $(MAKE) -r -C $(basename $@) all-test PRECHECK=$(PRECHECK)
    266 
    267 export: lib/posix.build lib/math.build lib/clui.build
    268         $(MAKE) -r -C lib/posix export EXPORT_DIR=$(EXPORT_DIR)
    269266
    270267clean: $(CLEANS)
  • uspace/Makefile.common

    ree820ff r5fe3f954  
    174174endif
    175175
    176 # Flags that are not necessary, and can be overriden, but are used by default.
    177 DEFAULT_CFLAGS = \
    178         -O$(OPTIMIZATION) \
    179         -ffunction-sections \
    180         -pipe \
    181         -Wall \
    182         -Wextra \
    183         -Wno-unused-parameter \
    184         -Wmissing-prototypes \
    185         -Wwrite-strings \
    186         -Werror-implicit-function-declaration
     176COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
     177        -ffreestanding -nostdlib -nostdinc -fexec-charset=UTF-8 \
     178        -finput-charset=UTF-8 -D__$(ENDIANESS)__ -D_HELENOS_SOURCE -fno-common \
     179        -fdebug-prefix-map=$(realpath $(ROOT_PATH))=.
     180
     181GCC_CFLAGS = -ffunction-sections -Wall -Wextra -Wno-clobbered \
     182        -Wno-unused-parameter -Wmissing-prototypes -std=gnu99 \
     183        -Werror-implicit-function-declaration \
     184        -Wwrite-strings -pipe
     185
     186# -Wno-missing-prototypes is there because it warns about main().
     187# This should be fixed elsewhere.
     188CLANG_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-typedef-redefinition \
     189        -Wno-missing-prototypes -Wno-unused-command-line-argument \
     190        -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \
     191        -pipe -fno-stack-protector -fno-PIC
    187192
    188193ifeq ($(CONFIG_DEBUG),y)
    189         DEFAULT_CFLAGS += -Werror
    190 endif
    191 
    192 ifeq ($(COMPILER),clang)
    193         DEFAULT_CFLAGS += \
    194                 -Wno-missing-field-initializers \
    195                 -Wno-typedef-redefinition \
    196                 -Wno-unused-command-line-argument
    197 else
    198         DEFAULT_CFLAGS += \
    199                 -Wno-clobbered
     194        COMMON_CFLAGS += -Werror
    200195endif
    201196
    202197ifeq ($(CONFIG_LINE_DEBUG),y)
    203         DEFAULT_CFLAGS += -ggdb
    204 endif
    205 
    206 # Flags that should always be used, even for third-party software.
    207 COMMON_CPPFLAGS = \
    208         -nostdinc \
    209         -D__$(ENDIANESS)__
    210 
    211 COMMON_CFLAGS = \
    212         -ffreestanding \
    213         -nostdlib
    214 
    215 # Flags that are always used for HelenOS code, but not for third-party.
    216 HELENOS_CFLAGS = \
    217         -std=gnu99 \
    218         $(INCLUDES_FLAGS) \
    219         -imacros $(CONFIG_HEADER) \
    220         -D_HELENOS_SOURCE \
    221         -fexec-charset=UTF-8 \
    222         -finput-charset=UTF-8 \
    223         -fno-common \
    224         -fdebug-prefix-map=$(realpath $(ROOT_PATH))=.
    225 
    226 # TODO: Use a different name.
    227 # CFLAGS variable is traditionally used for overridable flags.
    228 CFLAGS = $(COMMON_CPPFLAGS) $(COMMON_CFLAGS) $(HELENOS_CFLAGS) $(DEFAULT_CFLAGS)
     198        GCC_CFLAGS += -ggdb
     199        CLANG_CFLAGS += -g
     200endif
    229201
    230202## Setup platform configuration
     
    244216endif
    245217
     218ifeq ($(COMPILER),clang)
     219        CFLAGS += $(COMMON_CFLAGS) $(CLANG_CFLAGS)
     220else
     221        CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
     222endif
     223
    246224ifeq ($(CONFIG_STRIP_BINARIES),y)
    247225        LFLAGS += --strip-all
     
    268246all-test: $(TEST_OUTPUTS)
    269247
    270 clean: fasterclean
     248clean:
     249        rm -f $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk
    271250        find . -name '*.o' -follow -exec rm \{\} \;
    272251        find . -name '*.lo' -follow -exec rm \{\} \;
     
    274253
    275254fasterclean:
    276         rm -rf $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk
     255        rm -f $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk
    277256
    278257depend: $(PRE_DEPEND)
  • uspace/lib/c/arch/amd64/Makefile.common

    ree820ff r5fe3f954  
    3131# XXX: clang doesn't support this flag, but the optimization is OS-specific,
    3232#      so it isn't used for amd64-unknown-elf target.
    33 
    34 ifneq ($(COMPILER),clang)
    35         COMMON_CFLAGS += -mno-tls-direct-seg-refs
    36 endif
     33GCC_CFLAGS += -mno-tls-direct-seg-refs
    3734
    3835LFLAGS += --gc-sections
  • uspace/lib/c/include/macros.h

    ree820ff r5fe3f954  
    5555            | ((((uint64_t) (up)) & 0xffffffff) << 32))
    5656
     57#ifndef member_to_inst
    5758#define member_to_inst(ptr_member, type, member_identif) \
    58         ((type *) (((void *) (ptr_member)) - \
    59             ((void *) &(((type *) 0)->member_identif))))
     59        ((type*) (((void*)(ptr_member)) - ((void*)&(((type*)0)->member_identif))))
     60#endif
    6061
    61 #define _paddname(line)     PADD_ ## line ## __
    62 #define _padd(width, line)  uint ## width ## _t _paddname(line)
    63 
    64 #define PADD32  _padd(32, __LINE__)
    65 #define PADD16  _padd(16, __LINE__)
    66 #define PADD8   _padd(8, __LINE__)
    6762
    6863#endif
    6964
     65#define _paddname(line) PADD_ ## line ## __
     66#define _padd(width, line) uint ## width ## _t _paddname(line)
     67#define PADD32 _padd(32, __LINE__)
     68#define PADD16 _padd(16, __LINE__)
     69#define PADD8 _padd(8, __LINE__)
     70
    7071/** @}
    7172 */
  • uspace/lib/posix/Makefile

    ree820ff r5fe3f954  
    4545        $(LIBSOFTINT_PREFIX)/libsoftint.a
    4646
    47 SPECS = gcc.specs
    48 LIBC_LINKER_SCRIPT = $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
    49 LIBC_STARTUP_FILE = $(shell sed -n -e 's/^.*STARTUP(\(.*\)).*$$/\1/p' $(LIBC_LINKER_SCRIPT))
    50 EXPORT_LINKER_SCRIPT = link.ld
    51 EXPORT_STARTUP_FILE = crt0.o
    52 
    53 EXPORT_FILES = \
    54         ../math/libmath.a \
    55         ../clui/libclui.a \
    56         $(MERGED_C_LIBRARY) \
    57         $(EXPORT_STARTUP_FILE) \
    58         $(EXPORT_LINKER_SCRIPT) \
    59         $(SPECS)
    60 
    6147REDEFS_HIDE_LIBC = redefs-hide-libc-symbols.list
    6248
     
    6753        libc.o
    6854
    69 EXTRA_OUTPUT = $(FIXED_C_LIBRARY) $(FIXED_POSIX_LIBRARY) $(MERGED_C_LIBRARY) $(SPECS) $(EXPORT_LINKER_SCRIPT) $(EXPORT_STARTUP_FILE)
     55EXTRA_OUTPUT = $(FIXED_C_LIBRARY) $(FIXED_POSIX_LIBRARY) $(MERGED_C_LIBRARY)
    7056
    7157SOURCES = \
     
    9783        test/scanf.c
    9884
    99 EXPORT_CPPFLAGS = \
    100         -specs $$(HELENOS_EXPORT_ROOT)/lib/gcc.specs \
    101         -isystem $$(HELENOS_EXPORT_ROOT)/include
    102 
    103 EXPORT_LDFLAGS = \
    104         -L$$(HELENOS_EXPORT_ROOT)/lib \
    105         -T link.ld
    106 
    107 EXPORT_LDLIBS = \
    108         -lmath -lc
    109 
    110 EXPORT_CFLAGS = \
    111         -specs $$(HELENOS_EXPORT_ROOT)/lib/gcc.specs
    112 
    11385include $(USPACE_PREFIX)/Makefile.common
    11486
    115 $(SPECS): $(CONFIG_MAKEFILE)
    116         echo '*self_spec:' > $@.new
    117         echo '+ $(COMMON_CFLAGS)' >> $@.new
    118         echo >> $@.new
    119         echo '*cpp:' >> $@.new
    120         echo '+ $(COMMON_CPPFLAGS)' >> $@.new
    121         echo >> $@.new
    122         echo '*lib:' >> $@.new
    123         echo '$(EXPORT_LDLIBS)' >> $@.new
    124         mv $@.new $@
    125 
    126 $(EXPORT_LINKER_SCRIPT): $(LIBC_LINKER_SCRIPT)
    127         sed 's/STARTUP(.*)/STARTUP(crt0.o)/' $< > $@
    128 
    129 $(EXPORT_STARTUP_FILE): $(LIBC_STARTUP_FILE)
    130         cp $< $@
    131 
    132 $(INCLUDE_LIBC): $(shell find ../c/include -name '*.h')
    133         cp -r -L --remove-destination -T ../c/include $@
    134         find ../c/include -type f -and -not -name '*.h' -delete
    135 
    136 export: $(EXPORT_DIR)/config.mk $(EXPORT_DIR)/config.rc
    137 
    138 $(EXPORT_DIR)/config.mk: export-libs export-includes
    139         echo '# Generated file, do not modify.' >> $@.new
    140         echo '# Do not forget to set HELENOS_EXPORT_ROOT.' >> $@.new
    141         echo 'HELENOS_CROSS_PATH="$(shell dirname $(CC))"' >> $@.new
    142         echo 'HELENOS_ARCH="$(firstword $(subst -, ,$(TARGET)))"' >> $@.new
    143         echo 'HELENOS_TARGET="$(TARGET)"' >> $@.new
    144         echo 'HELENOS_CPPFLAGS="$(EXPORT_CPPFLAGS)"' >> $@.new
    145         echo 'HELENOS_CFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
    146         echo 'HELENOS_CXXFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
    147         echo 'HELENOS_LDFLAGS="$(EXPORT_LDFLAGS)"' >> $@.new
    148         echo 'HELENOS_LDLIBS="$(EXPORT_LDLIBS)"' >> $@.new
    149         mv $@.new $@
    150 
    151 $(EXPORT_DIR)/config.rc: $(EXPORT_DIR)/config.mk
    152         sed 's:$$(HELENOS_EXPORT_ROOT):$$HELENOS_EXPORT_ROOT:g' < $< >$@
    153 
    154 export-libs: $(EXPORT_FILES) export-includes
    155         mkdir -p $(EXPORT_DIR)/lib
    156         cp -L $(EXPORT_FILES) $(EXPORT_DIR)/lib
    157 
    158 export-includes: $(INCLUDE_LIBC) $(shell find ./include ../c/arch/$(UARCH)/include $(ROOT_PATH)/abi/include -name '*.h')
    159         mkdir -p $(EXPORT_DIR)/include
    160         rm -rf $(EXPORT_DIR)/include.new
    161         cp -r -L -T ./include/posix $(EXPORT_DIR)/include.new
    162         cp -r -L -T ./include/libc $(EXPORT_DIR)/include.new/libc
    163         cp -r -L ../c/arch/$(UARCH)/include/* $(EXPORT_DIR)/include.new/libc
    164         cp -r -L $(ROOT_PATH)/abi/include/* $(EXPORT_DIR)/include.new
    165         mkdir -p $(EXPORT_DIR)/include.new/libclui
    166         cp -L ../clui/tinput.h $(EXPORT_DIR)/include.new/libclui
    167        
    168         find "$(EXPORT_DIR)/include.new/libc" "$(EXPORT_DIR)/include.new/libclui" -name '*.h' -exec sed \
    169                 -e 's:#include <:#include <libc/:' \
    170                 -e 's:#include <libc/abi/:#include <abi/:' \
    171                 -e 's:#include <libc/_bits/:#include <_bits/:' \
    172                 -e 's:#include <libc/libc/:#include <libc/:' \
    173                 -i {} \;
    174         find "$(EXPORT_DIR)/include.new" -name '*.h' -exec sed \
    175                 -e 's:#include "posix/:#include ":' \
    176                 -e 's:#include <posix/:#include <:' \
    177                 -i {} \;
    178        
    179         rm -rf $(EXPORT_DIR)/include
    180         mv $(EXPORT_DIR)/include.new $(EXPORT_DIR)/include
     87$(INCLUDE_LIBC): ../c/include
     88        ln -s -f -n ../$^ $@
    18189
    18290$(FIXED_C_LIBRARY): $(LIBC_FILE) $(REDEFS_HIDE_LIBC)
     
    18997$(REDEFS_HIDE_LIBC): $(SOURCES)
    19098        sed -n -e 's/_HIDE_LIBC_SYMBOL(\(.*\))/\1 __helenos_libc_\1/p' $(SOURCES) >$@
     99
Note: See TracChangeset for help on using the changeset viewer.