Re: [GIT PULL] Kbuild updates for v5.4-rc1

From: Masahiro Yamada
Date: Thu Sep 19 2019 - 23:39:40 EST


Hi Linus,

On Wed, Sep 18, 2019 at 3:48 AM Jessica Yu <jeyu@xxxxxxxxxx> wrote:
>
> +++ Will Deacon [17/09/19 19:16 +0100]:
> >Hi Jessica,
> >
> >On Tue, Sep 17, 2019 at 08:01:36PM +0200, Jessica Yu wrote:
> >> Yikes, I did not catch Stephen Rothwell's email about pausing the
> >> linux-next releases from Sept 5 until Sept 30
> >> (https://lore.kernel.org/linux-next/20190904233443.3f73c46b@xxxxxxxxxxxxxxxx/).
> >>
> >> The modules-next namespace patches have been in since last Tuesday,
> >> and my original plan was for them to catch at least a week of
> >> linux-next time before sending the pull request. :-/ But that did not
> >> happen due to the above.
> >>
> >> So Linus, in light of the above realization, I'd say at this time - I
> >> will still formally send a pull request with the merge conflicts
> >> resolved with either solution #2 or #3, but merge at your own
> >> discretion, it's fine to delay to the following release if you're
> >> uncomfortable.
> >
> >FWIW, when I've run into unexpected merge conflicts with other trees in the
> >past, I've found that it's usually sufficient just to include the resolution
> >as an inline diff in the pull request, rather than try to munge the tree
> >with merges or rebases. Linus is pretty good at figuring it out, and with a
> >resolution to compare with, the damage is limited. The downside of the merge
> >is that it's fiddly to extract the changes and see what's actually being
> >pulled.
> >
> >Also, it's not like the kbuild stuff has been in -next for ages, so this
> >would've been a late and messy conflict regardless.
>
> Hi Will!
>
> Thanks a lot for the advice :-) The inline diff sounds like a good
> idea. This is I believe only the second tree conflict I've encountered
> so far so the tips are much appreciated.
>
> Jessica


How should we handle this?

If you pull this against the latest of your tree,
you will end up with manual merge for the following files:

scripts/link-vmlinux.sh
drivers/gpu/drm/amd/display/dc/calcs/Makefile
drivers/gpu/drm/amd/display/dc/dml/Makefile
drivers/gpu/drm/amd/display/dc/dsc/Makefile


They are solved in linux-next,
but I also double-checked it just in case.

I think the next-20190917 is correct,
but I noticed two things:


[1] linux-next modified the hashbang of scripts/link-vmlinux.sh
(/bin/sh -> /bin/bash), but this change is unneeded

[2] I fixed up drivers/gpu/drm/amd/display/dc/dcn21/Makefile too.
This is a non-obvious conflict, and not available in linux-next.
I caught it in my build testing.


I solved the merge conflicts by myself,
and I attached the diff file. (merge-diff.txt)


If you do not want to cope with those merge conflicts at all,
I will drop the three commits (8959e39272 54b8ae66ae 69a94abb82),
and I will re-send a pull request, which you will be able to pull cleanly.
I will rebase the offending 3 commits on top of your tree later.


Which do you prefer?
Please let me know your thought.

Thanks.


--
Best Regards
Masahiro Yamada
commit a3268b9f3811d651d99c474b628bd30eb2eead7b
Merge: 574cc4539762 77564a4829ef
Author: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
Date: Fri Sep 20 11:43:11 2019 +0900

Merge tag 'kbuild-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild into merge-test

Kbuild updates for v5.4

- add modpost warn exported symbols marked as 'static' because 'static'
and EXPORT_SYMBOL is an odd combination

- break the build early if gold linker is used

- optimize the Bison rule to produce .c and .h files by a single
pattern rule

- handle PREEMPT_RT in the module vermagic and UTS_VERSION

- warn CONFIG options leaked to the user-space except existing ones

- make single targets work properly

- rebuild modules when module linker scripts are updated

- split the module final link stage into scripts/Makefile.modfinal

- fix the missed error code in merge_config.sh

- improve the error message displayed on the attempt of the O= build
in unclean source tree

- remove 'clean-dirs' syntax

- disable -Wimplicit-fallthrough warning for Clang

- add CONFIG_CC_OPTIMIZE_FOR_SIZE_O3 for ARC

- remove ARCH_{CPP,A,C}FLAGS variables

- add $(BASH) to run bash scripts

- change *CFLAGS_<basetarget>.o to take the relative path to $(obj)
instead of the basename

- stop suppressing Clang's -Wunused-function warnings when W=1

- fix linux/export.h to avoid genksyms calculating CRC of trimmed
exported symbols

- misc cleanups

diff --cc arch/ia64/Kconfig
index 9711cf730929,3dead116a6d7..685a3df126ca
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@@ -10,15 -10,14 +10,16 @@@ config IA6
bool
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_MIGHT_HAVE_PC_SERIO
- select ACPI if (!IA64_HP_SIM)
- select ARCH_SUPPORTS_ACPI if (!IA64_HP_SIM)
+ select ACPI
+ select ACPI_NUMA if NUMA
+ select ARCH_SUPPORTS_ACPI
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
- select FORCE_PCI if (!IA64_HP_SIM)
+ select FORCE_PCI
select PCI_DOMAINS if PCI
+ select PCI_MSI
select PCI_SYSCALL if PCI
+ select HAVE_ASM_MODVERSIONS
select HAVE_UNSTABLE_SCHED_CLOCK
select HAVE_EXIT_THREAD
select HAVE_IDE
diff --cc arch/riscv/Makefile
index 4f0a3d2018d2,426d989125a8..f5e914210245
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@@ -52,11 -52,8 +52,11 @@@ ifeq ($(CONFIG_CMODEL_MEDANY),y
KBUILD_CFLAGS += -mcmodel=medany
endif
ifeq ($(CONFIG_MODULE_SECTIONS),y)
- KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/riscv/kernel/module.lds
+ KBUILD_LDS_MODULE += $(srctree)/arch/riscv/kernel/module.lds
endif
+ifeq ($(CONFIG_PERF_EVENTS),y)
+ KBUILD_CFLAGS += -fno-omit-frame-pointer
+endif

KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax)

diff --cc drivers/gpu/drm/amd/display/dc/calcs/Makefile
index 16614d73a5fc,d930df63772c..985633c08a26
--- a/drivers/gpu/drm/amd/display/dc/calcs/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
@@@ -32,13 -32,9 +32,13 @@@ endi

calcs_ccflags := -mhard-float -msse $(cc_stack_align)

+ifdef CONFIG_CC_IS_CLANG
+calcs_ccflags += -msse2
+endif
+
- CFLAGS_dcn_calcs.o := $(calcs_ccflags)
- CFLAGS_dcn_calc_auto.o := $(calcs_ccflags)
- CFLAGS_dcn_calc_math.o := $(calcs_ccflags) -Wno-tautological-compare
+ CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calcs.o := $(calcs_ccflags)
+ CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calc_auto.o := $(calcs_ccflags)
+ CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calc_math.o := $(calcs_ccflags) -Wno-tautological-compare

BW_CALCS = dce_calcs.o bw_fixed.o custom_float.o

diff --cc drivers/gpu/drm/amd/display/dc/dcn20/Makefile
index f57a3b281408,83635ad9124e..2b399cfa72e6
--- a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
@@@ -16,12 -16,8 +16,12 @@@ else ifneq ($(call cc-option, -mstack-a
cc_stack_align := -mstack-alignment=16
endif

- CFLAGS_dcn20_resource.o := -mhard-float -msse $(cc_stack_align)
+ CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse $(cc_stack_align)

+ifdef CONFIG_CC_IS_CLANG
+CFLAGS_dcn20_resource.o += -msse2
+endif
+
AMD_DAL_DCN20 = $(addprefix $(AMDDALPATH)/dc/dcn20/,$(DCN20))

AMD_DISPLAY_FILES += $(AMD_DAL_DCN20)
diff --cc drivers/gpu/drm/amd/display/dc/dcn21/Makefile
index b2b39090fb57,000000000000..8cd9de8b1a7a
mode 100644,000000..100644
--- a/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
@@@ -1,10 -1,0 +1,10 @@@
+#
+# Makefile for DCN21.
+
+DCN21 = dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o
+
- CFLAGS_dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
++CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
+
+AMD_DAL_DCN21 = $(addprefix $(AMDDALPATH)/dc/dcn21/,$(DCN21))
+
+AMD_DISPLAY_FILES += $(AMD_DAL_DCN21)
diff --cc drivers/gpu/drm/amd/display/dc/dml/Makefile
index af2a864a6da0,83792e2c0f0e..5b2a65b42403
--- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
@@@ -32,29 -32,16 +32,26 @@@ endi

dml_ccflags := -mhard-float -msse $(cc_stack_align)

+ifdef CONFIG_CC_IS_CLANG
+dml_ccflags += -msse2
+endif
+
- CFLAGS_display_mode_lib.o := $(dml_ccflags)
+ CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags)

ifdef CONFIG_DRM_AMD_DC_DCN2_0
- CFLAGS_display_mode_vba.o := $(dml_ccflags)
- CFLAGS_display_mode_vba_20.o := $(dml_ccflags)
- CFLAGS_display_rq_dlg_calc_20.o := $(dml_ccflags)
- CFLAGS_display_mode_vba_20v2.o := $(dml_ccflags)
- CFLAGS_display_rq_dlg_calc_20v2.o := $(dml_ccflags)
+ CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_vba.o := $(dml_ccflags)
+ CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20.o := $(dml_ccflags)
+ CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_rq_dlg_calc_20.o := $(dml_ccflags)
++CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20v2.o := $(dml_ccflags)
++CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_rq_dlg_calc_20v2.o := $(dml_ccflags)
+endif
+ifdef CONFIG_DRM_AMD_DC_DCN2_1
- CFLAGS_display_mode_vba_21.o := $(dml_ccflags)
- CFLAGS_display_rq_dlg_calc_21.o := $(dml_ccflags)
++CFLAGS_$(AMDDALPATH)/dc/dml/dcn21/display_mode_vba_21.o := $(dml_ccflags)
++CFLAGS_$(AMDDALPATH)/dc/dml/dcn21/display_rq_dlg_calc_21.o := $(dml_ccflags)
endif
- ifdef CONFIG_DRM_AMD_DCN3AG
- CFLAGS_display_mode_vba_3ag.o := $(dml_ccflags)
- endif
- CFLAGS_dml1_display_rq_dlg_calc.o := $(dml_ccflags)
- CFLAGS_display_rq_dlg_helpers.o := $(dml_ccflags)
- CFLAGS_dml_common_defs.o := $(dml_ccflags)
+ CFLAGS_$(AMDDALPATH)/dc/dml/dml1_display_rq_dlg_calc.o := $(dml_ccflags)
+ CFLAGS_$(AMDDALPATH)/dc/dml/display_rq_dlg_helpers.o := $(dml_ccflags)
+ CFLAGS_$(AMDDALPATH)/dc/dml/dml_common_defs.o := $(dml_ccflags)

DML = display_mode_lib.o display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o \
dml_common_defs.o
diff --cc drivers/gpu/drm/amd/display/dc/dsc/Makefile
index 17db603f2d1f,c3922d6e7696..b456cd23c6fa
--- a/drivers/gpu/drm/amd/display/dc/dsc/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
@@@ -9,14 -9,9 +9,13 @@@ endi

dsc_ccflags := -mhard-float -msse $(cc_stack_align)

+ifdef CONFIG_CC_IS_CLANG
+dsc_ccflags += -msse2
+endif
+
- CFLAGS_rc_calc.o := $(dsc_ccflags)
- CFLAGS_rc_calc_dpi.o := $(dsc_ccflags)
- CFLAGS_codec_main_amd.o := $(dsc_ccflags)
- CFLAGS_dc_dsc.o := $(dsc_ccflags)
+ CFLAGS_$(AMDDALPATH)/dc/dsc/rc_calc.o := $(dsc_ccflags)
+ CFLAGS_$(AMDDALPATH)/dc/dsc/rc_calc_dpi.o := $(dsc_ccflags)
+ CFLAGS_$(AMDDALPATH)/dc/dsc/dc_dsc.o := $(dsc_ccflags)

DSC = dc_dsc.o rc_calc.o rc_calc_dpi.o

diff --cc scripts/link-vmlinux.sh
index 8c59970a09dc,2438a9faf3f1..fc656ce5e594
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@@ -56,17 -56,14 +56,18 @@@ modpost_link(
}

# Link of vmlinux
-# ${1} - optional extra .o files
-# ${2} - output file
+# ${1} - output file
+# ${2}, ${3}, ... - optional extra .o files
vmlinux_link()
{
- info LD ${2}
++ info LD ${1}
local lds="${objtree}/${KBUILD_LDS}"
+ local output=${1}
local objects

+ # skip output file argument
+ shift
+
if [ "${SRCARCH}" != "um" ]; then
objects="--whole-archive \
${KBUILD_VMLINUX_OBJS} \
@@@ -157,6 -139,18 +158,18 @@@ kallsyms(
${CC} ${aflags} -c -o ${2} ${afile}
}

+ # Perform one step in kallsyms generation, including temporary linking of
+ # vmlinux.
+ kallsyms_step()
+ {
+ kallsymso_prev=${kallsymso}
+ kallsymso=.tmp_kallsyms${1}.o
+ kallsyms_vmlinux=.tmp_vmlinux${1}
+
- vmlinux_link "${kallsymso_prev}" ${kallsyms_vmlinux}
++ vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o}
+ kallsyms ${kallsyms_vmlinux} ${kallsymso}
+ }
+
# Create map file with all symbols from ${1}
# See mksymap for additional details
mksysmap()
@@@ -235,14 -228,8 +248,15 @@@ ${MAKE} -f "${srctree}/scripts/Makefile
info MODINFO modules.builtin.modinfo
${OBJCOPY} -j .modinfo -O binary vmlinux.o modules.builtin.modinfo

+btf_vmlinux_bin_o=""
+if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
+ if gen_btf .tmp_vmlinux.btf .btf.vmlinux.bin.o ; then
+ btf_vmlinux_bin_o=.btf.vmlinux.bin.o
+ fi
+fi
+
kallsymso=""
+ kallsymso_prev=""
kallsyms_vmlinux=""
if [ -n "${CONFIG_KALLSYMS}" ]; then

@@@ -293,8 -268,11 +295,7 @@@
fi
fi

- info LD vmlinux
-vmlinux_link "${kallsymso}" vmlinux
-
-if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
- gen_btf vmlinux
-fi
+vmlinux_link vmlinux "${kallsymso}" "${btf_vmlinux_bin_o}"

if [ -n "${CONFIG_BUILDTIME_EXTABLE_SORT}" ]; then
info SORTEX vmlinux