Changeset e175d69 in mainline for uspace/lib/c
- Timestamp:
- 2011-05-01T13:08:18Z (14 years ago)
- 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. - Location:
- uspace/lib/c
- Files:
-
- 18 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
ra41577e re175d69 43 43 LINKER_SCRIPTS = \ 44 44 $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld \ 45 $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld 45 $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld \ 46 $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld \ 47 $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld 46 48 47 49 PRE_DEPEND = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) … … 49 51 EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPTS) 50 52 LIBRARY = libc 53 SLIBRARY = libc.so.0.0 54 LSONAME = libc.so.0 55 51 56 52 57 -include $(COMMON_MAKEFILE) 53 58 -include $(CONFIG_MAKEFILE) 54 59 -include arch/$(UARCH)/Makefile.inc 60 61 EXTRA_CFLAGS += -I../../srv/loader/include 55 62 56 63 GENERIC_SOURCES = \ … … 118 125 generic/sort.c \ 119 126 generic/stats.c \ 120 generic/assert.c \ 127 generic/assert.c 128 129 ifeq ($(CONFIG_RTLD), y) 130 GENERIC_SOURCES += \ 131 generic/dlfcn.c \ 132 generic/rtld/rtld.c \ 133 generic/rtld/elf_load.c \ 134 generic/rtld/dynamic.c \ 135 generic/rtld/module.c \ 136 generic/rtld/symbol.c 137 endif 121 138 122 139 SOURCES = \ … … 143 160 $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DLOADER -E -x c $< | grep -v "^\#" > $@ 144 161 162 $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in 163 $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DSHLIB -E -x c $< | grep -v "^\#" > $@ 164 165 $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in 166 $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DDLEXE -E -x c $< | grep -v "^\#" > $@ 167 145 168 $(COMMON_HEADER_ARCH): $(COMMON_HEADER) 146 169 ln -sfn ../../../$< $@ -
uspace/lib/c/arch/ia32/Makefile.inc
ra41577e re175d69 36 36 arch/$(UARCH)/src/setjmp.S \ 37 37 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 39 41 40 42 .PRECIOUS: arch/$(UARCH)/src/entry.o -
uspace/lib/c/arch/ia32/_link.ld.in
ra41577e re175d69 1 #ifndef SHLIB 1 2 STARTUP(LIBC_PATH/arch/UARCH/src/entry.o) 2 3 ENTRY(__entry) 4 #endif 3 5 4 6 PHDRS { 5 #if def LOADER7 #if defined(LOADER) || defined(DLEXE) 6 8 interp PT_INTERP; 7 9 text PT_LOAD FILEHDR PHDRS FLAGS(5); … … 10 12 #endif 11 13 data PT_LOAD FLAGS(6); 14 #if defined(SHLIB) || defined(DLEXE) 15 dynamic PT_DYNAMIC; 16 #endif 12 17 debug PT_NOTE; 13 18 } 14 19 15 20 SECTIONS { 16 #if def LOADER21 #if defined(LOADER) || defined(DLEXE) 17 22 .interp : { 18 23 *(.interp); 19 24 } :interp 20 25 #endif 26 #ifdef LOADER 21 27 . = 0x70001000 + SIZEOF_HEADERS; 22 28 #else … … 31 37 *(.rodata .rodata.*); 32 38 } :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 33 51 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 34 68 . = . + 0x1000; 69 70 #if defined(SHLIB) || defined(DLEXE) 71 .dynamic : { 72 *(.dynamic); 73 } :data :dynamic 74 #endif 35 75 36 76 .data : { … … 38 78 } :data 39 79 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 40 94 .tdata : { 41 95 _tdata_start = .; … … 49 103 50 104 _tls_alignment = ALIGNOF(.tdata); 105 #endif 51 106 52 107 .bss : { 108 *(.dynbss); 53 109 *(COMMON); 54 110 *(.bss); -
uspace/lib/c/arch/ia32/src/syscall.S
ra41577e re175d69 32 32 __syscall_fast_func: 33 33 .long __syscall_slow 34 .size __syscall_fast_func, . - __syscall_fast_func 34 35 35 36 .text … … 71 72 */ 72 73 .global __syscall_fast 74 .type __syscall_fast, @function 75 73 76 __syscall_fast: 74 77 pushl %ebx … … 95 98 popl %ebx 96 99 ret 100 101 .size __syscall_fast, . - __syscall_fast -
uspace/lib/c/arch/ia32/src/tls.c
ra41577e re175d69 37 37 #include <tls.h> 38 38 #include <sys/types.h> 39 #include <align.h> 39 40 40 41 tcb_t * __alloc_tls(void **data, size_t size) … … 48 49 } 49 50 51 /* 52 * Rtld TLS support 53 */ 54 55 typedef struct { 56 unsigned long int ti_module; 57 unsigned long int ti_offset; 58 } tls_index; 59 60 void __attribute__ ((__regparm__ (1))) 61 *___tls_get_addr(tls_index *ti); 62 63 void __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 50 78 /** @} 51 79 */ -
uspace/lib/c/generic/libc.c
ra41577e re175d69 53 53 #include "private/io.h" 54 54 55 #ifdef CONFIG_RTLD 56 #include <rtld/rtld.h> 57 #endif 58 55 59 static bool env_setup = false; 56 60 … … 77 81 char **argv; 78 82 83 #ifdef __IN_SHARED_LIBC__ 84 if (__pcb != NULL && __pcb->rtld_runtime != NULL) { 85 runtime_env = (runtime_env_t *) __pcb->rtld_runtime; 86 } 87 #endif 79 88 /* 80 89 * Get command line arguments and initialize -
uspace/lib/c/include/loader/pcb.h
ra41577e re175d69 72 72 /** Pointer to ELF dynamic section of the program. */ 73 73 void *dynamic; 74 /** Pointer to dynamic linker state structure (runtime_env_t). */ 75 void *rtld_runtime; 74 76 } pcb_t; 75 77
Note:
See TracChangeset
for help on using the changeset viewer.