[SeaBIOS] [PATCH v4 2/4] Make rom16.o linkable with lld

Fangrui Song via SeaBIOS posted 4 patches 2 years, 5 months ago
[SeaBIOS] [PATCH v4 2/4] Make rom16.o linkable with lld
Posted by Fangrui Song via SeaBIOS 2 years, 5 months ago
lld requires output section descriptions to be sorted by address.
Just sort the addresses beforehand.

--
Changes v2 -> v3
* Sort sections by finalloc unconditionally

Signed-off-by: Fangrui Song <maskray@google.com>
---
 scripts/layoutrom.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py
index abebf02..fa270ef 100755
--- a/scripts/layoutrom.py
+++ b/scripts/layoutrom.py
@@ -321,6 +321,7 @@ def outXRefs(sections, useseg=0, exportsyms=[], forcedelta=0):
 
 # Write LD script includes for the given sections
 def outSections(sections, useseg=0):
+    sections = sorted(sections, key=lambda x: x.finalloc)
     out = ""
     for section in sections:
         loc = section.finalloc
-- 
2.37.0.144.g8ac04bfd2-goog

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org