Thanks!<br><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 6, 2018, 11:26 PM Hans Wennborg <<a href="mailto:hans@chromium.org">hans@chromium.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Merged to 7.0 in r339099.<br>
<br>
On Sun, Aug 5, 2018 at 4:23 PM, Eric Christopher via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Author: echristo<br>
> Date: Sun Aug 5 07:23:37 2018<br>
> New Revision: 338968<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=338968&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=338968&view=rev</a><br>
> Log:<br>
> Revert "Add a warning if someone attempts to add extra section flags to sections"<br>
><br>
> There are a bunch of edge cases and inconsistencies in how we're emitting sections<br>
> cause this warning to fire and it needs more work.<br>
><br>
> This reverts commit r335558.<br>
><br>
> Removed:<br>
> llvm/trunk/test/MC/ELF/extra-section-flags.s<br>
> Modified:<br>
> llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp<br>
><br>
> Modified: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp?rev=338968&r1=338967&r2=338968&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp?rev=338968&r1=338967&r2=338968&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp (original)<br>
> +++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Sun Aug 5 07:23:37 2018<br>
> @@ -481,34 +481,6 @@ static bool hasPrefix(StringRef SectionN<br>
> return SectionName.startswith(Prefix) || SectionName == Prefix.drop_back();<br>
> }<br>
><br>
> -// Return a set of section flags based on the section name that can then<br>
> -// be augmented later, otherwise return 0 if we don't have any reasonable<br>
> -// defaults.<br>
> -static unsigned defaultSectionFlags(StringRef SectionName) {<br>
> -<br>
> - if (hasPrefix(SectionName, ".rodata.cst"))<br>
> - return ELF::SHF_ALLOC | ELF::SHF_MERGE;<br>
> -<br>
> - if (hasPrefix(SectionName, ".rodata.") || SectionName == ".rodata1")<br>
> - return ELF::SHF_ALLOC;<br>
> -<br>
> - if (SectionName == ".fini" || SectionName == ".init" ||<br>
> - hasPrefix(SectionName, ".text."))<br>
> - return ELF::SHF_ALLOC | ELF::SHF_EXECINSTR;<br>
> -<br>
> - if (hasPrefix(SectionName, ".data.") || SectionName == ".data1" ||<br>
> - hasPrefix(SectionName, ".bss.") ||<br>
> - hasPrefix(SectionName, ".init_array.") ||<br>
> - hasPrefix(SectionName, ".fini_array.") ||<br>
> - hasPrefix(SectionName, ".preinit_array."))<br>
> - return ELF::SHF_ALLOC | ELF::SHF_WRITE;<br>
> -<br>
> - if (hasPrefix(SectionName, ".tdata.") || hasPrefix(SectionName, ".tbss."))<br>
> - return ELF::SHF_ALLOC | ELF::SHF_WRITE | ELF::SHF_TLS;<br>
> -<br>
> - return 0;<br>
> -}<br>
> -<br>
> bool ELFAsmParser::ParseSectionArguments(bool IsPush, SMLoc loc) {<br>
> StringRef SectionName;<br>
><br>
> @@ -518,13 +490,27 @@ bool ELFAsmParser::ParseSectionArguments<br>
> StringRef TypeName;<br>
> int64_t Size = 0;<br>
> StringRef GroupName;<br>
> + unsigned Flags = 0;<br>
> const MCExpr *Subsection = nullptr;<br>
> bool UseLastGroup = false;<br>
> MCSymbolELF *Associated = nullptr;<br>
> int64_t UniqueID = ~0;<br>
><br>
> - // Set the default section flags first in case no others are given.<br>
> - unsigned Flags = defaultSectionFlags(SectionName);<br>
> + // Set the defaults first.<br>
> + if (hasPrefix(SectionName, ".rodata.") || SectionName == ".rodata1")<br>
> + Flags |= ELF::SHF_ALLOC;<br>
> + else if (SectionName == ".fini" || SectionName == ".init" ||<br>
> + hasPrefix(SectionName, ".text."))<br>
> + Flags |= ELF::SHF_ALLOC | ELF::SHF_EXECINSTR;<br>
> + else if (hasPrefix(SectionName, ".data.") || SectionName == ".data1" ||<br>
> + hasPrefix(SectionName, ".bss.") ||<br>
> + hasPrefix(SectionName, ".init_array.") ||<br>
> + hasPrefix(SectionName, ".fini_array.") ||<br>
> + hasPrefix(SectionName, ".preinit_array."))<br>
> + Flags |= ELF::SHF_ALLOC | ELF::SHF_WRITE;<br>
> + else if (hasPrefix(SectionName, ".tdata.") ||<br>
> + hasPrefix(SectionName, ".tbss."))<br>
> + Flags |= ELF::SHF_ALLOC | ELF::SHF_WRITE | ELF::SHF_TLS;<br>
><br>
> if (getLexer().is(AsmToken::Comma)) {<br>
> Lex();<br>
> @@ -552,12 +538,6 @@ bool ELFAsmParser::ParseSectionArguments<br>
><br>
> if (extraFlags == -1U)<br>
> return TokError("unknown flag");<br>
> -<br>
> - // If we found additional section flags on a known section then give a<br>
> - // warning.<br>
> - if (Flags && Flags != extraFlags)<br>
> - Warning(loc, "setting incorrect section attributes for " + SectionName);<br>
> -<br>
> Flags |= extraFlags;<br>
><br>
> bool Mergeable = Flags & ELF::SHF_MERGE;<br>
><br>
> Removed: llvm/trunk/test/MC/ELF/extra-section-flags.s<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/extra-section-flags.s?rev=338967&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/extra-section-flags.s?rev=338967&view=auto</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/MC/ELF/extra-section-flags.s (original)<br>
> +++ llvm/trunk/test/MC/ELF/extra-section-flags.s (removed)<br>
> @@ -1,12 +0,0 @@<br>
> -# RUN: llvm-mc -triple x86_64-unknown-unknown -filetype=obj %s -o /dev/null 2>&1 | FileCheck %s<br>
> -<br>
> -.section .rodata, "ax"<br>
> -# CHECK: warning: setting incorrect section attributes for .rodata<br>
> -nop<br>
> -<br>
> -.section .rodata, "a"<br>
> -nop<br>
> -.section .rodata.cst4, "aM",@progbits,8<br>
> -nop<br>
> -# CHECK-NOT: warning:<br>
> -<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>