According to the output from readelf, the .text section should be aligned to
16:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0] (null)            NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        000de300 000300 021d00 00  AX  0   0 16
[...]

This however doesn't seem to be enforced when the relocations are generated.
The following patch tries to address this by making sure the space used for
the relocations it also aligned to the same value as the .text section.

Signed-off-by: Roger Pau Monné <[email protected]>
Reported by: Ed Maste <[email protected]>
---
Cc: Kevin O'Connor <[email protected]>
---
 scripts/layoutrom.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py
index b976fb0..5534a9e 100755
--- a/scripts/layoutrom.py
+++ b/scripts/layoutrom.py
@@ -397,7 +397,7 @@ def writeLinkerScripts(li, out16, out32seg, out32flat):
                     + strRelocs("_reloc_rel", "code32init_start", relrelocs)
                     + strRelocs("_reloc_init", "code32flat_start", initrelocs))
         numrelocs = len(absrelocs + relrelocs + initrelocs)
-        sec32all_start -= numrelocs * 4
+        sec32all_start -= alignpos(numrelocs * 4, li.sec32low_align)
     filesections32flat = getSectionsFileid(li.sections, '32flat')
     out = outXRefs([], exportsyms=li.varlowsyms
                    , forcedelta=li.final_sec32low_start-li.sec32low_start)
-- 
2.5.4 (Apple Git-61)


_______________________________________________
SeaBIOS mailing list
[email protected]
http://www.seabios.org/mailman/listinfo/seabios

Reply via email to