[lld] [llvm] [lld-macho] Fix thunks for non-__text TEXT sections (PR #99052)

Leonard Grey via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 13:06:18 PDT 2024


================
@@ -89,9 +90,17 @@ static int sectionOrder(OutputSection *osec) {
   StringRef segname = osec->parent->name;
   // Sections are uniquely identified by their segment + section name.
   if (segname == segment_names::text) {
+    if (osec->name == section_names::header)
+      return -7;
+    if (osec->name == section_names::text)
+      return -6;
+    // Ensure all code sections are contiguous with `__text` for thunk
+    // calculations.
+    if (sections::isCodeSection(osec->name, segment_names::text, osec->flags) &&
+        osec->name != section_names::stubHelper) {
+      return -5;
----------------
speednoisemovement wrote:

Done

https://github.com/llvm/llvm-project/pull/99052


More information about the llvm-commits mailing list