summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--linker/ba.c7
-rw-r--r--linker/linker.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/linker/ba.c b/linker/ba.c
index 8534919..db49c4b 100644
--- a/linker/ba.c
+++ b/linker/ba.c
@@ -41,9 +41,16 @@
#define BA_START_ADDR(index) (BA_OFFSET(index) + ba->base)
#define BA_LEN(index) ((1 << BA_ORDER(index)) * ba->min_alloc)
+static unsigned long ba_order(struct ba *ba, unsigned long len);
+
void ba_init(struct ba *ba)
{
int i, index = 0;
+
+ unsigned long max_order = ba_order(ba, ba->size);
+ if (ba->max_order == 0 || ba->max_order > max_order)
+ ba->max_order = max_order;
+
for (i = sizeof(ba->num_entries) * 8 - 1; i >= 0; i--) {
if (ba->num_entries & 1<<i) {
BA_ORDER(index) = i;
diff --git a/linker/linker.c b/linker/linker.c
index 07c7d78..5090b11 100644
--- a/linker/linker.c
+++ b/linker/linker.c
@@ -98,7 +98,7 @@ static struct ba ba_prelink = {
.base = LIBBASE,
.size = LIBLAST - LIBBASE,
.min_alloc = LIBINC,
- .max_order = 128,
+ /* max_order will be determined automatically */
.bitmap = ba_prelink_bitmap,
.num_entries = sizeof(ba_prelink_bitmap)/sizeof(ba_prelink_bitmap[0]),
};