Patch against http://nasm.cvs.sourceforge.net/*checko ... vision=1.7
Code: Select all
--- outmacho.old 2006-10-06 07:40:58.000000000 +0200
+++ outmacho.c 2006-06-26 06:14:12.000000000 +0300
@@ -539,7 +539,7 @@
s->data = saa_init(1L);
s->index = seg_alloc();
s->relocs = NULL;
- s->align = DEFAULT_SECTION_ALIGNMENT;
+ s->align = -1;
xstrncpy(s->segname, sm->segname);
xstrncpy(s->sectname, sm->sectname);
@@ -579,7 +579,8 @@
}
if ((-1 != originalIndex)
- && (s->align != newAlignment)) {
+ && (s->align != newAlignment)
+ && (s->align != -1)) {
error(ERR_PANIC,
"section \"%s\" has already been specified "
"with alignment %d, conflicts with new "
@@ -889,6 +890,8 @@
fwritelong(offset, machofp);
/* Write out section alignment, as a power of two.
e.g. 32-bit word alignment would be 2 (2^^2 = 4). */
+ if (s->align == -1)
+ s->align = DEFAULT_SECTION_ALIGNMENT;
fwritelong(s->align, machofp);
/* To be compatible with cctools as we emit
a zero reloff if we have no relocations. */
@@ -978,11 +981,10 @@
offset which we already have. The linker takes care
of the rest of the address. */
if (!r->ext) {
- /* add sizes of previous sections to current offset */
- for (s2 = sects, fi = 1;
- s2 != NULL && fi < r->snum; s2 = s2->next, fi++)
- if ((s2->flags & SECTION_TYPE) != S_ZEROFILL)
- l += s2->size;
+ /* add sizes of previous sections to current offset */
+ for (s2 = sects, fi = 1;
+ s2 != NULL && fi < r->snum; s2 = s2->next, fi++)
+ l += s2->size;
}
/* write new offset back */
@@ -1088,6 +1090,7 @@
sym = undefsyms[i];
if (sym->initial_snum == r->snum) {
r->snum = sym->snum;
+ break;
}
}
}
@@ -1257,14 +1260,14 @@
raa_free(extsyms);
if (syms) {
- while (syms->next) {
- sym = syms;
- syms = syms->next;
+ while (syms->next) {
+ sym = syms;
+ syms = syms->next;
- nasm_free (sym);
- }
+ nasm_free (sym);
}
}
+}
/* Debugging routines. */
static void debug_reloc (struct reloc *r)