csu: Reformat Makefile.

Reflow and sort Makefile.

Code generation changes present due to link order changes.

No regressions on x86_64 and i686.
This commit is contained in:
Carlos O'Donell 2023-06-06 08:27:20 -04:00
parent 06e51f4d6d
commit d88fcccb1a

View File

@ -26,20 +26,36 @@ subdir := csu
include ../Makeconfig include ../Makeconfig
routines = init-first libc-start $(libc-init) sysdep version check_fds \ routines = \
libc-tls dso_handle $(libc-init) \
check_fds \
dso_handle \
init-first \
libc-start \
libc-tls \
sysdep \
version \
# routines
aux = errno aux = errno
elide-routines.os = libc-tls elide-routines.os = libc-tls
csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o) csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o)
extra-objs = start.o \ extra-objs = \
$(start-installed-name) g$(start-installed-name) $(csu-dummies) \ $(csu-dummies) \
S$(start-installed-name) $(start-installed-name) \
S$(start-installed-name) \
g$(start-installed-name) \
start.o \
# extra-objs
omit-deps = $(patsubst %.o,%,$(start-installed-name) g$(start-installed-name) \ omit-deps = $(patsubst %.o,%,$(start-installed-name) g$(start-installed-name) \
b$(start-installed-name) $(csu-dummies) \ b$(start-installed-name) $(csu-dummies) \
S$(start-installed-name) \ S$(start-installed-name) \
r$(start-installed-name) \ r$(start-installed-name) \
gr$(start-installed-name)) gr$(start-installed-name))
install-lib = $(start-installed-name) g$(start-installed-name) $(csu-dummies) install-lib = \
$(csu-dummies) \
$(start-installed-name) \
g$(start-installed-name) \
# install-lib
# No tests are allowed in the csu/ subdirectory because the startup # No tests are allowed in the csu/ subdirectory because the startup
# code is compiled with special flags. # code is compiled with special flags.
@ -67,7 +83,10 @@ CFLAGS-.os += $(call elide-stack-protector,.os,$(filter-out \
$(routines) $(extra-no-ssp))) $(routines) $(extra-no-ssp)))
ifeq (yes,$(build-shared)) ifeq (yes,$(build-shared))
extra-objs += S$(start-installed-name) gmon-start.os extra-objs += \
S$(start-installed-name) \
gmon-start.os \
# extra-objs
ifneq ($(start-installed-name),$(static-start-installed-name)) ifneq ($(start-installed-name),$(static-start-installed-name))
extra-objs += gmon-start.o extra-objs += gmon-start.o
endif endif
@ -78,20 +97,38 @@ extra-objs += gmon-start.o
endif endif
ifeq (yes,$(enable-static-pie)) ifeq (yes,$(enable-static-pie))
extra-objs += r$(start-installed-name) gr$(start-installed-name) extra-objs += \
install-lib += r$(start-installed-name) gr$(start-installed-name) gr$(start-installed-name) \
r$(start-installed-name) \
# extra-objs
install-lib += \
gr$(start-installed-name) \
r$(start-installed-name) \
# install-lib
endif endif
ifneq ($(start-installed-name),$(static-start-installed-name)) ifneq ($(start-installed-name),$(static-start-installed-name))
extra-objs += $(static-start-installed-name) g$(static-start-installed-name) extra-objs += \
$(static-start-installed-name) \
g$(static-start-installed-name) \
# extra-objs
omit-deps += $(patsubst %.o,%,$(static-start-installed-name) \ omit-deps += $(patsubst %.o,%,$(static-start-installed-name) \
g$(static-start-installed-name)) g$(static-start-installed-name))
install-lib += $(static-start-installed-name) g$(static-start-installed-name) install-lib += \
$(static-start-installed-name) \
g$(static-start-installed-name) \
# install-lib
ifeq (yes,$(enable-static-pie)) ifeq (yes,$(enable-static-pie))
extra-objs += r$(static-start-installed-name) gr$(static-start-installed-name) extra-objs += \
gr$(static-start-installed-name) \
r$(static-start-installed-name) \
# extra-objs
omit-deps += $(patsubst %.o,%,r$(static-start-installed-name) \ omit-deps += $(patsubst %.o,%,r$(static-start-installed-name) \
gr$(static-start-installed-name)) gr$(static-start-installed-name))
install-lib += r$(static-start-installed-name) gr$(static-start-installed-name) install-lib += \
gr$(static-start-installed-name) \
r$(static-start-installed-name) \
# install-lib
endif endif
endif endif
@ -104,7 +141,10 @@ gen-as-const-headers += rtld-sizes.sym
# These are the special initializer/finalizer files. They are always the # These are the special initializer/finalizer files. They are always the
# first and last file in the link. crti.o ... crtn.o define the global # first and last file in the link. crti.o ... crtn.o define the global
# "functions" _init and _fini to run the .init and .fini sections. # "functions" _init and _fini to run the .init and .fini sections.
crtstuff = crti crtn crtstuff = \
crti \
crtn \
# crtstuff
install-lib += $(crtstuff:=.o) install-lib += $(crtstuff:=.o)
extra-objs += $(crtstuff:=.o) extra-objs += $(crtstuff:=.o)
@ -114,7 +154,11 @@ multilib-extra-objs = $(addprefix $(multidir)/, $(install-lib))
extra-objs += $(multilib-extra-objs) extra-objs += $(multilib-extra-objs)
endif endif
extra-objs += abi-note.o init.o static-reloc.o extra-objs += \
abi-note.o \
init.o \
static-reloc.o \
# extra-objs
ifeq (yes,$(build-shared)) ifeq (yes,$(build-shared))
extra-objs += static-reloc.os extra-objs += static-reloc.os
endif endif