Ticket #331 (closed defect: fixed)

Opened 6 years ago

Last modified 5 years ago

need working relocate_area_contents() for ia32

Reported by: gb Owned by: gb
Priority: minor Milestone:
Component: Runtime (threads, GC) Version: trunk
Keywords: Cc:

Description

If the image loader can't load an image at its preferred address (presumably because of mmap limitations or something like that), a function named 'relocate_area_contents' is supposed to walk all pointer-bearing areas, adjusting the pointers it finds there by the difference ('bias') between the expected image address and the actual address. I don't know the details, but this doesn't seem to work yet on x8632. (For a long time, it didn't work right on x8664: the code there didn't handle embedded pointers in function objects correctly.)

Change History

comment:1 Changed 6 years ago by rme

There's the following relatively obvious patch:

--- image.c	(revision 10751)
+++ image.c	(working copy)
@@ -58,10 +58,14 @@
     if (immheader_tag_p(fulltag)) {
       start = (LispObj *)skip_over_ivector((natural)start, w0);
     } else {
-#ifdef X8664
+#ifdef X86
       if (header_subtag(w0) == subtag_function) {
+#ifdef X8632
+        int skip = (unsigned short)start[1];
+#else
         int skip = (int) start[1];
-     
+#endif
+
         start += skip;
         if (((LispObj) start) & node_size) {
           --start;

But there's still something wrong.

comment:2 Changed 5 years ago by gb

  • Status changed from new to assigned

Among other things, we're effectively moving a bunch of functions around (or fixing things up to account for the fact that mmap() moved the whole heap around); on x8632, we need to update self-references in every function that didn't get loaded at the same address that it was saved from.

So, it seems that we need to call update_self_references(start) when we find that start is pointing at a function, as well as skipping over the function's code before (re-)entering the general loop.

This seems to work; I'll try to check it in soon.

comment:3 Changed 5 years ago by gb

  • Status changed from assigned to closed
  • Resolution set to fixed

Seems to have been fixed in r11468.

Note: See TracTickets for help on using tickets.