summaryrefslogtreecommitdiffstats
path: root/lld/lib
diff options
context:
space:
mode:
authorShankar Easwaran <shankare@codeaurora.org>2013-08-25 18:05:12 +0000
committerShankar Easwaran <shankare@codeaurora.org>2013-08-25 18:05:12 +0000
commitbe81dd757e272fb09fdfb370cdeafdb225c5c2bc (patch)
tree85d28032c8f582fe2bcb251fbe4ed32bf1a5917c /lld/lib
parent12d8089b8e9d4cfafd49eea6305591b52cd22e4e (diff)
downloadbcm5719-llvm-be81dd757e272fb09fdfb370cdeafdb225c5c2bc.tar.gz
bcm5719-llvm-be81dd757e272fb09fdfb370cdeafdb225c5c2bc.zip
[lld][ELF] process fini_array sections
This change processes fini_array section in addition to processing init_array sections. This also makes functions registered at compile time for initialization and finalization to be run during execution llvm-svn: 189196
Diffstat (limited to 'lld/lib')
-rw-r--r--lld/lib/ReaderWriter/ELF/Atoms.h2
-rw-r--r--lld/lib/ReaderWriter/ELF/DefaultLayout.h1
-rw-r--r--lld/lib/ReaderWriter/ELF/File.h4
3 files changed, 6 insertions, 1 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Atoms.h b/lld/lib/ReaderWriter/ELF/Atoms.h
index d995f97f4d0..735297f638b 100644
--- a/lld/lib/ReaderWriter/ELF/Atoms.h
+++ b/lld/lib/ReaderWriter/ELF/Atoms.h
@@ -326,6 +326,7 @@ public:
ret = typeZeroFill;
break;
case llvm::ELF::SHT_INIT_ARRAY:
+ case llvm::ELF::SHT_FINI_ARRAY:
ret = typeData;
break;
}
@@ -432,6 +433,7 @@ public:
return _permissions = permRW_;
case llvm::ELF::SHT_INIT_ARRAY:
+ case llvm::ELF::SHT_FINI_ARRAY:
return _permissions = permRW_;
default:
diff --git a/lld/lib/ReaderWriter/ELF/DefaultLayout.h b/lld/lib/ReaderWriter/ELF/DefaultLayout.h
index c3734061a38..cb18e0ce48b 100644
--- a/lld/lib/ReaderWriter/ELF/DefaultLayout.h
+++ b/lld/lib/ReaderWriter/ELF/DefaultLayout.h
@@ -329,6 +329,7 @@ Layout::SectionOrder DefaultLayout<ELFT>::getSectionOrder(
case DefinedAtom::typeDataFast:
return llvm::StringSwitch<Reference::Kind>(name)
.StartsWith(".init_array", ORDER_INIT_ARRAY)
+ .StartsWith(".fini_array", ORDER_FINI_ARRAY)
.Default(ORDER_DATA);
case DefinedAtom::typeZeroFill:
diff --git a/lld/lib/ReaderWriter/ELF/File.h b/lld/lib/ReaderWriter/ELF/File.h
index 0c2c3b80fe5..33d925067b2 100644
--- a/lld/lib/ReaderWriter/ELF/File.h
+++ b/lld/lib/ReaderWriter/ELF/File.h
@@ -181,7 +181,9 @@ public:
}
// Create a sectionSymbols entry for every progbits section.
- if (section->sh_type == llvm::ELF::SHT_PROGBITS)
+ if ((section->sh_type == llvm::ELF::SHT_PROGBITS) ||
+ (section->sh_type == llvm::ELF::SHT_INIT_ARRAY) ||
+ (section->sh_type == llvm::ELF::SHT_FINI_ARRAY))
_sectionSymbols[section];
if (section->sh_type == llvm::ELF::SHT_RELA) {
OpenPOWER on IntegriCloud