((((unsigned long)addr) + ALLOC_UNIT) & ALLOC_MASK)
/* Note that all sections must be aligned on a 0x1000 boundary so
this is the minimum size that our dummy bss can be. */
+#ifdef BROKEN_GDB
#define BSS_PAD_SIZE 0x1000
+#else
+#define BSS_PAD_SIZE 0
+#endif
/* To prevent zero-initialized variables from being placed into the bss
section, use non-zero values to represent an uninitialized state. */
}
if ((a_new = open (new_name, O_WRONLY | O_TRUNC | O_CREAT | OPEN_BINARY,
- CREAT_MODE)) < 0)
+ 0755)) < 0)
{
PERROR (new_name);
}
lseek (a_new, 0, SEEK_SET);
/* write file header */
f_hdr.f_symptr += file_sz_change;
+#ifndef BROKEN_GDB
+ f_hdr.f_nscns--;
+#endif
printf("writing file header\n");
if (write(a_new, &f_hdr, sizeof(f_hdr)) != sizeof(f_hdr))
{
PERROR("failed to write text header");
}
-
+#ifdef BROKEN_GDB
/* Write small bss section. */
if (!sections_reversed)
{
PERROR("failed to write bss header");
}
}
-
+#endif
/* write new data header */
printf("writing .data header\n");
{
PERROR("failed to write data header");
}
-
+#ifdef BROKEN_GDB
/* Write small bss section. */
if (sections_reversed)
{
PERROR("failed to write bss header");
}
}
-
+#endif
printf("writing following data header\n");
f_nextdata.s_scnptr += file_sz_change;
if (f_nextdata.s_lnnoptr != 0) f_nextdata.s_lnnoptr += file_sz_change;
PERROR("failed to write data header");
}
}
-
+#ifndef BROKEN_GDB
+ /* dump bss to maintain offsets */
+ memset(&f_bss, 0, sizeof(f_bss));
+ if (write(a_new, &f_bss, sizeof(f_bss)) != sizeof(f_bss))
+ {
+ PERROR("failed to write bss header");
+ }
+#endif
size=lseek(a_new, 0, SEEK_CUR);
CHECK_AOUT_POS(size);