initcall: Correct use of relocation offset
The relocation offset can change in some initcall sequences. Handle
this and make sure it is used for all debugging statements in
init_run_list()
Update the trace test to match.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
diff --git a/lib/initcall.c b/lib/initcall.c
index c8e2b0f..2686b9a 100644
--- a/lib/initcall.c
+++ b/lib/initcall.c
@@ -49,13 +49,14 @@
*/
int initcall_run_list(const init_fnc_t init_sequence[])
{
- ulong reloc_ofs = calc_reloc_ofs();
+ ulong reloc_ofs;
const init_fnc_t *ptr;
enum event_t type;
init_fnc_t func;
int ret = 0;
for (ptr = init_sequence; func = *ptr, func; ptr++) {
+ reloc_ofs = calc_reloc_ofs();
type = initcall_is_event(func);
if (type) {
@@ -84,7 +85,8 @@
sprintf(buf, "event %d/%s", type,
event_type_name(type));
} else {
- sprintf(buf, "call %p", func);
+ sprintf(buf, "call %p",
+ (char *)func - reloc_ofs);
}
printf("initcall failed at %s (err=%dE)\n", buf, ret);