From d777d86ab2afc03c0a1d98f136e05ef9c64aa5ed Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Thu, 20 Feb 2014 05:10:09 +1100 Subject: CAR_GLOBAL: enforce compiler to check if _start != _end There are some fun rules C compilers can use to optimize their code. One of them is the assumption that two symbols point to two different addresses. In this case this wasn't true, resulting in unintended code execution (and later, a crash) with a clang build. Change-Id: I1496b22e1d1869ed0610e321b6ec6a83252e9d8b Signed-off-by: Patrick Georgi Signed-off-by: Edward O'Callaghan Reviewed-on: http://review.coreboot.org/4719 Tested-by: build bot (Jenkins) --- src/cpu/x86/car.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/cpu') diff --git a/src/cpu/x86/car.c b/src/cpu/x86/car.c index 481153d685..a7e38420a8 100644 --- a/src/cpu/x86/car.c +++ b/src/cpu/x86/car.c @@ -26,7 +26,6 @@ typedef void (* const car_migration_func_t)(void); extern car_migration_func_t _car_migrate_start; -extern car_migration_func_t _car_migrate_end; extern char _car_data_start[]; extern char _car_data_end[]; @@ -98,7 +97,7 @@ void car_migrate_variables(void) /* Call all the migration functions. */ migrate_func = &_car_migrate_start; - while (migrate_func != &_car_migrate_end) { + while (*migrate_func != NULL) { (*migrate_func)(); migrate_func++; } -- cgit v1.2.3