diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-12-19 21:21:07 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-12-19 21:21:07 +0000 |
commit | f757accf37faa6ad421cf00522e086f084c5d887 (patch) | |
tree | 5bb22d5f0f88bdb03ef6283fd35805e33ae5d42b /lld/ELF/Writer.h | |
parent | ef600f4225eee58ad55b6bba1686fd5dad4b1b2a (diff) |
Fix corner cases of setting the section address.
This handles all the corner cases if setting a section address:
- If the address is too low, we cannot allocate the program headers.
- If the load address is lowered, we have to do that before finalize
This also shares some code with the linker script since it was already
hitting similar cases.
This is used by the freebsd boot loader. It is not clear if we need to
support this with a non binary output, but it is not as bad as I was
expecting.
Diffstat (limited to 'lld/ELF/Writer.h')
-rw-r--r-- | lld/ELF/Writer.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lld/ELF/Writer.h b/lld/ELF/Writer.h index 94d707ff4c5..96dd70b109d 100644 --- a/lld/ELF/Writer.h +++ b/lld/ELF/Writer.h @@ -10,6 +10,7 @@ #ifndef LLD_ELF_WRITER_H #define LLD_ELF_WRITER_H +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include <cstdint> #include <memory> @@ -48,6 +49,9 @@ struct PhdrEntry { llvm::StringRef getOutputSectionName(llvm::StringRef Name); +template <class ELFT> +void allocateHeaders(llvm::MutableArrayRef<PhdrEntry>, + llvm::ArrayRef<OutputSectionBase *>); template <class ELFT> void reportDiscarded(InputSectionBase<ELFT> *IS); template <class ELFT> uint32_t getMipsEFlags(); |