From owner-svn-src-stable@freebsd.org Thu May 25 16:15:20 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99469D81905; Thu, 25 May 2017 16:15:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 754D012E0; Thu, 25 May 2017 16:15:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4PGFJbd098567; Thu, 25 May 2017 16:15:19 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4PGFJZN098563; Thu, 25 May 2017 16:15:19 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201705251615.v4PGFJZN098563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 25 May 2017 16:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r318882 - in stable/11/contrib/llvm: include/llvm/MC lib/MC lib/Target/ARM/MCTargetDesc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 May 2017 16:15:20 -0000 Author: dim Date: Thu May 25 16:15:19 2017 New Revision: 318882 URL: https://svnweb.freebsd.org/changeset/base/318882 Log: MFC r318655: Pull in r302416 from upstream llvm trunk (by Martin Storsjö): [ARM] Clear the constant pool cache on explicit .ltorg directives Multiple ldr pseudoinstructions with the same constant value will reuse the same constant pool entry. However, if the constant pool is explicitly flushed with a .ltorg directive, we should not try to reference constants in the previous pool any longer, since they may be out of range. This fixes assembling hand-written assembler source which repeatedly loads the same constant value, across a binary size larger than the pc-relative fixup range for ldr instructions (4096 bytes). Such assembler source already uses explicit .ltorg instructions to emit constant pools with regular intervals. However if we try to reuse constants emitted in earlier pools, they end up out of range. This makes the output of the testcase match what binutils gas does (prior to this patch, it would fail to assemble). Differential Revision: https://reviews.llvm.org/D32847 This should fix "out of range pc-relative fixup value" errors, when compiling certain ARM inline assembly for www/webkit-gtk[23]. Reported by: mmel Modified: stable/11/contrib/llvm/include/llvm/MC/ConstantPools.h stable/11/contrib/llvm/lib/MC/ConstantPools.cpp stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/llvm/include/llvm/MC/ConstantPools.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/MC/ConstantPools.h Thu May 25 14:54:22 2017 (r318881) +++ stable/11/contrib/llvm/include/llvm/MC/ConstantPools.h Thu May 25 16:15:19 2017 (r318882) @@ -60,6 +60,8 @@ public: // Return true if the constant pool is empty bool empty(); + + void clearCache(); }; class AssemblerConstantPools { @@ -83,6 +85,7 @@ class AssemblerConstantPools { public: void emitAll(MCStreamer &Streamer); void emitForCurrentSection(MCStreamer &Streamer); + void clearCacheForCurrentSection(MCStreamer &Streamer); const MCExpr *addEntry(MCStreamer &Streamer, const MCExpr *Expr, unsigned Size, SMLoc Loc); Modified: stable/11/contrib/llvm/lib/MC/ConstantPools.cpp ============================================================================== --- stable/11/contrib/llvm/lib/MC/ConstantPools.cpp Thu May 25 14:54:22 2017 (r318881) +++ stable/11/contrib/llvm/lib/MC/ConstantPools.cpp Thu May 25 16:15:19 2017 (r318882) @@ -54,6 +54,10 @@ const MCExpr *ConstantPool::addEntry(con bool ConstantPool::empty() { return Entries.empty(); } +void ConstantPool::clearCache() { + CachedEntries.clear(); +} + // // AssemblerConstantPools implementation // @@ -95,6 +99,13 @@ void AssemblerConstantPools::emitForCurr } } +void AssemblerConstantPools::clearCacheForCurrentSection(MCStreamer &Streamer) { + MCSection *Section = Streamer.getCurrentSectionOnly(); + if (ConstantPool *CP = getConstantPool(Section)) { + CP->clearCache(); + } +} + const MCExpr *AssemblerConstantPools::addEntry(MCStreamer &Streamer, const MCExpr *Expr, unsigned Size, SMLoc Loc) { Modified: stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp Thu May 25 14:54:22 2017 (r318881) +++ stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp Thu May 25 16:15:19 2017 (r318882) @@ -33,6 +33,7 @@ const MCExpr *ARMTargetStreamer::addCons void ARMTargetStreamer::emitCurrentConstantPool() { ConstantPools->emitForCurrentSection(Streamer); + ConstantPools->clearCacheForCurrentSection(Streamer); } // finish() - write out any non-empty assembler constant pools.