summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/LinkerScript.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index d351eb1fd0c..d94d7a23781 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -2054,18 +2054,20 @@ std::pair<uint32_t, uint32_t> ScriptParser::readMemoryAttributes() {
uint32_t Flags = 0;
uint32_t NotFlags = 0;
bool Invert = false;
- for (char C : next()) {
+
+ for (char C : next().lower()) {
uint32_t Flag = 0;
if (C == '!')
Invert = !Invert;
- else if (tolower(C) == 'w')
+ else if (C == 'w')
Flag = SHF_WRITE;
- else if (tolower(C) == 'x')
+ else if (C == 'x')
Flag = SHF_EXECINSTR;
- else if (tolower(C) == 'a')
+ else if (C == 'a')
Flag = SHF_ALLOC;
- else if (tolower(C) != 'r')
+ else if (C != 'r')
setError("invalid memory region attribute");
+
if (Invert)
NotFlags |= Flag;
else
OpenPOWER on IntegriCloud