syms-warn-dup-y := --warn-dup
syms-warn-dup-$(CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS) :=
+syms-warn-dup-$(CONFIG_ENFORCE_UNIQUE_SYMBOLS) := --error-dup
$(TARGET): TMP = $(@D)/.$(@F).elf32
$(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
If unsure, say Y.
+config ENFORCE_UNIQUE_SYMBOLS
+ bool "Enforce unique symbols"
+ default y
+ depends on LIVEPATCH
+ ---help---
+ Multiple symbols with the same name aren't generally a problem
+ unless livepatching is to be used.
+
+ Livepatch loading involves resolving relocations against symbol
+ names, and attempting to a duplicate symbol in a livepatch will
+ result in incorrect livepatch application.
+
+ This option should be used to ensure that a build of Xen can have a
+ livepatch build and apply correctly.
+
config SUPPRESS_DUPLICATE_SYMBOL_WARNINGS
- bool "Suppress duplicate symbol warnings" if !LIVEPATCH
- default y if !LIVEPATCH
+ bool "Suppress duplicate symbol warnings" if !ENFORCE_UNIQUE_SYMBOLS
+ default y if !ENFORCE_UNIQUE_SYMBOLS
---help---
Multiple symbols with the same name aren't generally a problem
unless Live patching is to be used, so these warnings can be
int main(int argc, char **argv)
{
unsigned int i;
- bool unsorted = false, warn_dup = false;
+ bool unsorted = false, warn_dup = false, error_dup = false, found_dup = false;
if (argc >= 2) {
for (i = 1; i < argc; i++) {
sort_by_name = 1;
else if (strcmp(argv[i], "--warn-dup") == 0)
warn_dup = true;
+ else if (strcmp(argv[i], "--error-dup") == 0)
+ warn_dup = error_dup = true;
else if (strcmp(argv[i], "--xensyms") == 0)
map_only = true;
else
for (i = 1; i < table_cnt; ++i)
if (strcmp(SYMBOL_NAME(table + i - 1),
SYMBOL_NAME(table + i)) == 0 &&
- table[i - 1].addr != table[i].addr)
+ table[i - 1].addr != table[i].addr) {
fprintf(stderr,
"Duplicate symbol '%s' (%llx != %llx)\n",
SYMBOL_NAME(table + i),
table[i].addr, table[i - 1].addr);
+ found_dup = true;
+ }
unsorted = true;
}
+ if (error_dup && found_dup)
+ exit(1);
+
if (unsorted)
qsort(table, table_cnt, sizeof(*table), compare_value);