On 12/03/2018 10:48, Thomas Huth wrote:
>> +obj-$(CONFIG_VTD) += x86-iommu.o intel_iommu.o
>> +obj-$(CONFIG_AMD_IOMMU) += x86-iommu.o amd_iommu.o
> The linker likely does not care if x86-iommu.o is included twice
The linker actually cares, but rules.mak drops the duplicate:
commit e2a99ad3e174ab4c9d2320dcecd779230409829f
Author: Stefan Hajnoczi <[email protected]>
Date: Thu Aug 25 09:18:52 2011 +0100
build: sort objects to remove duplicates for link
Avoid duplicate object files during the link. There are legitimate
cases where a link command-line would include duplicate object files
because two independent subsystems both depend on common
infrastructure.
Use GNU make's $(sort) function to remove duplicate object files
from the link command-line.
Signed-off-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
> , but wouldn't it be clearer to use this instead:
>
> obj-$(call lor,$(CONFIG_VTD),$(CONFIG_AMD_IOMMU)) += x86-iommu.o
Possibly, but it doesn't scale too well when we add a third IOMMU. The
right solution would be something like "select" in Kconfig. Let me know
what you prefer for x86-iommu.c between obj-y and specifying the file
twice, and I'll do it.
Paolo