mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-12-07 20:54:50 +00:00
Kbuild conventionally uses $(obj)/ for generated files, and $(src)/ for
checked-in source files. It is merely a convention without any functional
difference. In fact, $(obj) and $(src) are exactly the same, as defined
in scripts/Makefile.build:
src := $(obj)
When the kernel is built in a separate output directory, $(src) does
not accurately reflect the source directory location. While Kbuild
resolves this discrepancy by specifying VPATH=$(srctree) to search for
source files, it does not cover all cases. For example, when adding a
header search path for local headers, -I$(srctree)/$(src) is typically
passed to the compiler.
This introduces inconsistency between upstream and downstream Makefiles
because $(src) is used instead of $(srctree)/$(src) for the latter.
To address this inconsistency, this commit changes the semantics of
$(src) so that it always points to the directory in the source tree.
Going forward, the variables used in Makefiles will have the following
meanings:
$(obj) - directory in the object tree
$(src) - directory in the source tree (changed by this commit)
$(objtree) - the top of the kernel object tree
$(srctree) - the top of the kernel source tree
Consequently, $(srctree)/$(src) in upstream Makefiles need to be replaced
with $(src).
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
49 lines
1.5 KiB
Makefile
49 lines
1.5 KiB
Makefile
# List of files in the vdso, has to be asm only for now
|
|
|
|
obj-vdso32 = note.o sigtramp.o restart_syscall.o
|
|
|
|
# Build rules
|
|
|
|
targets := $(obj-vdso32) vdso32.so
|
|
obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
|
|
|
|
ccflags-y := -shared -fno-common -fbuiltin -mno-fast-indirect-calls -O2 -mno-long-calls
|
|
# -march=1.1 -mschedule=7100LC
|
|
ccflags-y += -nostdlib -Wl,-soname=linux-vdso32.so.1 \
|
|
$(call ld-option, -Wl$(comma)--hash-style=sysv)
|
|
asflags-y := -D__VDSO32__ -s
|
|
|
|
KBUILD_AFLAGS += -DBUILD_VDSO
|
|
KBUILD_CFLAGS += -DBUILD_VDSO -DDISABLE_BRANCH_PROFILING
|
|
|
|
VDSO_LIBGCC := $(shell $(CROSS32CC) -print-libgcc-file-name)
|
|
|
|
obj-y += vdso32_wrapper.o
|
|
extra-y += vdso32.lds
|
|
CPPFLAGS_vdso32.lds += -P -C # -U$(ARCH)
|
|
|
|
$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so FORCE
|
|
|
|
# Force dependency (incbin is bad)
|
|
# link rule for the .so file, .lds has to be first
|
|
$(obj)/vdso32.so: $(obj)/vdso32.lds $(obj-vdso32) $(VDSO_LIBGCC) FORCE
|
|
$(call if_changed,vdso32ld)
|
|
|
|
# assembly rules for the .S files
|
|
$(obj-vdso32): %.o: %.S FORCE
|
|
$(call if_changed_dep,vdso32as)
|
|
|
|
# actual build commands
|
|
quiet_cmd_vdso32ld = VDSO32L $@
|
|
cmd_vdso32ld = $(CROSS32CC) $(c_flags) -Wl,-T $(filter-out FORCE, $^) -o $@
|
|
quiet_cmd_vdso32as = VDSO32A $@
|
|
cmd_vdso32as = $(CROSS32CC) $(a_flags) -c -o $@ $<
|
|
|
|
# Generate VDSO offsets using helper script
|
|
gen-vdsosym := $(src)/gen_vdso_offsets.sh
|
|
quiet_cmd_vdsosym = VDSOSYM $@
|
|
cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
|
|
|
|
include/generated/vdso32-offsets.h: $(obj)/vdso32.so FORCE
|
|
$(call if_changed,vdsosym)
|