Fix bug in assembler: incorrect alignment of rodata relocation section.
This commit is contained in:
@@ -2671,6 +2671,15 @@ unsigned makereloc (s)
|
|||||||
relrel (&relinfo);
|
relrel (&relinfo);
|
||||||
nbytes += fputrel (&relinfo, stdout);
|
nbytes += fputrel (&relinfo, stdout);
|
||||||
}
|
}
|
||||||
|
return nbytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Align the relocation section to an integral number of words.
|
||||||
|
*/
|
||||||
|
unsigned alignreloc (nbytes)
|
||||||
|
register unsigned nbytes;
|
||||||
|
{
|
||||||
while (nbytes % WORDSZ) {
|
while (nbytes % WORDSZ) {
|
||||||
putchar (0);
|
putchar (0);
|
||||||
nbytes++;
|
nbytes++;
|
||||||
@@ -2809,9 +2818,11 @@ int main (argc, argv)
|
|||||||
pass1 (); /* First pass */
|
pass1 (); /* First pass */
|
||||||
middle (); /* Prepare symbol table */
|
middle (); /* Prepare symbol table */
|
||||||
pass2 (); /* Second pass */
|
pass2 (); /* Second pass */
|
||||||
rtsize = makereloc (STEXT); /* Emit relocation info */
|
rtsize = makereloc (STEXT); /* Emit relocation info: text */
|
||||||
rdsize = makereloc (SDATA);
|
rtsize = alignreloc (rtsize);
|
||||||
rdsize += makereloc (SSTRNG);
|
rdsize = makereloc (SDATA); /* data */
|
||||||
|
rdsize += makereloc (SSTRNG); /* rodata */
|
||||||
|
rdsize = alignreloc (rdsize);
|
||||||
makesymtab (); /* Emit symbol table */
|
makesymtab (); /* Emit symbol table */
|
||||||
makeheader (rtsize, rdsize); /* Write a.out header */
|
makeheader (rtsize, rdsize); /* Write a.out header */
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user