From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by sourceware.org (Postfix) with ESMTPS id 3EC5D3857C5F for ; Sat, 19 Dec 2020 14:57:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3EC5D3857C5F Received: by mail-pj1-x102d.google.com with SMTP id j13so3086465pjz.3 for ; Sat, 19 Dec 2020 06:57:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iiumD5vDDg2+mezTS+Q0YcxZyiCmHA6lZYDQAvP/aHs=; b=keMV43Fl1cJ7m5lHFcXoYZaX22757iRlWWgfLpd3EwBUPnyL5haSJpWtReeQMTdC2h kxkDpEIMsu38hMKc56LdkHwAX+1gnCS5+ytenOdK1xOA1Gke2dnKL4vsCmtuVOKHMuI4 dB4yxDUcQTGNZVL20cWzCZXgoXmu3HJ3xJqwRByRHZ951XJ55BZwo2h3BbvZBKCnxm8f tnAvUaCmXMz62xThwCMd/oAb3T1tmKUJR3MKR2KWv7hFZbPMsaI9CY14EFp5Whza/0eC FM1/0DcYODdKnvhT8lO5dmQh8ZGGvUIo6lq63+IZRWQEtv3KK0EWtaGis3FjYi8fxvPY 7TZA== X-Gm-Message-State: AOAM5303MEvZubGLtx4WS9/NxGqJXVX+iYINE1SxKHjH8jdguJhrMDIL zoqLBgrWuEPWqp9ldVbGAdPoyLr3TmE= X-Google-Smtp-Source: ABdhPJzfxvX4DhxnXPT4xLWFRAWaNsVkhEPFyJbaPvHXpCLcwNLZeugh8HyNzu5e3subKCy/8Uiv8g== X-Received: by 2002:a17:90a:6383:: with SMTP id f3mr9213987pjj.80.1608389843441; Sat, 19 Dec 2020 06:57:23 -0800 (PST) Received: from gnu-cfl-2.localdomain (c-69-181-90-243.hsd1.ca.comcast.net. [69.181.90.243]) by smtp.gmail.com with ESMTPSA id 197sm12264095pgg.43.2020.12.19.06.57.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Dec 2020 06:57:21 -0800 (PST) Received: from gnu-cfl-2.localdomain (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id 7D2541A0153; Sat, 19 Dec 2020 06:57:20 -0800 (PST) From: "H.J. Lu" To: binutils@sourceware.org Subject: [PATCH] elfcpp: Add Sym::Sym(unsigned char*) constructor Date: Sat, 19 Dec 2020 06:57:18 -0800 Message-Id: <20201219145718.171683-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3040.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Dec 2020 14:57:25 -0000 GCC 11 failed to build gold at -O0 due to -Wmaybe-uninitialized change in GCC 11: In addition, passing a pointer (or in C++, a reference) to an uninitialized object to a const-qualified function argument is also diagnosed by this warning. (-Wuninitialized is issued for built-in functions known to read the object.) Annotating the function with attribute access (none) indicates that the argument isn’t used to access the object and avoids the warning (see Common Function Attributes). Add Sym::Sym(unsigned char*) constructor to support const int sym_size = elfcpp::Elf_sizes::sym_size; unsigned char symbuf[sym_size]; elfcpp::Sym sym(symbuf); PR gold/27097 elfcpp.h (Sym::Sym(unsigned char*)): New. --- elfcpp/elfcpp.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h index 428ecb8935..5ed9711dfa 100644 --- a/elfcpp/elfcpp.h +++ b/elfcpp/elfcpp.h @@ -1533,6 +1533,10 @@ class Sym : p_(reinterpret_cast*>(p)) { } + Sym(unsigned char* p) + : p_(reinterpret_cast*>(p)) + { } + template Sym(File* file, typename File::Location loc) : p_(reinterpret_cast*>( -- 2.29.2