diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2017-11-28 01:30:07 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-11-28 01:30:07 +0000 |
commit | 1621c20ffccd14ec2a2e0fe6510eacd035701d70 (patch) | |
tree | 04d490e4ff994ac321576159ca615cf89495b8b3 /llvm | |
parent | b108dbcc91d1008b9ee9d945298f53434c9a0cb9 (diff) | |
download | bcm5719-llvm-1621c20ffccd14ec2a2e0fe6510eacd035701d70.tar.gz bcm5719-llvm-1621c20ffccd14ec2a2e0fe6510eacd035701d70.zip |
Reland r319090, "COFF: Do not create SectionChunks for discarded comdat sections." with a fix for debug sections.
If /debug was not specified, readSection will return a null
pointer for debug sections. If the debug section is associative with
another section, we need to make sure that the section returned from
readSection is not a null pointer before adding it as an associative
section.
Differential Revision: https://reviews.llvm.org/D40533
llvm-svn: 319133
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/Object/COFF.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/include/llvm/Object/COFF.h b/llvm/include/llvm/Object/COFF.h index 3ad60b05b6f..2fb896eed97 100644 --- a/llvm/include/llvm/Object/COFF.h +++ b/llvm/include/llvm/Object/COFF.h @@ -275,6 +275,8 @@ struct coff_symbol_generic { support::ulittle32_t Value; }; +struct coff_aux_section_definition; + class COFFSymbolRef { public: COFFSymbolRef() = default; @@ -346,6 +348,18 @@ public: return (getType() & 0xF0) >> COFF::SCT_COMPLEX_TYPE_SHIFT; } + template <typename T> const T *getAux() const { + return CS16 ? reinterpret_cast<const T *>(CS16 + 1) + : reinterpret_cast<const T *>(CS32 + 1); + } + + const coff_aux_section_definition *getSectionDefinition() const { + if (!getNumberOfAuxSymbols() || + getStorageClass() != COFF::IMAGE_SYM_CLASS_STATIC) + return nullptr; + return getAux<coff_aux_section_definition>(); + } + bool isAbsolute() const { return getSectionNumber() == -1; } |