Changeset 20287223 in mainline


Ignore:
Timestamp:
2018-04-10T18:51:14Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ae84e38
Parents:
57d44dd
Message:

Instead of having a special linker script for loader, move its base using a linker command line option.

Location:
uspace
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    r57d44dd r20287223  
    303303ifneq ($(BINARY),)
    304304$(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBTAGS) $(BASE_LIBS)
    305         $(LD) $(LFLAGS) -T $(LINKER_SCRIPT) -Map $@.map -o $@ $(OBJECTS) $(LIBARGS) $(BASE_LIBS)
     305        $(LD) $(LFLAGS) $(EXTRA_LFLAGS) -T $(LINKER_SCRIPT) -Map $@.map -o $@ $(OBJECTS) $(LIBARGS) $(BASE_LIBS)
    306306endif
    307307
    308308ifneq ($(TEST_BINARY),)
    309309$(TEST_BINARY): $(LINKER_SCRIPT) $(TEST_OBJECTS) $(TEST_BINARY_LIBS) $(LIBTAGS) $(BASE_LIBS)
    310         $(LD) $(LFLAGS) -T $(LINKER_SCRIPT) -Map $@.map -o $@ $(TEST_OBJECTS) $(TEST_BINARY_LIBS) $(LIBARGS) $(BASE_LIBS)
     310        $(LD) $(LFLAGS) $(EXTRA_LFLAGS) -T $(LINKER_SCRIPT) -Map $@.map -o $@ $(TEST_OBJECTS) $(TEST_BINARY_LIBS) $(LIBARGS) $(BASE_LIBS)
    311311endif
    312312
     
    325325
    326326$(SLIBRARY): $(LIB_LINKER_SCRIPT) $(LIBRARY).la
    327         $(LD) $(LIB_LFLAGS) -T $(LIB_LINKER_SCRIPT) -Map $@.map -o $@ --whole-archive $(LIBRARY).la --no-whole-archive
     327        $(LD) $(LIB_LFLAGS) $(EXTRA_LFLAGS) -T $(LIB_LINKER_SCRIPT) -Map $@.map -o $@ --whole-archive $(LIBRARY).la --no-whole-archive
    328328
    329329$(LSONAME):
  • uspace/lib/c/Makefile

    r57d44dd r20287223  
    3535LINKER_SCRIPTS = \
    3636        $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld \
    37         $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld \
    3837        $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld \
    3938        $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
     
    204203        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@
    205204
    206 $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
    207         $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DLOADER -E -x c $< | grep -v "^\#" > $@
    208 
    209205$(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
    210206        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DSHLIB -E -x c $< | grep -v "^\#" > $@
  • uspace/lib/c/arch/abs32le/_link.ld.in

    r57d44dd r20287223  
    33
    44PHDRS {
    5 #ifdef LOADER
    6         interp PT_INTERP;
    7 #endif
    85        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    96        data PT_LOAD FLAGS(6);
     
    129
    1310SECTIONS {
    14 #ifdef LOADER
    15         . = SEGMENT_START("text-segment", 0x70400000);
    16 #else
    1711        . = SEGMENT_START("text-segment", 0x400000);
    18 #endif
    1912#ifndef SHLIB
    2013        PROVIDE (__executable_start = .);
     
    2619                *(.rodata .rodata.*);
    2720        } :text
    28 
    29 #ifdef LOADER
    30         .interp : {
    31                 *(.interp);
    32         } :interp :text
    33 #endif
    3421
    3522        . = . + 0x1000;
  • uspace/lib/c/arch/amd64/_link.ld.in

    r57d44dd r20287223  
    33
    44PHDRS {
    5 #ifdef LOADER
    6         interp PT_INTERP;
    7 #endif
    85        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    96        data PT_LOAD FLAGS(6);
     
    1310
    1411SECTIONS {
    15 #ifdef LOADER
    16         . = SEGMENT_START("text-segment", 0x70400000);
    17 #else
    1812        . = SEGMENT_START("text-segment", 0x400000);
    19 #endif
    2013#ifndef SHLIB
    2114        PROVIDE (__executable_start = .);
     
    3124                *(.rodata .rodata.*);
    3225        } :text
    33 
    34 #ifdef LOADER
    35         .interp : {
    36                 *(.interp);
    37         } :interp :text
    38 #endif
    3926
    4027        . = . + 0x1000;
  • uspace/lib/c/arch/arm32/_link.ld.in

    r57d44dd r20287223  
    33
    44PHDRS {
    5 #ifdef LOADER
    6         interp PT_INTERP;
    7 #endif
    85        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    96        data PT_LOAD FLAGS(6);
     
    129
    1310SECTIONS {
    14 #ifdef LOADER
    15         . = SEGMENT_START("text-segment", 0x70400000);
    16 #else
    1711        . = SEGMENT_START("text-segment", 0x400000);
    18 #endif
    1912#ifndef SHLIB
    2013        PROVIDE (__executable_start = .);
     
    3023                *(.rodata .rodata.*);
    3124        } :text
    32 
    33 #ifdef LOADER
    34         .interp : {
    35                 *(.interp);
    36         } :interp :text
    37 #endif
    3825
    3926        . = . + 0x1000;
  • uspace/lib/c/arch/ia32/_link.ld.in

    r57d44dd r20287223  
    55
    66PHDRS {
    7 #if defined(LOADER) || defined(DLEXE)
     7#if defined(DLEXE)
    88        interp PT_INTERP;
    99#endif
     
    1818
    1919SECTIONS {
    20 #ifdef LOADER
    21         . = SEGMENT_START("text-segment", 0x70400000);
    22 #else
    2320        . = SEGMENT_START("text-segment", 0x400000);
    24 #endif
    2521#ifndef SHLIB
    2622        PROVIDE (__executable_start = .);
     
    6662#endif
    6763
    68 #if defined(LOADER) || defined(DLEXE)
     64#if defined(DLEXE)
    6965        .interp : {
    7066                *(.interp);
  • uspace/lib/c/arch/ia64/_link.ld.in

    r57d44dd r20287223  
    33
    44PHDRS {
    5 #ifdef LOADER
    6         interp PT_INTERP;
    7 #endif
    85        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    96        data PT_LOAD FLAGS(6);
     
    129
    1310SECTIONS {
    14 #ifdef LOADER
    15         . = SEGMENT_START("text-segment", 0x8000000000);
    16 #else
    1711        . = SEGMENT_START("text-segment", 0x400000);
    18 #endif
    1912#ifndef SHLIB
    2013        PROVIDE (__executable_start = .);
     
    3326                *(.rodata .rodata.*);
    3427        } :text
    35 
    36 #ifdef LOADER
    37         .interp : {
    38                 *(.interp);
    39         } :interp :text
    40 #endif
    4128
    4229        . = . + 0x4000;
  • uspace/lib/c/arch/mips32/_link.ld.in

    r57d44dd r20287223  
    33
    44PHDRS {
    5 #ifdef LOADER
    6         interp PT_INTERP;
    7 #endif
    85        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    96        data PT_LOAD FLAGS(6);
     
    129
    1310SECTIONS {
    14 #ifdef LOADER
    15         . = SEGMENT_START("text-segment", 0x70400000);
    16 #else
    1711        . = SEGMENT_START("text-segment", 0x400000);
    18 #endif
    1912#ifndef SHLIB
    2013        PROVIDE (__executable_start = .);
     
    3023                *(.rodata .rodata.*);
    3124        } :text
    32 
    33 #ifdef LOADER
    34         .interp : {
    35                 *(.interp);
    36         } :interp :text
    37 #endif
    3825
    3926        . = . + 0x4000;
  • uspace/lib/c/arch/ppc32/_link.ld.in

    r57d44dd r20287223  
    33
    44PHDRS {
    5 #ifdef LOADER
    6         interp PT_INTERP;
    7 #endif
    85        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    96        data PT_LOAD FLAGS(6);
     
    1310
    1411SECTIONS {
    15 #ifdef LOADER
    16         . = SEGMENT_START("text-segment", 0x70400000);
    17 #else
    1812        . = SEGMENT_START("text-segment", 0x400000);
    19 #endif
    2013#ifndef SHLIB
    2114        PROVIDE (__executable_start = .);
     
    3124                *(.rodata .rodata.*);
    3225        } :text
    33 
    34 #ifdef LOADER
    35         .interp : {
    36                 *(.interp);
    37         } :interp :text
    38 #endif
    3926
    4027        . = . + 0x1000;
  • uspace/lib/c/arch/riscv64/_link.ld.in

    r57d44dd r20287223  
    33
    44PHDRS {
    5 #ifdef LOADER
    6         interp PT_INTERP;
    7 #endif
    85        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    96        data PT_LOAD FLAGS(6);
     
    1310
    1411SECTIONS {
    15 #ifdef LOADER
    16         . = SEGMENT_START("text-segment", 0x70400000);
    17 #else
    1812        . = SEGMENT_START("text-segment", 0x400000);
    19 #endif
    2013#ifndef SHLIB
    2114        PROVIDE (__executable_start = .);
     
    2821                *(.srodata .srodata.*);
    2922        } :text
    30 
    31 #ifdef LOADER
    32         .interp : {
    33                 *(.interp);
    34         } :interp :text
    35 #endif
    3623
    3724        . = . + 0x1000;
  • uspace/lib/c/arch/sparc64/_link.ld.in

    r57d44dd r20287223  
    33
    44PHDRS {
    5 #ifdef LOADER
    6         interp PT_INTERP;
    7 #endif
    85        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    96        data PT_LOAD FLAGS(6);
     
    1310
    1411SECTIONS {
    15 #ifdef LOADER
    16         . = SEGMENT_START("text-segment", 0x70400000);
    17 #else
    1812        . = SEGMENT_START("text-segment", 0x400000);
    19 #endif
    2013#ifndef SHLIB
    2114        PROVIDE (__executable_start = .);
     
    3124                *(.rodata .rodata.*);
    3225        } :text
    33 
    34 #ifdef LOADER
    35         .interp : {
    36                 *(.interp);
    37         } :interp :text
    38 #endif
    3926
    4027        . = . + 0x4000;
  • uspace/srv/loader/Makefile

    r57d44dd r20287223  
    3030USPACE_PREFIX = ../..
    3131
    32 LINKER_SCRIPT = $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld
     32EXTRA_LFLAGS = -Ttext-segment=0x70000000
    3333
    3434BINARY = loader
Note: See TracChangeset for help on using the changeset viewer.