Open Quuxplusone opened 7 years ago
Bugzilla Link | PR31091 |
Status | NEW |
Importance | P normal |
Reported by | Peter Smith (smithp352@googlemail.com) |
Reported on | 2016-11-21 08:16:59 -0800 |
Last modified on | 2016-11-28 04:14:58 -0800 |
Version | 3.9 |
Hardware | PC Linux |
CC | compnerd@compnerd.org, emaste@freebsd.org, jroelofs@jroelofs.com, llvm-bugs@lists.llvm.org, mclow.lists@gmail.com, rafael@espindo.la, ruiu@google.com |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
I agree that adding a sentinel is probably beneficial. How easy/hard is it to implement it in LLD?
The two ways I can think of to implement are:
- Hard code it by reserving an extra 8 bytes of space in the Output Section and
writing the sentinel in directly.
- Create a EXIDX_CANTUNWIND .ARM.exidx InputSection that has a link order
dependency on the first InputSection with a higher address than the highest
executable code section. The rest will drop out naturally.
The first option is the simplest and allows an arbitrary address to be used for
the highest address as we are writing the values directly.
The second option is cleaner and would also allow us to generate
EXIDX_CANTUNWIND entries for sections without .ARM.exidx sections. This is done
by Gold and ld.bfd as it makes intentional uses of libunwind to unwind the
stack give better error messages.
It may be more difficult to implement as I'm not sure how easy it is to add an
InputSection with relocations to an existing InputFile.
I lean towards hardcoding it because it's probably easier to understand. I was thinking something like this. What do you think? https://reviews.llvm.org/D26915
I lean towards hardcoding it because it's probably easier to understand. I was thinking something like this. What do you think? https://reviews.llvm.org/D26915
Agreed, I can start work on a patch tomorrow.
I've posted a lld patch to add a sentinel at https://reviews.llvm.org/D26977 this works for standard links, but does not currently work for linker scripts. I'm investigating that right now.