aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-06-14 18:48:19 +0000
committerSam Clegg <sbc@chromium.org>2018-06-14 18:48:19 +0000
commit277f898a4d155cbf79b017f163f7f6671c5acf73 (patch)
tree26748ab4d56e60914066675776c0882f16efa852 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parentb521dc3acfae26cef62f1ab3bfe1c3753c0c9955 (diff)
downloadllvm-277f898a4d155cbf79b017f163f7f6671c5acf73.zip
llvm-277f898a4d155cbf79b017f163f7f6671c5acf73.tar.gz
llvm-277f898a4d155cbf79b017f163f7f6671c5acf73.tar.bz2
[WebAssembly] Ignore explicit section names for functions
WebAssembly doesn't support more than one function per section and we rely on function sections being unique. This change ignores the section provided by the function to avoid two functions being in the same section. Without this change the object writer produces the following error for this test: LLVM ERROR: section already has a defining function: baz Differential Revision: https://reviews.llvm.org/D48178 llvm-svn: 334752
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 0b8d522..b07e2f6 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -1408,6 +1408,12 @@ static SectionKind getWasmKindForNamedSection(StringRef Name, SectionKind K) {
MCSection *TargetLoweringObjectFileWasm::getExplicitSectionGlobal(
const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
+ // We don't support explict section names for functions in the wasm object
+ // format. Each function has to be in its own unique section.
+ if (isa<Function>(GO)) {
+ return SelectSectionForGlobal(GO, Kind, TM);
+ }
+
StringRef Name = GO->getSection();
Kind = getWasmKindForNamedSection(Name, Kind);