Changeset e175d69 in mainline for uspace/lib/c/arch


Ignore:
Timestamp:
2011-05-01T13:08:18Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
042fbe0
Parents:
a41577e (diff), e515a827 (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 dynamic linking support (ia32-only, off by default). Very limited TLS
support. Executables which use TLS should set STATIC_ONLY = y in Makefile.

Location:
uspace/lib/c/arch/ia32
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/ia32/Makefile.inc

    ra41577e re175d69  
    3636        arch/$(UARCH)/src/setjmp.S \
    3737        arch/$(UARCH)/src/stacktrace.c \
    38         arch/$(UARCH)/src/stacktrace_asm.S
     38        arch/$(UARCH)/src/stacktrace_asm.S \
     39        arch/$(UARCH)/src/rtld/dynamic.c \
     40        arch/$(UARCH)/src/rtld/reloc.c
    3941
    4042.PRECIOUS: arch/$(UARCH)/src/entry.o
  • uspace/lib/c/arch/ia32/_link.ld.in

    ra41577e re175d69  
     1#ifndef SHLIB
    12STARTUP(LIBC_PATH/arch/UARCH/src/entry.o)
    23ENTRY(__entry)
     4#endif
    35
    46PHDRS {
    5 #ifdef LOADER
     7#if defined(LOADER) || defined(DLEXE)
    68        interp PT_INTERP;
    79        text PT_LOAD FILEHDR PHDRS FLAGS(5);
     
    1012#endif
    1113        data PT_LOAD FLAGS(6);
     14#if defined(SHLIB) || defined(DLEXE)
     15        dynamic PT_DYNAMIC;
     16#endif
    1217        debug PT_NOTE;
    1318}
    1419
    1520SECTIONS {
    16 #ifdef LOADER
     21#if defined(LOADER) || defined(DLEXE)
    1722        .interp : {
    1823                *(.interp);
    1924        } :interp
    20 
     25#endif
     26#ifdef LOADER
    2127        . = 0x70001000 + SIZEOF_HEADERS;
    2228#else
     
    3137                *(.rodata .rodata.*);
    3238        } :text
     39
     40#if defined(SHLIB) || defined(DLEXE)
     41        .rel.plt : {
     42                *(.rel.plt);
     43        }
     44        /*
     45         *.rel.dyn MUST FOLLOW IMMEDIATELY after .rel.plt
     46         * without alignment gap or DT_REL will be broken
     47         */
     48        .rel.dyn : {
     49                *(.rel.*);
     50        } :text
    3351       
     52        .plt : {
     53                *(.plt);
     54        } :text
     55       
     56        .dynsym : {
     57                *(.dynsym);
     58        } :text
     59       
     60        .dynstr : {
     61                *(.dynstr);
     62        } :text
     63       
     64        .hash : {
     65                *(.hash);
     66        } :text
     67#endif
    3468        . = . + 0x1000;
     69       
     70#if defined(SHLIB) || defined(DLEXE)
     71        .dynamic : {
     72                *(.dynamic);
     73        } :data :dynamic
     74#endif
    3575       
    3676        .data : {
     
    3878        } :data
    3979       
     80#if defined(SHLIB) || defined(DLEXE)
     81        .data.rel : {
     82                *(.data.rel .data.rel.*);
     83        } :data
     84
     85        .got : {
     86                *(.got);
     87        } :data
     88        .got.plt : {
     89                *(.got.plt);
     90        } :data
     91#endif
     92       
     93#ifndef DLEXE
    4094        .tdata : {
    4195                _tdata_start = .;
     
    49103       
    50104        _tls_alignment = ALIGNOF(.tdata);
     105#endif
    51106       
    52107        .bss : {
     108                *(.dynbss);
    53109                *(COMMON);
    54110                *(.bss);
  • uspace/lib/c/arch/ia32/src/syscall.S

    ra41577e re175d69  
    3232__syscall_fast_func:
    3333        .long __syscall_slow
     34        .size __syscall_fast_func, . - __syscall_fast_func
    3435
    3536.text
     
    7172 */
    7273.global __syscall_fast
     74        .type __syscall_fast, @function
     75
    7376__syscall_fast:
    7477        pushl %ebx
     
    9598        popl %ebx
    9699        ret
     100
     101        .size __syscall_fast, . - __syscall_fast
  • uspace/lib/c/arch/ia32/src/tls.c

    ra41577e re175d69  
    3737#include <tls.h>
    3838#include <sys/types.h>
     39#include <align.h>
    3940
    4041tcb_t * __alloc_tls(void **data, size_t size)
     
    4849}
    4950
     51/*
     52 * Rtld TLS support
     53 */
     54
     55typedef struct {
     56        unsigned long int ti_module;
     57        unsigned long int ti_offset;
     58} tls_index;
     59
     60void __attribute__ ((__regparm__ (1)))
     61    *___tls_get_addr(tls_index *ti);
     62
     63void __attribute__ ((__regparm__ (1)))
     64    *___tls_get_addr(tls_index *ti)
     65{
     66        size_t tls_size;
     67        uint8_t *tls;
     68
     69        /* Calculate size of TLS block */
     70        tls_size = ALIGN_UP(&_tbss_end - &_tdata_start, &_tls_alignment);
     71
     72        /* The TLS block is just before TCB */
     73        tls = (uint8_t *)__tcb_get() - tls_size;
     74
     75        return tls + ti->ti_offset;
     76}
     77
    5078/** @}
    5179 */
Note: See TracChangeset for help on using the changeset viewer.