Changes in / [8aa2b3b:b2a081ae] in mainline
- Files:
-
- 12 added
- 79 deleted
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
HelenOS.config
r8aa2b3b rb2a081ae 528 528 ! [PLATFORM=sparc64&MACHINE=generic] CONFIG_AOUT_ISOFS_B (y) 529 529 530 % Build shared libraries531 ! CONFIG_BUILD_SHARED_LIBS (y/n)532 533 % Link against shared libraries534 ! [CONFIG_BUILD_SHARED_LIBS=y] CONFIG_USE_SHARED_LIBS (n/y)535 ! [CONFIG_BUILD_SHARED_LIBS=n] CONFIG_USE_SHARED_LIBS (n)536 537 530 % Run devman on startup 538 531 ! CONFIG_START_DEVMAN (y/n) -
boot/Makefile
r8aa2b3b rb2a081ae 55 55 cp "$$file" "$(DIST_PATH)/srv/" ; \ 56 56 done 57 for file in $(RD_LIBS) ; do \58 cp "$$file" "$(DIST_PATH)/lib/" ; \59 done60 57 for file in $(RD_APPS) ; do \ 61 58 cp "$$file" "$(DIST_PATH)/app/" ; \ … … 86 83 rm -f $(USPACE_PATH)/dist/srv/* 87 84 rm -rf $(USPACE_PATH)/dist/drv/* 88 rm -f $(USPACE_PATH)/dist/lib/*89 85 rm -f $(USPACE_PATH)/dist/app/* 90 86 rm -f $(USPACE_PATH)/dist/cfg/net/* -
boot/Makefile.common
r8aa2b3b rb2a081ae 118 118 RD_DRV_CFG = 119 119 120 RD_LIBS = \121 $(USPACE_PATH)/lib/test/libtest.so.0122 123 ifeq ($(CONFIG_BUILD_SHARED_LIBS), y)124 RD_LIBS += $(USPACE_PATH)/lib/c/libc.so.0125 RD_LIBS += $(USPACE_PATH)/lib/softint/libsoftint.so.0126 RD_APPS += $(USPACE_PATH)/app/dltest/dltest127 endif128 129 120 RD_APPS_ESSENTIAL = \ 130 121 $(USPACE_PATH)/app/bdsh/bdsh \ … … 133 124 134 125 RD_APPS_NON_ESSENTIAL = \ 135 $(USPACE_PATH)/app/dltest/dltest \136 $(USPACE_PATH)/app/dltest2/dltest2 \137 $(USPACE_PATH)/app/dload/dload \138 126 $(USPACE_PATH)/app/edit/edit \ 139 127 $(USPACE_PATH)/app/kill/kill \ -
boot/arch/mips32/src/Makefile
r8aa2b3b rb2a081ae 1 1 # 2 # Copyright (c) 2006 Martin Decky 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 include ../../../../version 30 -include ../../../../Makefile.config 30 include Makefile.common 31 31 32 ## Toolchain configuration 33 # 32 .PHONY: all clean 34 33 35 ifndef CROSS_PREFIX 36 CROSS_PREFIX = /usr/local 37 endif 38 39 BFD_ARCH = mips 40 TARGET = mipsel-linux-gnu 41 TOOLCHAIN_DIR = $(CROSS_PREFIX)/mipsel/bin 42 43 ifeq ($(MACHINE),lgxemul) 44 BFD_NAME = elf32-tradlittlemips 45 BFD = ecoff-littlemips 46 endif 47 ifeq ($(MACHINE),bgxemul) 48 BFD_NAME = elf32-tradbigmips 49 BFD = ecoff-bigmips 50 TOOLCHAIN_DIR = $(CROSS_PREFIX)/mips/bin 51 TARGET = mips-linux-gnu 52 endif 53 ifeq ($(MACHINE),msim) 54 BFD_NAME = elf32-tradlittlemips 55 BFD = binary 56 endif 57 58 ifeq ($(COMPILER),gcc_native) 59 CC = gcc 60 AS = as 61 LD = ld 62 OBJCOPY = objcopy 63 OBJDUMP = objdump 64 endif 65 66 ifeq ($(COMPILER),gcc_cross) 67 CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc 68 AS = $(TOOLCHAIN_DIR)/$(TARGET)-as 69 LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld 70 OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy 71 OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump 72 endif 73 74 CFLAGS = -DRELEASE=$(RELEASE) -I. -I../../../generic -imacros ../../../../config.h -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mhard-float -mips3 -pipe 75 76 SOURCES = \ 77 main.c \ 78 msim.c \ 79 _components.c \ 80 ../../../generic/printf.c \ 81 ../../../generic/string.c \ 82 asm.S \ 83 boot.S 84 85 COMPONENTS = \ 86 $(KERNELDIR)/kernel.bin \ 87 $(USPACEDIR)/srv/ns/ns \ 88 $(USPACEDIR)/srv/loader/loader \ 89 $(USPACEDIR)/app/init/init \ 90 $(USPACEDIR)/srv/devmap/devmap \ 91 $(USPACEDIR)/srv/bd/rd/rd \ 92 $(USPACEDIR)/srv/vfs/vfs 93 ifeq ($(RDFMT),tmpfs) 94 COMPONENTS += $(USPACEDIR)/srv/fs/tmpfs/tmpfs 95 endif 96 ifeq ($(RDFMT),fat) 97 COMPONENTS += $(USPACEDIR)/srv/fs/fat/fat 98 endif 99 100 RD_SRVS = \ 101 $(USPACEDIR)/srv/fb/fb \ 102 $(USPACEDIR)/srv/kbd/kbd \ 103 $(USPACEDIR)/srv/console/console \ 104 $(USPACEDIR)/srv/fs/devfs/devfs \ 105 $(USPACEDIR)/srv/fs/tmpfs/tmpfs \ 106 $(USPACEDIR)/srv/fs/fat/fat \ 107 $(USPACEDIR)/srv/bd/file_bd/file_bd \ 108 $(USPACEDIR)/srv/bd/gxe_bd/gxe_bd 109 110 RD_APPS = \ 111 $(USPACEDIR)/app/getvc/getvc \ 112 $(USPACEDIR)/app/tetris/tetris \ 113 $(USPACEDIR)/app/tester/tester \ 114 $(USPACEDIR)/app/dload/dload \ 115 $(USPACEDIR)/app/dltest/dltest \ 116 $(USPACEDIR)/app/dltest2/dltest2 \ 117 $(USPACEDIR)/app/trace/trace \ 118 $(USPACEDIR)/app/bdsh/bdsh \ 119 $(USPACEDIR)/app/klog/klog 120 121 RD_LIBS = \ 122 $(USPACEDIR)/lib/libc/shared/libc.so.0 \ 123 $(USPACEDIR)/lib/libtest/libtest.so.0 124 125 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 126 COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS)))) 127 128 .PHONY: all clean depend 129 130 all: image.boot 131 132 -include Makefile.depend 133 134 image.boot: image.raw 135 $(OBJCOPY) -O $(BFD) $< $@ 136 137 image.raw: depend _components.h _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) 138 $(LD) -no-check-sections -N -T _link.ld -o $@ $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) 139 140 depend: 141 -makedepend -f - -- $(DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null 34 all: ../../../../version ../../../../Makefile.common ../../../../Makefile.config ../../../../config.h 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build PRECHECK=$(PRECHECK) 142 37 143 38 clean: 144 -for file in $(RD_SRVS) ; do \ 39 rm -f $(USPACEDIR)/dist/srv/* 40 rm -f $(USPACEDIR)/dist/app/* 41 rm -f $(USPACEDIR)/dist/cfg/net/* 42 43 for file in $(RD_SRVS) ; do \ 145 44 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ 146 45 done 147 -for file in $(RD_APPS) ; do \46 for file in $(RD_APPS) ; do \ 148 47 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ 149 48 done 150 -rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) initrd.img image.raw image.boot Makefile.depend 151 152 _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_LIBS) $(RD_APPS) _link.ld.in 153 for file in $(RD_SRVS) ; do \ 154 cp $$file $(USPACEDIR)/dist/srv/ ; \ 49 for file in $(NET_CFG) ; do \ 50 rm -f $(USPACEDIR)/dist/cfg/net/`basename $$file` ; \ 155 51 done 156 for lib in $(RD_LIBS) ; do \ 157 cp $$lib $(USPACEDIR)/dist/lib/ ; \ 158 done 159 for file in $(RD_APPS) ; do \ 160 cp $$file $(USPACEDIR)/dist/app/ ; \ 161 done 162 ifeq ($(RDFMT),tmpfs) 163 ../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs 164 endif 165 ifeq ($(RDFMT),fat) 166 ../../../../tools/mkfat.py $(USPACEDIR)/dist/ initrd.fs 167 endif 168 ../../../../tools/mkhord.py 16384 initrd.fs initrd.img 169 rm initrd.fs 170 ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 16384 "unsigned int" $(COMPONENTS) ./initrd.img 171 172 %.o: %.S 173 $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@ 174 175 %.o: %.c 176 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 52 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(RAW) $(COMPS).h $(COMPS).c $(LINK) $(INITRD).img $(INITRD).fs 53 find . -name '*.o' -follow -exec rm \{\} \; 54 find . -name '*.co' -follow -exec rm \{\} \; -
defaults/amd64/Makefile.config
r8aa2b3b rb2a081ae 3 3 4 4 # Ramdisk format 5 RDFMT = tmpfs5 RDFMT = fat 6 6 7 7 # Compiler … … 59 59 CONFIG_VESA_BPP = 16 60 60 61 # Build shared libraries62 CONFIG_BUILD_SHARED_LIBS = n63 64 61 # Load disk drivers on startup 65 62 CONFIG_START_BD = n -
defaults/arm32/Makefile.config
r8aa2b3b rb2a081ae 3 3 4 4 # Ramdisk format 5 RDFMT = tmpfs5 RDFMT = fat 6 6 7 7 # Compiler … … 35 35 CONFIG_HID_OUT = generic 36 36 37 # Build shared libraries38 CONFIG_BUILD_SHARED_LIBS = n39 40 37 # Load disk drivers on startup 41 38 CONFIG_START_BD = n -
defaults/ia32/Makefile.config
r8aa2b3b rb2a081ae 6 6 7 7 # Ramdisk format 8 RDFMT = tmpfs8 RDFMT = fat 9 9 10 10 # Compiler … … 65 65 CONFIG_VESA_BPP = 16 66 66 67 # Build shared libraries68 CONFIG_BUILD_SHARED_LIBS = y69 70 # Link against shared libraries71 CONFIG_USE_SHARED_LIBS = y72 73 67 # Load disk drivers on startup 74 68 CONFIG_START_BD = n -
defaults/ia64/Makefile.config
r8aa2b3b rb2a081ae 3 3 4 4 # Ramdisk format 5 RDFMT = tmpfs5 RDFMT = fat 6 6 7 7 # Compiler … … 47 47 CONFIG_HID_OUT = generic 48 48 49 # Build shared libraries50 CONFIG_BUILD_SHARED_LIBS = n51 52 49 # Load disk drivers on startup 53 50 CONFIG_START_BD = n -
defaults/mips32/Makefile.config
r8aa2b3b rb2a081ae 3 3 4 4 # Ramdisk format 5 RDFMT = tmpfs5 RDFMT = fat 6 6 7 7 # Compiler … … 41 41 CONFIG_HID_OUT = generic 42 42 43 # Build shared libraries44 CONFIG_BUILD_SHARED_LIBS = n45 46 43 # Load disk drivers on startup 47 44 CONFIG_START_BD = n -
defaults/ppc32/Makefile.config
r8aa2b3b rb2a081ae 3 3 4 4 # Ramdisk format 5 RDFMT = tmpfs5 RDFMT = fat 6 6 7 7 # Compiler … … 41 41 CONFIG_BAT = y 42 42 43 # Build shared libraries44 CONFIG_BUILD_SHARED_LIBS = n45 46 43 # Load disk drivers on startup 47 44 CONFIG_START_BD = n -
defaults/sparc64/Makefile.config
r8aa2b3b rb2a081ae 56 56 CONFIG_AOUT_ISOFS_B = y 57 57 58 # Build shared libraries59 CONFIG_BUILD_SHARED_LIBS = n60 61 58 # Load disk drivers on startup 62 59 CONFIG_START_BD = n -
defaults/special/Makefile.config
r8aa2b3b rb2a081ae 29 29 CONFIG_TEST = y 30 30 31 # Build shared libraries32 CONFIG_BUILD_SHARED_LIBS = n33 34 31 # Load disk drivers on startup 35 32 CONFIG_START_BD = n -
kernel/arch/ia32/include/barrier.h
r8aa2b3b rb2a081ae 54 54 NO_TRACE static inline void cpuid_serialization(void) 55 55 { 56 #ifndef __IN_SHARED_LIBC__57 56 asm volatile ( 58 57 "xorl %%eax, %%eax\n" … … 60 59 ::: "eax", "ebx", "ecx", "edx", "memory" 61 60 ); 62 #else63 /* Must not clobber PIC register ebx */64 asm volatile (65 "movl %%ebx, %%esi\n"66 "xorl %%eax, %%eax\n"67 "cpuid\n"68 "movl %%esi, %%ebx\n"69 ::: "eax", "ecx", "edx", "esi", "memory"70 );71 #endif72 61 } 73 62 -
kernel/generic/include/syscall/syscall.h
r8aa2b3b rb2a081ae 90 90 SYS_SYSINFO_GET_DATA, 91 91 92 SYS_DEBUG_PUTINT,93 92 SYS_DEBUG_ENABLE_CONSOLE, 94 93 SYS_DEBUG_DISABLE_CONSOLE, -
kernel/generic/src/syscall/syscall.c
r8aa2b3b rb2a081ae 55 55 #include <console/console.h> 56 56 #include <udebug/udebug.h> 57 58 /** Print a hex integer into klog */59 static sysarg_t sys_debug_putint(sysarg_t i)60 {61 printf("[task:0x%x]", i);62 return 0;63 }64 57 65 58 /** Dispatch system call */ … … 187 180 188 181 /* Debug calls */ 189 (syshandler_t) sys_debug_putint,190 182 (syshandler_t) sys_debug_enable_console, 191 183 (syshandler_t) sys_debug_disable_console -
uspace/Makefile
r8aa2b3b rb2a081ae 35 35 DIRS = \ 36 36 app/bdsh \ 37 app/dload \38 app/dltest2 \39 37 app/edit \ 40 38 app/getterm \ … … 94 92 drv/test2 95 93 96 ## Shared libraries97 ifeq ($(CONFIG_BUILD_SHARED_LIBS), y)98 DIRS += \99 app/dltest100 endif101 102 94 ## Networking 103 95 # … … 154 146 lib/softint \ 155 147 lib/softfloat \ 156 lib/test \157 148 lib/drv \ 158 149 lib/packet \ -
uspace/Makefile.common
r8aa2b3b rb2a081ae 73 73 endif 74 74 75 ifneq ($(SLIBRARY),)76 LARCHIVE = $(LIBRARY).la77 LOUTPUT = $(SLIBRARY)78 EXTRA_OUTPUT += $(LOUTPUT).disasm79 EXTRA_CLEAN += $(LOUTPUT).map $(LOUTPUT).ldisasm \80 $(LIBC_PREFIX)/shared/arch/$(UARCH)/_lib.ld81 endif82 83 75 DEPEND = Makefile.depend 84 76 DEPEND_PREV = $(DEPEND).prev … … 98 90 LIBNET_PREFIX = $(LIB_PREFIX)/net 99 91 100 ifeq ($(DYNAMIC_LINKING),y)101 BASE_LIBS = $(LIBC_PREFIX)/libc.so.0 $(LIBSOFTINT_PREFIX)/libsoftint.a102 LFLAGS = -Bdynamic103 LINKER_SCRIPT ?= $(LIBC_PREFIX)/shared/arch/$(UARCH)/_link.ld104 else105 92 BASE_LIBS = $(LIBC_PREFIX)/libc.a $(LIBSOFTINT_PREFIX)/libsoftint.a 93 106 94 LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld 107 endif108 95 109 96 ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y) … … 115 102 .PHONY: all clean 116 103 117 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $( LOUTPUT) $(EXTRA_OUTPUT)104 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(EXTRA_OUTPUT) 118 105 -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV) 119 106 120 107 clean: 121 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $( LARCHIVE) $(LOUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)108 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN) 122 109 find . -name '*.o' -follow -exec rm \{\} \; 123 find . -name '*.lo' -follow -exec rm \{\} \;124 110 125 111 GCC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \ … … 144 130 -pipe -g -arch $(CLANG_ARCH) -D__$(ENDIANESS)__ 145 131 146 LIB_CFLAGS = $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__147 LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive148 149 132 ifeq ($(CONFIG_DEBUG),y) 150 133 GCC_CFLAGS += -Werror … … 192 175 193 176 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 194 LOBJECTS := $(addsuffix .lo,$(basename $(SOURCES)))195 177 196 178 ifneq ($(BINARY),) … … 209 191 endif 210 192 211 ifneq ($(SLIBRARY),)212 %.disasm: $(LOUTPUT)213 ifeq ($(CONFIG_LINE_DEBUG),y)214 $(OBJDUMP) -d -S $< > $@215 else216 $(OBJDUMP) -d $< > $@217 endif218 219 $(LOUTPUT): $(LARCHIVE) $(LIBC_PREFIX)/shared/arch/$(UARCH)/_lib.ld220 $(LD) -T $(LIBC_PREFIX)/shared/arch/$(UARCH)/_lib.ld $(LIB_LFLAGS) $(LARCHIVE) -o $@ -Map $(LOUTPUT).map221 endif222 223 $(LIBC_PREFIX)/shared/arch/$(UARCH)/_lib.ld: $(LIBC_PREFIX)/shared/arch/$(UARCH)/_lib.ld.in224 $(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@225 226 $(LIBC_PREFIX)/shared/arch/$(UARCH)/_link.ld: $(LIBC_PREFIX)/shared/arch/$(UARCH)/_link.ld.in227 $(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@228 229 193 ifneq ($(LIBRARY),) 230 194 %.a: $(OBJECTS) 231 195 $(AR) rc $@ $(OBJECTS) 232 endif233 234 ifneq ($(SLIBRARY),)235 %.la: $(LOBJECTS)236 $(AR) rc $@ $(LOBJECTS)237 196 endif 238 197 … … 255 214 endif 256 215 257 %.lo: %.S258 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@259 260 %.lo: %.s261 $(AS) $(AFLAGS) $< -o $@262 263 %.lo: %.c $(DEPEND)264 $(CC) $(DEFS) $(LIB_CFLAGS) -c $< -o $@265 ifeq ($(PRECHECK),y)266 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)267 endif268 269 216 $(DEPEND): $(PRE_DEPEND) 270 217 makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null … … 276 223 $(OUTPUT): $(OBJECTS) 277 224 278 $(LARCHIVE): $(LOBJECTS) -
uspace/lib/c/Makefile
r8aa2b3b rb2a081ae 34 34 INCLUDE_ARCH = include/arch 35 35 INCLUDE_LIBARCH = include/libarch 36 INCLUDE_RTLDARCH = rtld/include/arch37 36 38 37 COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common … … 42 41 CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config 43 42 44 PRE_DEPEND = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $( INCLUDE_RTLDARCH) $(COMMON_HEADER_ARCH)43 PRE_DEPEND = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) 45 44 EXTRA_OUTPUT = $(LINKER_SCRIPT) 46 EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $( INCLUDE_RTLDARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPT)45 EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPT) 47 46 LIBRARY = libc 48 SLIBRARY = libc.so.0.049 LSONAME = libc.so.050 51 47 52 48 -include $(COMMON_MAKEFILE) 53 49 -include $(CONFIG_MAKEFILE) 54 50 -include arch/$(UARCH)/Makefile.inc 55 -include rtld/arch/$(UARCH)/Makefile.inc56 57 EXTRA_CFLAGS += -Irtld/include -I../../srv/loader/include58 51 59 52 GENERIC_SOURCES = \ … … 67 60 generic/device/hw_res.c \ 68 61 generic/device/char_dev.c \ 69 generic/dlfcn.c \70 62 generic/event.c \ 71 63 generic/errno.c \ … … 121 113 generic/arg_parse.c \ 122 114 generic/sort.c \ 123 generic/stats.c \ 124 rtld/rtld.c \ 125 rtld/elf_load.c \ 126 rtld/dynamic.c \ 127 rtld/module.c \ 128 rtld/symbol.c 115 generic/stats.c 129 116 130 117 SOURCES = \ … … 140 127 ln -sfn ../$< $@ 141 128 142 $(INCLUDE_RTLDARCH): rtld/arch/$(UARCH)/include143 ln -sfn ../../$< $@144 145 129 $(INCLUDE_KERNEL)/arch: ../../../kernel/generic/include/arch $(INCLUDE_KERNEL) 146 130 -
uspace/lib/c/arch/ia32/src/syscall.S
r8aa2b3b rb2a081ae 32 32 __syscall_fast_func: 33 33 .long __syscall_slow 34 .size __syscall_fast_func, . - __syscall_fast_func35 34 36 35 .text … … 72 71 */ 73 72 .global __syscall_fast 74 .type __syscall_fast, @function75 76 73 __syscall_fast: 77 74 pushl %ebx … … 98 95 popl %ebx 99 96 ret 100 101 .size __syscall_fast, . - __syscall_fast -
uspace/lib/c/arch/ia32/src/tls.c
r8aa2b3b rb2a081ae 37 37 #include <tls.h> 38 38 #include <sys/types.h> 39 #include <align.h>40 39 41 40 tcb_t * __alloc_tls(void **data, size_t size) … … 49 48 } 50 49 51 //#ifdef __SHARED__52 53 typedef struct {54 unsigned long int ti_module;55 unsigned long int ti_offset;56 } tls_index;57 58 void __attribute__ ((__regparm__ (1)))59 *___tls_get_addr(tls_index *ti);60 61 void __attribute__ ((__regparm__ (1)))62 *___tls_get_addr(tls_index *ti)63 {64 size_t tls_size;65 uint8_t *tls;66 67 /* Calculate size of TLS block */68 tls_size = ALIGN_UP(&_tbss_end - &_tdata_start, &_tls_alignment);69 70 /* The TLS block is just before TCB */71 tls = (uint8_t *)__tcb_get() - tls_size;72 73 return tls + ti->ti_offset;74 }75 76 //#endif77 78 50 /** @} 79 51 */ -
uspace/lib/c/arch/mips32/src/tls.c
r8aa2b3b rb2a081ae 47 47 } 48 48 49 typedef struct {50 unsigned long ti_module;51 unsigned long ti_offset;52 } tls_index;53 54 void *__tls_get_addr(tls_index *ti);55 56 /* mips32 uses TLS variant 1 */57 void *__tls_get_addr(tls_index *ti)58 {59 uint8_t *tls;60 uint32_t v;61 62 tls = (uint8_t *)__tcb_get() + sizeof(tcb_t);63 64 /* Hopefully this is right. No docs found. */65 v = (uint32_t) (tls + ti->ti_offset + 0x8000);66 return (void *) v;67 }68 69 49 /** @} 70 50 */ -
uspace/lib/c/arch/ppc32/src/tls.c
r8aa2b3b rb2a081ae 1 1 /* 2 2 * Copyright (c) 2006 Ondrej Palkovsky 3 * Copyright (c) 2008 Jiri Svoboda4 3 * All rights reserved. 5 4 * … … 35 34 36 35 #include <tls.h> 37 #include <align.h>38 36 #include <sys/types.h> 39 37 … … 48 46 } 49 47 50 static void kputint(unsigned i)51 {52 asm volatile (53 "mr %%r3, %0\n"54 "li %%r9, 32\n"55 "sc\n"56 :57 : "r" (i)58 : "%r3","%r9"59 ) ;60 }61 62 typedef struct {63 unsigned long int ti_module;64 unsigned long int ti_offset;65 } tls_index;66 67 void *__tls_get_addr(tls_index *ti);68 69 /* ppc32 uses TLS variant 1 */70 void *__tls_get_addr(tls_index *ti)71 {72 uint8_t *tls;73 74 /* The TLS section is just after TCB */75 tls = (uint8_t *)__tcb_get() + sizeof(tcb_t);76 77 /* Hopefully this is right. No docs found. */78 return tls + ti->ti_offset + 32768;79 }80 81 48 /** @} 82 49 */ -
uspace/lib/c/generic/libc.c
r8aa2b3b rb2a081ae 53 53 #include "private/io.h" 54 54 55 /* From librtld. */56 #include <rtld.h>57 //#include <string.h>58 59 55 static bool env_setup = false; 60 56 … … 81 77 char **argv; 82 78 83 #ifdef __IN_SHARED_LIBC__84 if (__pcb != NULL && __pcb->rtld_runtime != NULL) {85 runtime_env = (runtime_env_t *) __pcb->rtld_runtime;86 }87 #endif88 79 /* 89 80 * Get command line arguments and initialize -
uspace/lib/c/include/as.h
r8aa2b3b rb2a081ae 56 56 extern void *as_area_create(void *address, size_t size, int flags); 57 57 extern int as_area_resize(void *address, size_t size, int flags); 58 int as_area_change_flags(void *address, int flags);58 extern int as_area_change_flags(void *address, int flags); 59 59 extern int as_area_destroy(void *address); 60 60 extern void *set_maxheapsize(size_t mhs); -
uspace/lib/c/include/loader/pcb.h
r8aa2b3b rb2a081ae 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;76 74 } pcb_t; 77 75 -
uspace/lib/softint/Makefile
r8aa2b3b rb2a081ae 31 31 EXTRA_CFLAGS = -Iinclude 32 32 LIBRARY = libsoftint 33 SLIBRARY = libsoftint.so.0.034 LSONAME = libsoftint.so.035 33 36 34 SOURCES = \ -
uspace/srv/loader/elf_load.c
r8aa2b3b rb2a081ae 103 103 * 104 104 */ 105 int elf_load_file(const char *file_name, size_t so_bias, eld_flags_t flags, 106 elf_info_t *info) 105 int elf_load_file(const char *file_name, size_t so_bias, elf_info_t *info) 107 106 { 108 107 elf_ld_t elf; … … 119 118 elf.fd = fd; 120 119 elf.info = info; 121 elf.flags = flags;122 120 123 121 rc = elf_load(&elf, so_bias); … … 126 124 127 125 return rc; 126 } 127 128 /** Run an ELF executable. 129 * 130 * Transfers control to the entry point of an ELF executable loaded 131 * earlier with elf_load_file(). This function does not return. 132 * 133 * @param info Info structure filled earlier by elf_load_file() 134 * 135 */ 136 void elf_run(elf_info_t *info, pcb_t *pcb) 137 { 138 program_run(info->entry, pcb); 139 140 /* not reached */ 128 141 } 129 142 … … 140 153 pcb->entry = info->entry; 141 154 pcb->dynamic = info->dynamic; 142 pcb->rtld_runtime = NULL;143 155 } 144 156 … … 294 306 break; 295 307 case PT_INTERP: 296 /* Assume silently interp == "/ app/dload" */297 elf->info->interp = "/ app/dload";308 /* Assume silently interp == "/rtld.so" */ 309 elf->info->interp = "/rtld.so"; 298 310 break; 299 311 case PT_DYNAMIC: 300 /* Record pointer to dynamic section into info structure */301 elf->info->dynamic =302 (void *)((uint8_t *)entry->p_vaddr + elf->bias);303 DPRINTF("dynamic section found at 0x%x\n",304 (uintptr_t)elf->info->dynamic);305 break;306 case 0x70000000:307 /* FIXME: MIPS reginfo */308 break;309 312 case PT_SHLIB: 310 //case PT_LOPROC:311 //case PT_HIPROC:313 case PT_LOPROC: 314 case PT_HIPROC: 312 315 default: 313 316 DPRINTF("Segment p_type %d unknown.\n", entry->p_type); … … 380 383 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); 381 384 if (a == (void *)(-1)) { 382 DPRINTF("memory mapping failed (0x%x, %d)\n", 383 base+bias, mem_sz); 385 DPRINTF("Memory mapping failed.\n"); 384 386 return EE_MEMORY; 385 387 } … … 423 425 } 424 426 425 /*426 * The caller wants to modify the segments first. He will then427 * need to set the right access mode and ensure SMC coherence.428 */429 if ((elf->flags & ELDF_RW) != 0) return EE_OK;430 431 // printf("set area flags to %d\n", flags);432 427 rc = as_area_change_flags(seg_ptr, flags); 433 428 if (rc != 0) { -
uspace/srv/loader/include/elf_load.h
r8aa2b3b rb2a081ae 43 43 #include "elf.h" 44 44 45 typedef enum {46 /** Leave all segments in RW access mode. */47 ELDF_RW = 148 } eld_flags_t;49 50 45 /** 51 46 * Some data extracted from the headers are stored here … … 72 67 uintptr_t bias; 73 68 74 /** Flags passed to the ELF loader. */75 eld_flags_t flags;76 77 69 /** A copy of the ELF file header */ 78 70 elf_header_t *header; … … 82 74 } elf_ld_t; 83 75 84 int elf_load_file(const char *file_name, size_t so_bias, el d_flags_t flags,85 elf_info_t *info);76 int elf_load_file(const char *file_name, size_t so_bias, elf_info_t *info); 77 void elf_run(elf_info_t *info, pcb_t *pcb); 86 78 void elf_create_pcb(elf_info_t *info, pcb_t *pcb); 87 79 -
uspace/srv/loader/main.c
r8aa2b3b rb2a081ae 65 65 #define DPRINTF(...) 66 66 67 void program_run(void *entry, pcb_t *pcb);68 69 67 /** Pathname of the file that will be loaded */ 70 68 static char *pathname = NULL; … … 285 283 int rc; 286 284 287 rc = elf_load_file(pathname, 0, 0,&prog_info);285 rc = elf_load_file(pathname, 0, &prog_info); 288 286 if (rc != EE_OK) { 289 287 DPRINTF("Failed to load executable '%s'.\n", pathname); … … 309 307 } 310 308 311 printf("Load ELF interpreter '%s'\n", prog_info.interp); 312 rc = elf_load_file(prog_info.interp, 0, 0, &interp_info); 309 rc = elf_load_file(prog_info.interp, 0, &interp_info); 313 310 if (rc != EE_OK) { 314 311 DPRINTF("Failed to load interpreter '%s.'\n", … … 318 315 } 319 316 320 printf("Run interpreter.\n");321 printf("entry point: 0x%lx\n", (unsigned long) interp_info.entry);322 printf("pcb address: 0x%lx\n", (unsigned long) &pcb);323 printf("prog dynamic: 0x%lx\n", (unsigned long) prog_info.dynamic);324 325 317 is_dyn_linked = true; 326 318 async_answer_0(rid, EOK); … … 351 343 352 344 async_answer_0(rid, EOK); 353 program_run(interp_info.entry, &pcb);345 elf_run(&interp_info, &pcb); 354 346 } else { 355 347 /* Statically linked program */ 356 348 async_answer_0(rid, EOK); 357 program_run(prog_info.entry, &pcb);349 elf_run(&prog_info, &pcb); 358 350 } 359 351
Note:
See TracChangeset
for help on using the changeset viewer.