[PATCH] D13104: Mips - Mark the section .eh_frame as writeable for pic

Logan Chien via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 18:16:12 PDT 2015


logan added a comment.

In http://reviews.llvm.org/D13104#251958, @dsanders wrote:

> It was Android that asked us to get read-only .eh_frame working properly for Mips so I might have two opposing requests from the same project.


Hi @dsanders,

I guess that you got this impression due to http://reviews.llvm.org/rL209907.  I remembered that when I was writing that patch, some (old) versions of Android libc can't relocate the read only sections properly[1].  As a result, we have use DW_EH_PE_indirect to avoid dynamic relocations in .eh_frame sections (like what gcc did.)  I was only testing `clang+ld.bfd` and `clang+ld.gold` at the time.

If I read this change correctly, it seems that it is trying to workaround another issue.  For unknown reasons, the compiler is generating some ABS relocations.  `ld.bfd` and `ld.gold` will statically relocate these symbols.  However, `ld.mcld` will leave them unchanged and result in the warnings or `dlopen()` failures on MIPS64.  This change goes **a step further** simply by marking this section as writable.  I think this will work but suboptimal.

Logan

[1] IIRC, it was Android 3.1 or 4.0.  BTW, the newer Android libc (>4.1?) fixed the issue so that some relocation can be applied to read only sections; however, it is discouraged to have dynamic relocations on read only sections because higher memory usage.


Repository:
  rL LLVM

http://reviews.llvm.org/D13104





More information about the llvm-commits mailing list