[PATCH] D68094: ELF: Don't merge SHF_LINK_ORDER sections for different output sections in relocatable links.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 18:33:21 PDT 2019


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

LGTM, but let's wait for @peter.smith to take a look in details.

> For Arm, I think that ld -r with a linker script is usually used in the context of a linux kernel module which would discard exception tables.

I agree the -r + linker scripts combination is rare. @grimar also stated "It is perhaps uncommon to use a script with -r, but we faced it in the Linux kernel" in D53864 <https://reviews.llvm.org/D53864>. If we either discard SHF_LINK_ORDER sections or keep their order, we don't need to do more change. Though, I suggest enhancing the test to be prepared for that.



================
Comment at: lld/test/ELF/relocatable-linkorder.s:12
+
+// Test that SHF_LINK_ORDER sections with different linked sections
+// aren't merged.
----------------
An optional suggestion. Recent patches use different comment markers for comments, e.g. `/// ` for comments when `// ` is used for RUN and CHECK lines, or
`## ` for comments when `# ` is used for RUN and CHECK lines.


================
Comment at: lld/test/ELF/relocatable-linkorder.s:27
+// DIFFERENT: foo
+.section foo,"ao", at progbits,.text.f1,unique,1
+.quad 1
----------------
The `llvm-readelf -S` RUN line can be enhanced a bit by changing to `llvm-readelf -x foo %t` to verify that 1 and 2 are in order.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68094/new/

https://reviews.llvm.org/D68094





More information about the llvm-commits mailing list