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

Changeset fc0b2a8 in mainline


Ignore:
Timestamp:
2018-05-29T21:14:40Z (3 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master
Children:
fda19b8
Parents:
ed88c8e
Message:

Revert "Don't use custom ldscripts in uspace. (#38)"

This reverts commit a05ec6671002c451fceb01aa0ab3f71f004efb6d.

Needs more work.

Location:
uspace
Files:
10 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    red88c8e rfc0b2a8  
    3535#   DEFS               compiler defines
    3636#   EXTRA_CFLAGS       additional flags to pass to C compiler
     37#   LINKER_SCRIPT      linker script
    3738#   PRE_DEPEND         targets required for dependency check
    3839#
     
    112113LIBPOSIX_PREFIX = $(LIB_PREFIX)/posix
    113114LIBDLTEST_PREFIX = $(LIB_PREFIX)/dltest
    114 
    115 STARTUP_OBJECT = $(LIBC_PREFIX)/arch/$(UARCH)/src/entry.o
    116115
    117116AFLAGS = --fatal-warnings
     
    141140BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a $(LIBSOFTINT_PREFIX)/libsoftint.a
    142141
    143 ifneq ($(LINK_DYNAMIC),y)
     142ifeq ($(LINK_DYNAMIC),y)
     143        LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
     144else
    144145        LDFLAGS += -static
    145 endif
     146        LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
     147endif
     148
     149LIB_LINKER_SCRIPT = $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld
    146150
    147151INCLUDES_FLAGS = $(LIBC_INCLUDES_FLAGS)
     
    297301
    298302ifneq ($(BINARY),)
    299 $(BINARY): $(OBJECTS) $(LIBTAGS) $(BASE_LIBS)
    300         $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) -Wl,-Map,$@.map -o $@ $(STARTUP_OBJECT) $(OBJECTS) $(LIBARGS) $(BASE_LIBS)
     303$(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBTAGS) $(BASE_LIBS)
     304        $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) -T $(LINKER_SCRIPT) -Wl,-Map,$@.map -o $@ $(OBJECTS) $(LIBARGS) $(BASE_LIBS)
    301305endif
    302306
    303307ifneq ($(TEST_BINARY),)
    304 $(TEST_BINARY): $(TEST_OBJECTS) $(TEST_BINARY_LIBS) $(LIBTAGS) $(BASE_LIBS)
    305         $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) -Wl,-Map,$@.map -o $@ $(STARTUP_OBJECT) $(TEST_OBJECTS) $(TEST_BINARY_LIBS) $(LIBARGS) $(BASE_LIBS)
     308$(TEST_BINARY): $(LINKER_SCRIPT) $(TEST_OBJECTS) $(TEST_BINARY_LIBS) $(LIBTAGS) $(BASE_LIBS)
     309        $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) -T $(LINKER_SCRIPT) -Wl,-Map,$@.map -o $@ $(TEST_OBJECTS) $(TEST_BINARY_LIBS) $(LIBARGS) $(BASE_LIBS)
    306310endif
    307311
     
    319323        $(AR) rc $@ $(LOBJECTS)
    320324
    321 $(SLIBRARY): $(LIBRARY).la
    322         $(CC) $(CFLAGS) $(LIB_LDFLAGS) $(EXTRA_LDFLAGS) -Wl,-Map,$@.map -o $@ -Wl,--whole-archive $(LIBRARY).la -Wl,--no-whole-archive
     325$(SLIBRARY): $(LIB_LINKER_SCRIPT) $(LIBRARY).la
     326        $(CC) $(CFLAGS) $(LIB_LDFLAGS) $(EXTRA_LDFLAGS) -T $(LIB_LINKER_SCRIPT) -Wl,-Map,$@.map -o $@ -Wl,--whole-archive $(LIBRARY).la -Wl,--no-whole-archive
    323327
    324328$(LSONAME):
  • uspace/lib/c/Makefile

    red88c8e rfc0b2a8  
    3333CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
    3434
     35LINKER_SCRIPTS = \
     36        $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld \
     37        $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld \
     38        $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
     39
     40PRE_DEPEND =
     41EXTRA_OUTPUT = $(LINKER_SCRIPTS)
     42EXTRA_CLEAN = $(LINKER_SCRIPTS)
    3543LIBRARY = libc
    3644SOVERSION = 0.0
     
    182190include $(USPACE_PREFIX)/Makefile.common
    183191
     192$(LIBC_PREFIX)/arch/$(UARCH)/_link.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
     193        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@
     194
     195$(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
     196        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DSHLIB -E -x c $< | grep -v "^\#" > $@
     197
     198$(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
     199        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DDLEXE -E -x c $< | grep -v "^\#" > $@
     200
    184201AUTOCHECK = $(realpath $(ROOT_PATH)/tools/autocheck.awk)
    185202
  • uspace/lib/pcut/Makefile

    red88c8e rfc0b2a8  
    3636
    3737test-libpcut-%: $(LIBRARY).a
    38         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(STARTUP_OBJECT) $^ $(LIBRARY).a $(BASE_LIBS)
     38        $(CC) $(CFLAGS) $(LDFLAGS) -T $(LINKER_SCRIPT) -o $@ $(STARTUP) $^ $(LIBRARY).a $(BASE_LIBS)
    3939
  • uspace/lib/pcut/update-from-master.sh

    red88c8e rfc0b2a8  
    8080
    8181test-libpcut-%: $(LIBRARY).a
    82         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(STARTUP_OBJECT) $^ $(LIBRARY).a $(BASE_LIBS)
     82        $(CC) $(CFLAGS) $(LDFLAGS) -T $(LINKER_SCRIPT) -o $@ $(STARTUP) $^ $(LIBRARY).a $(BASE_LIBS)
    8383
    8484EOF_MAKEFILE_TAIL
  • uspace/lib/posix/Makefile

    red88c8e rfc0b2a8  
    3636
    3737SPECS = gcc.specs
    38 LIBC_STARTUP_FILE = $(STARTUP_OBJECT)
     38LIBC_LINKER_SCRIPT = $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
     39LIBC_STARTUP_FILE = $(shell sed -n -e 's/^.*STARTUP(\(.*\)).*$$/\1/p' $(LIBC_LINKER_SCRIPT))
     40EXPORT_LINKER_SCRIPT = link.ld
    3941EXPORT_STARTUP_FILE = crt0.o
    4042
     
    4749        $(LIBRARY).a \
    4850        $(EXPORT_STARTUP_FILE) \
     51        $(EXPORT_LINKER_SCRIPT) \
    4952        $(SPECS)
    5053
     
    5255EXTRA_CLEAN = $(INCLUDE_LIBC)
    5356
    54 EXTRA_OUTPUT = $(SPECS) $(EXPORT_STARTUP_FILE)
     57EXTRA_OUTPUT = $(SPECS) $(EXPORT_LINKER_SCRIPT) $(EXPORT_STARTUP_FILE)
    5558
    5659SOURCES = \
     
    8790
    8891EXPORT_LDFLAGS = \
    89         -L$$(HELENOS_EXPORT_ROOT)/lib
     92        -L$$(HELENOS_EXPORT_ROOT)/lib \
     93        -T link.ld
    9094
    9195EXPORT_LDLIBS = \
     
    107111        echo '$(EXPORT_LDLIBS)' >> $@.new
    108112        mv $@.new $@
     113
     114$(EXPORT_LINKER_SCRIPT): $(LIBC_LINKER_SCRIPT)
     115        sed 's/STARTUP(.*)/STARTUP(crt0.o)/' $< > $@
    109116
    110117$(EXPORT_STARTUP_FILE): $(LIBC_STARTUP_FILE)
  • uspace/srv/loader/Makefile

    red88c8e rfc0b2a8  
    2929
    3030USPACE_PREFIX = ../..
    31 ROOT_PATH = $(USPACE_PREFIX)/..
    32 CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
    3331
    34 include $(CONFIG_MAKEFILE)
    35 
    36 ifeq ($(UARCH),ia64)
    37         # IA64 has a peculiar linker script with a fixed data segment address.
    38         # Because the loader is a separate nonrelocatable binary in the same
    39         # address space as the application, we provide a modified copy of
    40         # the default linker script to work around that.
    41         EXTRA_LDFLAGS = -T elf64_ia64_loader.x
    42 else
    43         # On all other architectures, we can simply move the text segment.
    44         EXTRA_LDFLAGS = -Wl,-Ttext-segment=0x70000000
    45 endif
     32EXTRA_LDFLAGS = -Wl,-Ttext-segment=0x70000000
    4633
    4734BINARY = loader
Note: See TracChangeset for help on using the changeset viewer.