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

Changeset a05ec66 in mainline


Ignore:
Timestamp:
2018-05-25T15:42:06Z (3 years ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
a57fa32
Parents:
774aa332
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-05-25 15:42:06)
git-committer:
GitHub <noreply@…> (2018-05-25 15:42:06)
Message:

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

Even with the *-linux-gnu targets, there is practically nothing Linux-specific
in the linker itself. We get a few GNU program headers this way, but those
can be safely ignored.

Location:
uspace
Files:
1 added
10 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    r774aa332 ra05ec66  
    3535#   DEFS               compiler defines
    3636#   EXTRA_CFLAGS       additional flags to pass to C compiler
    37 #   LINKER_SCRIPT      linker script
    3837#   PRE_DEPEND         targets required for dependency check
    3938#
     
    113112LIBPOSIX_PREFIX = $(LIB_PREFIX)/posix
    114113LIBDLTEST_PREFIX = $(LIB_PREFIX)/dltest
     114
     115STARTUP_OBJECT = $(LIBC_PREFIX)/arch/$(UARCH)/src/entry.o
    115116
    116117AFLAGS = --fatal-warnings
     
    140141BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a $(LIBSOFTINT_PREFIX)/libsoftint.a
    141142
    142 ifeq ($(LINK_DYNAMIC),y)
    143         LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
    144 else
     143ifneq ($(LINK_DYNAMIC),y)
    145144        LDFLAGS += -static
    146         LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
    147 endif
    148 
    149 LIB_LINKER_SCRIPT = $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld
     145endif
    150146
    151147INCLUDES_FLAGS = $(LIBC_INCLUDES_FLAGS)
     
    301297
    302298ifneq ($(BINARY),)
    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)
     299$(BINARY): $(OBJECTS) $(LIBTAGS) $(BASE_LIBS)
     300        $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) -Wl,-Map,$@.map -o $@ $(STARTUP_OBJECT) $(OBJECTS) $(LIBARGS) $(BASE_LIBS)
    305301endif
    306302
    307303ifneq ($(TEST_BINARY),)
    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)
     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)
    310306endif
    311307
     
    323319        $(AR) rc $@ $(LOBJECTS)
    324320
    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
     321$(SLIBRARY): $(LIBRARY).la
     322        $(CC) $(CFLAGS) $(LIB_LDFLAGS) $(EXTRA_LDFLAGS) -Wl,-Map,$@.map -o $@ -Wl,--whole-archive $(LIBRARY).la -Wl,--no-whole-archive
    327323
    328324$(LSONAME):
  • uspace/lib/c/Makefile

    r774aa332 ra05ec66  
    3333CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
    3434
    35 LINKER_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 
    40 PRE_DEPEND =
    41 EXTRA_OUTPUT = $(LINKER_SCRIPTS)
    42 EXTRA_CLEAN = $(LINKER_SCRIPTS)
    4335LIBRARY = libc
    4436SOVERSION = 0.0
     
    190182include $(USPACE_PREFIX)/Makefile.common
    191183
    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 
    201184AUTOCHECK = $(realpath $(ROOT_PATH)/tools/autocheck.awk)
    202185
  • uspace/lib/pcut/Makefile

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

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

    r774aa332 ra05ec66  
    3636
    3737SPECS = gcc.specs
    38 LIBC_LINKER_SCRIPT = $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
    39 LIBC_STARTUP_FILE = $(shell sed -n -e 's/^.*STARTUP(\(.*\)).*$$/\1/p' $(LIBC_LINKER_SCRIPT))
    40 EXPORT_LINKER_SCRIPT = link.ld
     38LIBC_STARTUP_FILE = $(STARTUP_OBJECT)
    4139EXPORT_STARTUP_FILE = crt0.o
    4240
     
    4947        $(LIBRARY).a \
    5048        $(EXPORT_STARTUP_FILE) \
    51         $(EXPORT_LINKER_SCRIPT) \
    5249        $(SPECS)
    5350
     
    5552EXTRA_CLEAN = $(INCLUDE_LIBC)
    5653
    57 EXTRA_OUTPUT = $(SPECS) $(EXPORT_LINKER_SCRIPT) $(EXPORT_STARTUP_FILE)
     54EXTRA_OUTPUT = $(SPECS) $(EXPORT_STARTUP_FILE)
    5855
    5956SOURCES = \
     
    9087
    9188EXPORT_LDFLAGS = \
    92         -L$$(HELENOS_EXPORT_ROOT)/lib \
    93         -T link.ld
     89        -L$$(HELENOS_EXPORT_ROOT)/lib
    9490
    9591EXPORT_LDLIBS = \
     
    111107        echo '$(EXPORT_LDLIBS)' >> $@.new
    112108        mv $@.new $@
    113 
    114 $(EXPORT_LINKER_SCRIPT): $(LIBC_LINKER_SCRIPT)
    115         sed 's/STARTUP(.*)/STARTUP(crt0.o)/' $< > $@
    116109
    117110$(EXPORT_STARTUP_FILE): $(LIBC_STARTUP_FILE)
  • uspace/srv/loader/Makefile

    r774aa332 ra05ec66  
    2929
    3030USPACE_PREFIX = ../..
     31ROOT_PATH = $(USPACE_PREFIX)/..
     32CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
    3133
    32 EXTRA_LDFLAGS = -Wl,-Ttext-segment=0x70000000
     34include $(CONFIG_MAKEFILE)
     35
     36ifeq ($(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
     42else
     43        # On all other architectures, we can simply move the text segment.
     44        EXTRA_LDFLAGS = -Wl,-Ttext-segment=0x70000000
     45endif
    3346
    3447BINARY = loader
Note: See TracChangeset for help on using the changeset viewer.