Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 3f461ecf in mainline


Ignore:
Timestamp:
2011-04-30T13:23:34Z (11 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
a41577e, f798178
Parents:
afdcc60e (diff), 28c4ca7 (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 loader / linker script improvements.

Location:
uspace
Files:
17 deleted
20 edited
9 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    rafdcc60e r3f461ecf  
    4141CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
    4242
     43LINKER_SCRIPTS = \
     44        $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld \
     45        $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld
     46
    4347PRE_DEPEND = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH)
    44 EXTRA_OUTPUT = $(LINKER_SCRIPT)
    45 EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPT)
     48EXTRA_OUTPUT = $(LINKER_SCRIPTS)
     49EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPTS)
    4650LIBRARY = libc
    4751
     
    133137        ln -sfn ../$< $@
    134138
    135 $(LINKER_SCRIPT): $(LINKER_SCRIPT).in
     139$(LIBC_PREFIX)/arch/$(UARCH)/_link.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
    136140        $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@
     141
     142$(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
     143        $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DLOADER -E -x c $< | grep -v "^\#" > $@
    137144
    138145$(COMMON_HEADER_ARCH): $(COMMON_HEADER)
  • uspace/lib/c/arch/abs32le/Makefile.inc

    rafdcc60e r3f461ecf  
    2929ARCH_SOURCES = \
    3030        arch/$(UARCH)/src/entry.c \
     31        arch/$(UARCH)/src/entryjmp.c \
    3132        arch/$(UARCH)/src/thread_entry.c \
    3233        arch/$(UARCH)/src/fibril.c \
  • uspace/lib/c/arch/abs32le/_link.ld.in

    rafdcc60e r3f461ecf  
    33
    44PHDRS {
     5#ifdef LOADER
     6        interp PT_INTERP;
     7        text PT_LOAD FILEHDR PHDRS FLAGS(5);
     8#else
    59        text PT_LOAD FLAGS(5);
     10#endif
    611        data PT_LOAD FLAGS(6);
    712}
    813
    914SECTIONS {
     15#ifdef LOADER
     16        .interp : {
     17                *(.interp);
     18        } :interp
     19       
     20        . = 0x70001000 + SIZEOF_HEADERS;
     21#else
    1022        . = 0x1000 + SIZEOF_HEADERS;
    11        
     23#endif
    1224        .text : {
    1325                *(.text .text.*);
  • uspace/lib/c/arch/abs32le/src/entryjmp.c

    rafdcc60e r3f461ecf  
    3131
    3232#include <bool.h>
    33 #include "arch.h"
     33#include <entry_point.h>
    3434
    35 void program_run(void *entry_point, void *pcb)
     35/** Jump to program entry point. */
     36void entry_point_jmp(void *entry_point, void *pcb)
    3637{
    3738        while (true);
  • uspace/lib/c/arch/amd64/Makefile.inc

    rafdcc60e r3f461ecf  
    2929ARCH_SOURCES = \
    3030        arch/$(UARCH)/src/entry.s \
     31        arch/$(UARCH)/src/entryjmp.s \
    3132        arch/$(UARCH)/src/thread_entry.s \
    3233        arch/$(UARCH)/src/syscall.S \
  • uspace/lib/c/arch/amd64/_link.ld.in

    rafdcc60e r3f461ecf  
    33
    44PHDRS {
     5#ifdef LOADER
     6        interp PT_INTERP;
     7        text PT_LOAD FILEHDR PHDRS FLAGS(5);
     8#else
    59        text PT_LOAD FLAGS(5);
     10#endif
    611        data PT_LOAD FLAGS(6);
    712        debug PT_NOTE;
     
    914
    1015SECTIONS {
     16#ifdef LOADER
     17        .interp : {
     18                *(.interp);
     19        } :interp
     20       
     21        . = 0x70001000 + SIZEOF_HEADERS;
     22#else
    1123        . = 0x1000 + SIZEOF_HEADERS;
    12        
     24#endif
    1325        .init : {
    1426                *(.init);
  • uspace/lib/c/arch/amd64/src/entryjmp.s

    rafdcc60e r3f461ecf  
    2727#
    2828
    29 .globl program_run
     29.globl entry_point_jmp
    3030
    31 ## void program_run(void *entry_point, void *pcb);
     31## void entry_point_jmp(void *entry_point, void *pcb);
    3232#
    3333# %rdi  contains entry_point
    3434# %rsi  contains pcb
    3535#
    36 # Jump to a program entry point
    37 program_run:
     36# Jump to program entry point
     37entry_point_jmp:
    3838        # pcb must be passed in %rdi, use %rdx as a scratch register
    3939        mov %rdi, %rdx
  • uspace/lib/c/arch/arm32/Makefile.inc

    rafdcc60e r3f461ecf  
    3030ARCH_SOURCES = \
    3131        arch/$(UARCH)/src/entry.s \
     32        arch/$(UARCH)/src/entryjmp.s \
    3233        arch/$(UARCH)/src/thread_entry.s \
    3334        arch/$(UARCH)/src/syscall.c \
  • uspace/lib/c/arch/arm32/_link.ld.in

    rafdcc60e r3f461ecf  
    33
    44PHDRS {
     5#ifdef LOADER
     6        interp PT_INTERP;
     7        text PT_LOAD FILEHDR PHDRS FLAGS(5);
     8#else
    59        text PT_LOAD FLAGS(5);
     10#endif
    611        data PT_LOAD FLAGS(6);
    712}
    813
    914SECTIONS {
     15#ifdef LOADER
     16        .interp : {
     17                *(.interp);
     18        } :interp
     19       
     20        . = 0x70001000 + SIZEOF_HEADERS;
     21#else
    1022        . = 0x1000 + SIZEOF_HEADERS;
    11        
     23#endif
    1224        .init : {
    1325                *(.init);
  • uspace/lib/c/arch/arm32/src/entryjmp.s

    rafdcc60e r3f461ecf  
    2727#
    2828
    29 .globl program_run
     29.globl entry_point_jmp
    3030
    31 ## void program_run(void *entry_point, void *pcb);
     31## void entry_point_jmp(void *entry_point, void *pcb);
    3232#
    3333# r0    contains entry_point
    3434# r1    contains pcb
    3535#
    36 # Jump to a program entry point
    37 program_run:
     36# Jump to program entry point
     37entry_point_jmp:
    3838        # load ras_page address to r2
    3939        ldr r2, =ras_page
  • uspace/lib/c/arch/ia32/Makefile.inc

    rafdcc60e r3f461ecf  
    2929ARCH_SOURCES = \
    3030        arch/$(UARCH)/src/entry.s \
     31        arch/$(UARCH)/src/entryjmp.s \
    3132        arch/$(UARCH)/src/thread_entry.s \
    3233        arch/$(UARCH)/src/syscall.S \
  • uspace/lib/c/arch/ia32/_link.ld.in

    rafdcc60e r3f461ecf  
    33
    44PHDRS {
     5#ifdef LOADER
     6        interp PT_INTERP;
     7        text PT_LOAD FILEHDR PHDRS FLAGS(5);
     8#else
    59        text PT_LOAD FLAGS(5);
     10#endif
    611        data PT_LOAD FLAGS(6);
    712        debug PT_NOTE;
     
    914
    1015SECTIONS {
     16#ifdef LOADER
     17        .interp : {
     18                *(.interp);
     19        } :interp
     20
     21        . = 0x70001000 + SIZEOF_HEADERS;
     22#else
    1123        . = 0x1000 + SIZEOF_HEADERS;
    12        
     24#endif
    1325        .init : {
    1426                *(.init);
  • uspace/lib/c/arch/ia32/src/entryjmp.s

    rafdcc60e r3f461ecf  
    2727#
    2828
    29 .globl program_run
     29.globl entry_point_jmp
    3030
    31 ## void program_run(void *entry_point, void *pcb);
     31## void entry_point_jmp(void *entry_point, void *pcb);
    3232#
    33 # Jump to a program entry point
    34 program_run:
     33# Jump to program entry point
     34entry_point_jmp:
    3535        # Use standard ia32 prologue not to confuse anybody
    3636        push %ebp
  • uspace/lib/c/arch/ia64/Makefile.inc

    rafdcc60e r3f461ecf  
    2929ARCH_SOURCES = \
    3030        arch/$(UARCH)/src/entry.s \
     31        arch/$(UARCH)/src/entryjmp.s \
    3132        arch/$(UARCH)/src/thread_entry.s \
    3233        arch/$(UARCH)/src/syscall.S \
  • uspace/lib/c/arch/ia64/_link.ld.in

    rafdcc60e r3f461ecf  
    33
    44PHDRS {
     5#ifdef LOADER
     6        interp PT_INTERP;
    57        text PT_LOAD FLAGS(5);
     8#else
     9        text PT_LOAD FLAGS(5);
     10#endif
    611        data PT_LOAD FLAGS(6);
    712}
    813
    914SECTIONS {
     15#ifdef LOADER
     16        .interp : {
     17                *(.interp);
     18        } :interp
     19       
     20        . = 0x800000000 + SIZEOF_HEADERS;
     21#else
    1022        . = 0x4000 + SIZEOF_HEADERS;
    11        
     23#endif
     24        /*
     25         * XXX This is just a work around. Problem: .init section does not
     26         * have the proper alignment.
     27         */
     28        . = ALIGN(., 16);
     29
    1230        .init : {
    1331                *(.init);
  • uspace/lib/c/arch/ia64/src/entryjmp.s

    rafdcc60e r3f461ecf  
    2828
    2929.text
    30 .globl program_run
     30.globl entry_point_jmp
    3131
    32 ## void program_run(void *entry_point, void *pcb);
     32## void entry_point_jmp(void *entry_point, void *pcb);
    3333#
    3434# in0 (r32)     contains entry_point
    3535# in1 (r33)     contains pcb
    3636#
    37 # Jump to a program entry point
    38 program_run:
     37# Jump to program entry point
     38entry_point_jmp:
    3939        # Pass pcb to the entry point in r2
    4040
  • uspace/lib/c/arch/mips32/Makefile.inc

    rafdcc60e r3f461ecf  
    2929ARCH_SOURCES = \
    3030        arch/$(UARCH)/src/entry.s \
     31        arch/$(UARCH)/src/entryjmp.s \
    3132        arch/$(UARCH)/src/thread_entry.s \
    3233        arch/$(UARCH)/src/syscall.c \
  • uspace/lib/c/arch/mips32/_link.ld.in

    rafdcc60e r3f461ecf  
    33
    44PHDRS {
     5#ifdef LOADER
     6        interp PT_INTERP;
     7        text PT_LOAD FILEHDR PHDRS FLAGS(5);
     8#else
    59        text PT_LOAD FLAGS(5);
     10#endif
    611        data PT_LOAD FLAGS(6);
    712}
    813
    914SECTIONS {
     15#ifdef LOADER
     16        .interp : {
     17                *(.interp);
     18        } :interp
     19       
     20        . = 0x70004000 + SIZEOF_HEADERS;
     21#else
    1022        . = 0x4000 + SIZEOF_HEADERS;
    11        
     23#endif
    1224        .init : {
    1325                *(.init);
  • uspace/lib/c/arch/mips32/src/entryjmp.s

    rafdcc60e r3f461ecf  
    2929.text
    3030.section .text
    31 .global program_run
     31.global entry_point_jmp
    3232.set noreorder
    3333
    34 ## void program_run(void *entry_point, void *pcb);
     34## void entry_point_jmp(void *entry_point, void *pcb);
    3535#
    3636# $a0 (=$4)     contains entry_point
    3737# $a1 (=$5)     contains pcb
    3838#
    39 # Jump to a program entry point
    40 .ent program_run
    41 program_run:
     39# Jump to program entry point
     40.ent entry_point_jmp
     41entry_point_jmp:
    4242        # tmp := entry_point
    4343        move $25, $a0
  • uspace/lib/c/arch/mips32eb/Makefile.inc

    rafdcc60e r3f461ecf  
    2929ARCH_SOURCES = \
    3030        arch/$(UARCH)/src/entry.s \
     31        arch/$(UARCH)/src/entryjmp.s \
    3132        arch/$(UARCH)/src/thread_entry.s \
    3233        arch/$(UARCH)/src/syscall.c \
  • uspace/lib/c/arch/ppc32/Makefile.inc

    rafdcc60e r3f461ecf  
    2929ARCH_SOURCES = \
    3030        arch/$(UARCH)/src/entry.s \
     31        arch/$(UARCH)/src/entryjmp.s \
    3132        arch/$(UARCH)/src/thread_entry.s \
    3233        arch/$(UARCH)/src/syscall.c \
  • uspace/lib/c/arch/ppc32/_link.ld.in

    rafdcc60e r3f461ecf  
    33
    44PHDRS {
     5#ifdef LOADER
     6        interp PT_INTERP;
     7        text PT_LOAD FILEHDR PHDRS FLAGS(5);
     8#else
    59        text PT_LOAD FLAGS(5);
     10#endif
    611        data PT_LOAD FLAGS(6);
    712}
    813
    914SECTIONS {
     15#ifdef LOADER
     16        .itnerp : {
     17                *(.interp);
     18        } :interp
     19       
     20        . = 0x70001000 + SIZEOF_HEADERS;
     21#else
    1022        . = 0x1000 + SIZEOF_HEADERS;
    11        
     23#endif
    1224        .init : {
    1325                *(.init);
  • uspace/lib/c/arch/ppc32/src/entryjmp.s

    rafdcc60e r3f461ecf  
    2727#
    2828
    29 .globl program_run
     29.globl entry_point_jmp
    3030
    31 ## void program_run(void *entry_point, void *pcb);
     31## void entry_point_jmp(void *entry_point, void *pcb);
    3232#
    3333# %r3   contains entry_point
    3434# %r4   contains pcb
    3535#
    36 # Jump to a program entry point
    37 program_run:
     36# Jump to program entry point
     37entry_point_jmp:
    3838        mtctr %r3
    3939        mr %r6, %r4     # Pass pcb to the entry point in %r6
  • uspace/lib/c/arch/sparc64/Makefile.inc

    rafdcc60e r3f461ecf  
    2929ARCH_SOURCES = \
    3030        arch/$(UARCH)/src/entry.s \
     31        arch/$(UARCH)/src/entryjmp.s \
    3132        arch/$(UARCH)/src/thread_entry.s \
    3233        arch/$(UARCH)/src/fibril.S \
  • uspace/lib/c/arch/sparc64/_link.ld.in

    rafdcc60e r3f461ecf  
    33
    44PHDRS {
     5#ifdef LOADER
     6        interp PT_INTERP;
     7        text PT_LOAD FILEHDR PHDRS FLAGS(5);
     8#else
    59        text PT_LOAD FLAGS(5);
     10#endif
    611        data PT_LOAD FLAGS(6);
    712}
    813
    914SECTIONS {
     15#ifdef LOADER
     16        .interp : {
     17                *(.interp);
     18        } :interp
     19       
     20        . = 0x70004000 + SIZEOF_HEADERS;
     21#else
    1022        . = 0x4000 + SIZEOF_HEADERS;
    11        
     23#endif
    1224        .init : {
    1325                *(.init);
  • uspace/lib/c/arch/sparc64/src/entryjmp.s

    rafdcc60e r3f461ecf  
    2727#
    2828
    29 .globl program_run
     29.globl entry_point_jmp
    3030
    31 ## void program_run(void *entry_point, void *pcb);
     31## void entry_point_jmp(void *entry_point, void *pcb);
    3232#
    3333# %o0   contains entry_point
    3434# %o1   contains pcb
    3535#
    36 # Jump to a program entry point
    37 program_run:
     36# Jump to program entry point
     37entry_point_jmp:
    3838        # Pass pcb pointer to entry point in %o1. As it is already
    3939        # there, no action is needed.
  • uspace/lib/c/include/entry_point.h

    rafdcc60e r3f461ecf  
    11/*
    2  * Copyright (c) 2008 Jiri Svoboda
     2 * Copyright (c) 2011 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup fs
     29/** @addtogroup libc
    3030 * @{
    3131 */
    3232/** @file
    33  * @brief
    3433 */
    3534
    36 #ifndef LOADER_ARCH_H_
    37 #define LOADER_ARCH_H_
     35#ifndef LIBC_ENTRY_POINT_H_
     36#define LIBC_ENTRY_POINT_H_
    3837
    39 extern void program_run(void *entry_point, void *pcb);
     38/* Defined in arch/ARCH/src/entryjmp.[c|s] */
     39void entry_point_jmp(void *, void *);
    4040
    4141#endif
    4242
    43 /**
    44  * @}
     43/** @}
    4544 */
  • uspace/srv/loader/Makefile

    rafdcc60e r3f461ecf  
    3636-include $(COMMON_MAKEFILE)
    3737-include $(CONFIG_MAKEFILE)
    38 -include arch/$(UARCH)/Makefile.inc
    3938
    40 LINKER_SCRIPT = arch/$(UARCH)/_link.ld
    41 EXTRA_CLEAN = $(LINKER_SCRIPT)
     39LINKER_SCRIPT = $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld
    4240
    4341EXTRA_CFLAGS = -Iinclude
     
    5553
    5654include $(USPACE_PREFIX)/Makefile.common
    57 
    58 $(LINKER_SCRIPT): $(LINKER_SCRIPT).in
    59         $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
  • uspace/srv/loader/elf_load.c

    rafdcc60e r3f461ecf  
    22 * Copyright (c) 2006 Sergey Bondari
    33 * Copyright (c) 2006 Jakub Jermar
    4  * Copyright (c) 2008 Jiri Svoboda
     4 * Copyright (c) 2011 Jiri Svoboda
    55 * All rights reserved.
    66 *
     
    5353#include <smc.h>
    5454#include <loader/pcb.h>
     55#include <entry_point.h>
    5556
    5657#include "elf.h"
    5758#include "elf_load.h"
    58 #include "arch.h"
    5959
    6060#define DPRINTF(...)
     
    136136void elf_run(elf_info_t *info, pcb_t *pcb)
    137137{
    138         program_run(info->entry, pcb);
     138        entry_point_jmp(info->entry, pcb);
    139139
    140140        /* not reached */
Note: See TracChangeset for help on using the changeset viewer.