From patchwork Fri Apr 10 13:30:20 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 132911 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 21FA24BA2E36 for ; Fri, 10 Apr 2026 13:31:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21FA24BA2E36 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=dB9L1PT9 X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 62EB84BA2E3B for ; Fri, 10 Apr 2026 13:30:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 62EB84BA2E3B Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 62EB84BA2E3B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::336 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775827824; cv=none; b=o5sFylJWeI0wJK/KHTbJAGJX03nEIhTxdd2PZiXPkBMUuzDTc46kJZx3a2ISdFY4ZThE2zaAFTogLdpQFPqU1i1rICuLxRmdW1Y7c9Mkq9NMdu9XB+Yi3fQijSeLuM+nJ0hSF9pmRCGH2AUL0ukUWC12g1Fjh98TGX11lpG9m60= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775827824; c=relaxed/simple; bh=kZO9KKlwz4ugEniqU+04qCJpn3zaAm96rvuZOvzr1e8=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=GhWnezarn0CxpkVtPrlHO5EmsuF/NzgclGUEZlgRBq81pAuMKWfvDlRjH4U+IhquVSPKbLdvXeFCKaWSRZyW2b/8vaEsfBejCnpe1LsFnDpSd1C5ZxJVzwrrY6eczoWbfVSbcC1DpGwiNac3Gv2KOl2ukow5s50Q2tiC9v6StCA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62EB84BA2E3B Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-488a8ca4aadso23014775e9.3 for ; Fri, 10 Apr 2026 06:30:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1775827823; x=1776432623; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ETRwiDBCjMA9zTCK83SDXdvvwyR8j7wtZewunXLt360=; b=dB9L1PT9/2oTQyRraUkKzV4WNri/njC2Aj7LudeDYrll8/MNh47dwHpm5RlEqmkroB T/V5KVCVwPDOR0hgJhLKI/bnbzIPkY/k8xyRi9TNdilFxFsr1owuXCCTtjDSIeyKAz04 5bBUiSGS8KWYpNIi+drslA4VFTSWEoWK/wLlcuxfo1JnlrRoRXB37OWQ1CDeFM2BkpKC 1Z+WSWSjkJgG4YzZZgTDx86HOhb4J9y2VMwmrTfrpy1cBZWU7zxA98Ul28+Uavz0znu0 eP9KEO7YNViqgEc6SphvZtG0FuNyLWx23fpr3lOC8I5ef9ECqsR/eyEZHbnxZTpzu9Kb jkYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775827823; x=1776432623; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ETRwiDBCjMA9zTCK83SDXdvvwyR8j7wtZewunXLt360=; b=QzAGuqE5bzixECE2OVqJ+1wVIBsJDmJ61B3kkXm+A0iaZMU9IjBlFkz6HixwSFRzGG kSGVN43gusdsYt5PG6m2kCjTmPNQoExfuuXnb9JgHDll4SVV74MJVyYRbragWLahvd/G cVFZ3RcN9MZ7Ipa0z8BszNs2ixr0TVtXDhl1e3HpENXjHrygWHJIYD4R7NxXlUUzutoP wfWALlHC29yjaT3PVyuvXmAfmoiVkgsMZlW5gIqiGxiG0dOtegcg+B+wCril9QzW5kL5 144qIHgMe8Id1f4WSU9kP/2/Rvcjoz6O8w760U9PPqHSemPIHA3YpuRS8zkaJmKi8Bzy b3TA== X-Gm-Message-State: AOJu0YwQCTnTVrK0bbaNIu8awnWtJwV2XQ8E0Fl4TB62JL2XsZTgEDr8 4v67+SR8o1mnhUqcTTjdwkduOaXBR3bWnaFC+SfOmReOqfaaCqCSVBTd/mD94cHkAoCrX9kGOoy XiHWLkA== X-Gm-Gg: AeBDieu/NaCqQrEWHiFU4n5DOJez33g7XhIkiNNwOCusMIhMPRzBhKyerf5folNISPg TQRHPvPrIAx7PL8yWYWIe+B8fr/1PjPhPG5CrWFTaO5MyQZS0hLFlBU0F/zcKEHN2fiQ3IZFnpf 92bk5KMYkEWeHWfSYfnBPN0eP0G/itn8EiIu84QcQc8APcjifByge2clOJqiC84U5mYrXHnSUxC /b4ew88oUdQH7hy4aAKKxDWofpLm82V/H7AW888d8RVD4HADqg5BEO7Fii12FuHHU9sfyG0QJN/ pKRUbADmCkIis0pazdzvsdL3bnhc14t3ba2RQbCfc/zeDLeDzuPBoPcts4VwHrjdqGYuflcbj+5 XXx4cxf3Kf5zY3wrn5pu1xvcMqvyCh9fzs0lF9LdtAdblE3423knt9i+ZWDIJzhli3vhQdQPvps Njh9WZH/3m3a6uh/Yd61KVPbJ1CxL+Q+3BLTfzOmBSDS+eYMp+b/ZHCMi4nnZH2MH8I+dV5zkOH 98jnussNyz/00I= X-Received: by 2002:a05:600c:6990:b0:488:a2ac:a34c with SMTP id 5b1f17b1804b1-488d67f5bf5mr41507765e9.12.1775827823129; Fri, 10 Apr 2026 06:30:23 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488d5d68585sm34732945e9.1.2026.04.10.06.30.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Apr 2026 06:30:22 -0700 (PDT) Message-ID: Date: Fri, 10 Apr 2026 15:30:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/3] gas/ELF: restrict visibility changes From: Jan Beulich To: Binutils References: Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: X-Spam-Status: No, score=-3016.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org Since the spec mandates that the most restricting visibility ought to propagate when linking, the same rule should apply when assembling. --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -404,21 +404,24 @@ static void obj_elf_visibility (int visibility) { int c; - symbolS *symbolP; - asymbol *bfdsym; - elf_symbol_type *elfsym; do { - symbolP = get_sym_from_input_line_and_check (); - - bfdsym = symbol_get_bfdsym (symbolP); - elfsym = elf_symbol_from (bfdsym); + symbolS *symbolP = get_sym_from_input_line_and_check (); + const asymbol *bfdsym = symbol_get_bfdsym (symbolP); + elf_symbol_type *elfsym = elf_symbol_from (bfdsym); + int current = ELF_ST_VISIBILITY (elfsym->internal_elf_sym.st_other); gas_assert (elfsym); - elfsym->internal_elf_sym.st_other &= ~3; - elfsym->internal_elf_sym.st_other |= visibility; + if (!current || visibility <= current) + { + elfsym->internal_elf_sym.st_other &= ~ELF_ST_VISIBILITY (~0); + elfsym->internal_elf_sym.st_other |= visibility; + } + else + as_warn (_("visibility of `%s' is already `%s'"), S_GET_NAME (symbolP), + current == STV_HIDDEN ? "hidden" : "internal"); c = *input_line_pointer; if (c == ',') --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -237,6 +237,7 @@ if { [is_elf_format] } then { # The alpha port uses .set for state, e.g. nomacro. run_dump_test "symtab" } + run_dump_test "visibility" run_dump_test "symver" run_dump_test "pr21661" run_dump_test "pr14891" --- a/gas/testsuite/gas/elf/pseudo.l +++ b/gas/testsuite/gas/elf/pseudo.l @@ -4,6 +4,7 @@ [^:]*:6: Error: Missing symbol name in directive [^:]*:8: Error: Missing symbol name in directive [^:]*:10: Error: Missing symbol name in directive +[^:]*:10: Warning: visibility of .* is already .internal. [^:]*:12: Error: Missing symbol name in directive [^:]*:14: Error: Missing symbol name in directive [^:]*:14: Error: expected comma after name in .symver --- /dev/null +++ b/gas/testsuite/gas/elf/visibility.d @@ -0,0 +1,12 @@ +#name: diagnostics for visibility directives +#readelf: -s -W +#warning_output: visibility.l +#target: [supports_gnu_unique] + +#... + +[0-9]+: +0+ +0 +(NOTYPE|OBJECT) +GLOBAL +INTERNAL +[1-9] +gd + +[0-9]+: +0+1 +0 +(NOTYPE|OBJECT) +WEAK +INTERNAL +[1-9] +wd + +[0-9]+: +0+2 +0 +OBJECT +UNIQUE +HIDDEN +[1-9] +gu + +[0-9]+: +0+ +0 +(NOTYPE|OBJECT) +GLOBAL +INTERNAL +UND +ge + +[0-9]+: +0+ +0 +(NOTYPE|OBJECT) +WEAK +HIDDEN +UND +we +#pass --- /dev/null +++ b/gas/testsuite/gas/elf/visibility.l @@ -0,0 +1,5 @@ +[^:]*: Assembler messages: +[^:]*:4: Warning: visibility of .gd. is already .internal. +[^:]*:5: Warning: visibility of .gd. is already .internal. +[^:]*:21: Warning: visibility of .ge. is already .hidden. +[^:]*:26: Warning: visibility of .we. is already .hidden. --- /dev/null +++ b/gas/testsuite/gas/elf/visibility.s @@ -0,0 +1,28 @@ + .data + .global gd + .internal gd + .hidden gd + .protected gd +gd: .dc.b 0 + + .weak wd + .protected wd + .hidden wd + .internal wd +wd: .dc.b 0 + + .type gu, %gnu_unique_object + .hidden gu + .hidden gu +gu: .dc.b 0 + + .global ge + .hidden ge + .protected ge + .internal ge + + .weak we + .hidden we + .protected we + .p2align 3 + .dc.a we From patchwork Fri Apr 10 13:31:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 132912 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 9B2234BA2E3E for ; Fri, 10 Apr 2026 13:32:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B2234BA2E3E Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=Nc2OfJmo X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 49C5A4BA2E1B for ; Fri, 10 Apr 2026 13:31:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49C5A4BA2E1B Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 49C5A4BA2E1B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::430 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775827904; cv=none; b=swy2pAbn7nchrThBk2RJE3qelD21djbiBSZssTxT5JS2qX+cpa+TQ1nROJpcH7w2IW28QTD/hat9WIBBcljWTyo/MZyKnyRic2/Nla3yJAYzyQp0EKgcewI46ePbzxFZMOUXYziekzCvm/BqxXMTPYi1925wL1/EAFsIN8951SM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775827904; c=relaxed/simple; bh=rNovZfoQDZy9Z/ZXTet7Lgcv/UW4YL0p3mhKcR3C464=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=vs9citF7WWYXIbqgQjZ7E4Yz2KWkOgbYdkzlwSjG88gsQUGXxB+y68VEa7xU/nMkg5At3PSObb5D2tmHrk8MAEcc0R6VpImvKO9TOa1xMGWc3VI87B1fOpWvC5eAno8lh0UwbLzDLYlkkFgc+SZ8RzJpIcRAduJy4b+MBuLlV9k= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49C5A4BA2E1B Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-43d64313c39so656978f8f.3 for ; Fri, 10 Apr 2026 06:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1775827903; x=1776432703; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:cc:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=J90Df423dddwQYKwwNgYQyAD4HSHWfYTxrmkZ+Q9UqM=; b=Nc2OfJmoEQnnVZ1BGZoRDHJJ4zBxtD7OpKum92RbnaDVEkq2e2wSHz1K6bI2U6Oyln oc+hJSob+UWgtZLeSTKb0nbNuXyazhZAsQ3qPR/BABw9e2jeC0Zn+uQvH6R+4PmvKaHZ IJLHWwyyp6uNHbIwS7cXtC/rBniWRvPuOMWF4CMfBy4n+zQIOr1RA0i62ysQjps5KzZa 8ugJG5AbPpdl7032qJftLPnByd6UvxeRwMjZS38ml2E+DnrPZWzk+uEqJ2d1UxpMMNVB Q+BDjwnVc2IP1mOQS13YFyJLAKE1kjAeZhOEv7x0sIeObExAq9vDWAgNUmLAihAQHeZR wJOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775827903; x=1776432703; h=content-transfer-encoding:in-reply-to:autocrypt:cc:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=J90Df423dddwQYKwwNgYQyAD4HSHWfYTxrmkZ+Q9UqM=; b=Q7w/Y2Asq1RMMf/hVXQXEhV5fqL3EjhSDeoWbDjzz7amJwWIhc8PxEz3Dr3MqTCh8x FvEdLsMhgEQjnTntfh9JKuWUUzF82fV1ObdrMF1fWOkegNKK93+0N9pu1bpLxIhpRv43 HE9fzMIYz+8VP0Pchya1BxaxUn/4bI9kVkR0NnfjbDbOHBK67ehYyuLjjgOCRH82eAvW 5IV2M/tWqlQZQpvMyBrO6smQNDBylZ3cWK9DUWkbyEa+2/Cy2tbQANNPj+liqNALEsrn yKQUrGywXI7ydSTW0qGfcmqlgz+u4PvYbcX9by4Clt6GJGroEWYjMGa5W2GrZhZKEfIm I4BA== X-Gm-Message-State: AOJu0Yxwym4jc2oO5OvwRiSUiBriGxC4ChuA3LZ5UKKxirTYlPk7mdew ZnM7ewsbEBUG+afW1L5Wcp0kYQiTJhVB6LaLjTzoeNdE9rmatpSuG7YlRtyFBIFPTFa/jq2bwh5 iXs7xUg== X-Gm-Gg: AeBDieu5DtF3vMSKBDbhTvuZlPQ1yhnLq1yavbz6FYlPLkDXB29+mx+NWDRuKcVa1T/ t/fIg2PRXnqcbW7WkyJ60DnJKJ5sSWM63uVZ4sThTx+vpdWTrVtUJOyq0w3BzCi+Z4Z04sgUi6d QZVB+TPRwfDd08KNBfbdgoqtdFe0cKfeDIm+SAhWsmYn28yTbgpPvlbatgVOyo7pW2nj+kNasjt dL1829OYM1mK0+PAOZTkKa94K4CbsLsXKp+jFPdKHps2MM+vZxJdxrCUyqCNIZDmFKBjo5+Q4cJ ylxo9Agogjq4IHBvrUqEAUyeHBC9iES7JKQ0fl0Qybi/EcWbRSy7yuxbvVZXKogYcWOjRZnV7zC vydVDxg2kW5+y0apz2LkFwEXFZZtp7Jx3REcGL2BKxX153zBhVxWgySwY6p+3Vl2KSNXS+80Kh6 t71UlVXR+SRwLew1L2NjgDU15AwnrV9OJEUOWiQxi1wEo7CsJ7wTiSllwcZON0sN3jR5vK1rEXB hE+Zh+RqPjP7Ps= X-Received: by 2002:a5d:64c9:0:b0:43b:86f7:2ed1 with SMTP id ffacd0b85a97d-43d64235d0bmr4877873f8f.8.1775827902858; Fri, 10 Apr 2026 06:31:42 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d63e50044sm7514586f8f.25.2026.04.10.06.31.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Apr 2026 06:31:42 -0700 (PDT) Message-ID: <193f86ed-f34b-4da8-9eac-68005830d369@suse.com> Date: Fri, 10 Apr 2026 15:31:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/3] gas/ELF: warn upon non-default visibility of local symbols From: Jan Beulich To: Binutils References: Content-Language: en-US Cc: Chenghua Xu , Zhensong Liu , "H.J. Lu" , Richard Earnshaw , Alice Carlotti , Joseph Myers Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: X-Spam-Status: No, score=-3016.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org The spec explicitly precludes STB_LOCAL together with STV_PROTECTED (and, implicity, STV_HIDDEN or STV_INTERNAL), so we better wouldn't entirely silently write out symbols violating this. LoongArch's tc_symbol_new_hook() simply needs dropping. If FAKE_LABEL_NAME symbols can end up global, marking them hidden would need doing elsewhere. There not being a need to make any testsuite adjustments suggests though that this won't normally (ever?) happen. A couple of testcases then also need adjustment. --- It would be nice to re-use an existing loop, yet the one in elf_frob_file_before_adjust() comes too early, as does elf_frob_symbol(). An alternative may be to imply .global from .hidden etc also for defined symbols (as looks to have been implied by some of the testcases being adjusted). This would then require to reject .local when a visibility was already set. I wonder what purpose STV_* serve with e.g. STT_SECTION. Yet I also wonder what purpose STB_* other than STB_LOCAL serve with STT_SECTION (seeing how bfd/elf.c:swap_out_syms() explicitly uses STB_GLOBAL). The TI C6x testcase adjustments suggest that PLT relocations are needlessly emitted by gas for non-default visibility globals. --- a/binutils/testsuite/binutils-all/localize-hidden-1.d +++ b/binutils/testsuite/binutils-all/localize-hidden-1.d @@ -2,6 +2,7 @@ #objdump: --syms #objcopy: --localize-hidden #name: --localize-hidden test 1 +#warning_output: localize-hidden-1.l #... 0+1200 l .*\*ABS\* 0+ \.hidden Lhidden 0+1300 l .*\*ABS\* 0+ \.internal Linternal --- /dev/null +++ b/binutils/testsuite/binutils-all/localize-hidden-1.l @@ -0,0 +1,4 @@ +[^:]*: Assembler messages: +[^:]*: Warning: local symbol .Lhidden. has non-default visibility +[^:]*: Warning: local symbol .Linternal. has non-default visibility +[^:]*: Warning: local symbol .Lprotected. has non-default visibility --- a/binutils/testsuite/binutils-all/nm-ver.s +++ b/binutils/testsuite/binutils-all/nm-ver.s @@ -1,5 +1,7 @@ .symver foo_old,foo@VER_1 + .global "foo@VER_1" .hidden foo_old + .global foo_old foo_old: .dc.b 0 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -2730,6 +2730,23 @@ elf_adjust_symtab (void) { unsigned int i; + if (!had_errors ()) + for (symbolS *symp = symbol_rootP; symp; symp = symbol_next (symp)) + if (!symbol_removed_p (symp) + && S_IS_DEFINED (symp) + && (bfd_keep_unused_section_symbols (stdoutput) + || !symbol_section_p (symp) + || symbol_used_in_reloc_p (symp))) + { + const asymbol *bfdsym = symbol_get_bfdsym (symp); + elf_symbol_type *elfsym = elf_symbol_from (bfdsym); + + if (ELF_ST_VISIBILITY (elfsym->internal_elf_sym.st_other) + && !(bfdsym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE))) + as_warn (_("local symbol `%s' has non-default visibility"), + S_GET_NAME (symp)); + } + /* Make the SHT_GROUP sections that describe each section group. We can't set up the section contents here yet, because elf section indices have yet to be calculated. elf.c:set_group_contents does --- a/gas/config/tc-loongarch.h +++ b/gas/config/tc-loongarch.h @@ -121,10 +121,6 @@ extern void tc_loongarch_parse_to_dw2reg extern int tc_loongarch_regname_to_dw2regnum (char *); -#define tc_symbol_new_hook(sym) \ - if (0 == strcmp (sym->bsym->name, FAKE_LABEL_NAME)) \ - S_SET_OTHER (sym, STV_HIDDEN); - extern void loongarch_pre_output_hook (void); #define md_pre_output_hook loongarch_pre_output_hook () #define GAS_SORT_RELOCS 1 --- a/gas/testsuite/gas/elf/visibility.l +++ b/gas/testsuite/gas/elf/visibility.l @@ -3,3 +3,6 @@ [^:]*:5: Warning: visibility of .gd. is already .internal. [^:]*:21: Warning: visibility of .ge. is already .hidden. [^:]*:26: Warning: visibility of .we. is already .hidden. +[^:]*: Warning: local symbol .li. has non-default visibility +[^:]*: Warning: local symbol .lh. has non-default visibility +[^:]*: Warning: local symbol .lp. has non-default visibility --- a/gas/testsuite/gas/elf/visibility.s +++ b/gas/testsuite/gas/elf/visibility.s @@ -26,3 +26,12 @@ gu: .dc.b 0 .protected we .p2align 3 .dc.a we + + .internal li +li: .dc.b 0 + + .hidden lh +lh: .dc.b 0 + + .protected lp +lp: .dc.b 0 --- a/gas/testsuite/gas/i386/tlsnopic.s +++ b/gas/testsuite/gas/i386/tlsnopic.s @@ -2,6 +2,7 @@ .globl baz .hidden baz .globl var + .globl var2 .hidden var2 bar: .long 27 baz: .long 29 --- a/ld/testsuite/ld-aarch64/ifunc-21.s +++ b/ld/testsuite/ld-aarch64/ifunc-21.s @@ -1,5 +1,6 @@ .text .type ifunc, @gnu_indirect_function + .global ifunc .hidden ifunc ifunc: ret --- a/ld/testsuite/ld-tic6x/shlib-1.rd +++ b/ld/testsuite/ld-tic6x/shlib-1.rd @@ -16,7 +16,7 @@ Section Headers: \[11\] \.neardata PROGBITS 10000128 002128 000008 00 WA 0 0 4 \[12\] \.bss NOBITS 10000130 002130 000004 00 WA 0 0 4 \[13\] \.c6xabi\.attributes C6000_ATTRIBUTES 00000000 002130 000019 00 0 0 1 - \[14\] \.symtab SYMTAB 00000000 00214c 0001b0 10 15 21 4 + \[14\] \.symtab SYMTAB 00000000 00214c 000190 10 15 19 4 \[15\] \.strtab STRTAB .* \[16\] \.shstrtab STRTAB .* Key to Flags: @@ -90,7 +90,7 @@ Symbol table '\.dynsym' contains 12 entr 10: 10000128 4 OBJECT GLOBAL DEFAULT 11 a 11: 100000c0 52 FUNC GLOBAL DEFAULT 9 sub -Symbol table '\.symtab' contains 27 entries: +Symbol table '\.symtab' contains 25 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00008000 0 SECTION LOCAL DEFAULT 1.* @@ -106,16 +106,14 @@ Symbol table '\.symtab' contains 27 entr 11: 10000128 0 SECTION LOCAL DEFAULT 11.* 12: 10000130 0 SECTION LOCAL DEFAULT 12.* 13: 00000000 0 SECTION LOCAL DEFAULT 13.* - 14: 00000000 0 FILE LOCAL DEFAULT ABS .*shlib-1\.o - 15: 10000080 0 FUNC LOCAL HIDDEN 9 sub1 - 16: 00000000 0 FILE LOCAL DEFAULT ABS - 17: 00008154 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC - 18: 10000130 4 OBJECT LOCAL DEFAULT 12 c - 19: 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ - 20: 10000100 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE - 21: 00000000 0 NOTYPE WEAK DEFAULT UND b - 22: 00000000 0 NOTYPE WEAK DEFAULT UND g1 - 23: 1000012c 4 OBJECT GLOBAL DEFAULT 11 g2 - 24: 10000088 52 FUNC GLOBAL DEFAULT 9 sub0 - 25: 10000128 4 OBJECT GLOBAL DEFAULT 11 a - 26: 100000c0 52 FUNC GLOBAL DEFAULT 9 sub + 14: 10000080 0 FUNC LOCAL DEFAULT 9 sub1 + 15: 00008154 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC + 16: 10000130 4 OBJECT LOCAL DEFAULT 12 c + 17: 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ + 18: 10000100 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE + 19: 00000000 0 NOTYPE WEAK DEFAULT UND b + 20: 00000000 0 NOTYPE WEAK DEFAULT UND g1 + 21: 1000012c 4 OBJECT GLOBAL DEFAULT 11 g2 + 22: 10000088 52 FUNC GLOBAL DEFAULT 9 sub0 + 23: 10000128 4 OBJECT GLOBAL DEFAULT 11 a + 24: 100000c0 52 FUNC GLOBAL DEFAULT 9 sub --- a/ld/testsuite/ld-tic6x/shlib-1.s +++ b/ld/testsuite/ld-tic6x/shlib-1.s @@ -1,6 +1,7 @@ .text .nocmp .align 2 + .global sub1 .hidden sub1 .type sub1, @function sub1: --- a/ld/testsuite/ld-tic6x/shlib-1b.rd +++ b/ld/testsuite/ld-tic6x/shlib-1b.rd @@ -16,7 +16,7 @@ Section Headers: \[11\] \.neardata PROGBITS 10000128 002128 000008 00 WA 0 0 4 \[12\] \.bss NOBITS 10000130 002130 000004 00 WA 0 0 4 \[13\] \.c6xabi\.attributes C6000_ATTRIBUTES 00000000 002130 000019 00 0 0 1 - \[14\] \.symtab SYMTAB 00000000 00214c 0001b0 10 15 21 4 + \[14\] \.symtab SYMTAB 00000000 00214c 000190 10 15 19 4 \[15\] \.strtab STRTAB .* \[16\] \.shstrtab STRTAB .* Key to Flags: @@ -90,7 +90,7 @@ Symbol table '\.dynsym' contains 12 entr 10: 10000128 4 OBJECT GLOBAL DEFAULT 11 a 11: 100000c0 52 FUNC GLOBAL DEFAULT 9 sub -Symbol table '\.symtab' contains 27 entries: +Symbol table '\.symtab' contains 25 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00008000 0 SECTION LOCAL DEFAULT 1.* @@ -106,16 +106,14 @@ Symbol table '\.symtab' contains 27 entr 11: 10000128 0 SECTION LOCAL DEFAULT 11.* 12: 10000130 0 SECTION LOCAL DEFAULT 12.* 13: 00000000 0 SECTION LOCAL DEFAULT 13.* - 14: 00000000 0 FILE LOCAL DEFAULT ABS .*shlib-1\.o - 15: 10000080 0 FUNC LOCAL HIDDEN 9 sub1 - 16: 00000000 0 FILE LOCAL DEFAULT ABS - 17: 00008154 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC - 18: 10000130 4 OBJECT LOCAL DEFAULT 12 c - 19: 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ - 20: 10000100 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE - 21: 00000000 0 NOTYPE WEAK DEFAULT UND b - 22: 00000000 0 NOTYPE WEAK DEFAULT UND g1 - 23: 1000012c 4 OBJECT GLOBAL DEFAULT 11 g2 - 24: 10000088 52 FUNC GLOBAL DEFAULT 9 sub0 - 25: 10000128 4 OBJECT GLOBAL DEFAULT 11 a - 26: 100000c0 52 FUNC GLOBAL DEFAULT 9 sub + 14: 10000080 0 FUNC LOCAL DEFAULT 9 sub1 + 15: 00008154 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC + 16: 10000130 4 OBJECT LOCAL DEFAULT 12 c + 17: 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ + 18: 10000100 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE + 19: 00000000 0 NOTYPE WEAK DEFAULT UND b + 20: 00000000 0 NOTYPE WEAK DEFAULT UND g1 + 21: 1000012c 4 OBJECT GLOBAL DEFAULT 11 g2 + 22: 10000088 52 FUNC GLOBAL DEFAULT 9 sub0 + 23: 10000128 4 OBJECT GLOBAL DEFAULT 11 a + 24: 100000c0 52 FUNC GLOBAL DEFAULT 9 sub --- a/ld/testsuite/ld-tic6x/shlib-1r.dd +++ b/ld/testsuite/ld-tic6x/shlib-1r.dd @@ -42,7 +42,7 @@ Disassembly of section \.text: 10000094:[ \t]*0700026e[ \t]*ldw \.D2T2 \*\+b14\(8\),b14 10000098:[ \t]*0ffffa12[ \t]*b \.S2 10000050 1000009c:[ \t]*0ffff712[ \t]*b \.S2 10000038 -100000a0:[ \t]*0ffffc12[ \t]*b \.S2 10000080 +100000a0:[ \t]*0ffff812[ \t]*b \.S2 10000060 100000a4:[ \t]*01bc62e6[ \t]*ldw \.D2T2 \*\+b15\(12\),b3 100000a8:[ \t]*073c82e6[ \t]*ldw \.D2T2 \*\+b15\(16\),b14 100000ac:[ \t]*07800852[ \t]*addk \.S2 16,b15 --- a/ld/testsuite/ld-tic6x/shlib-1r.rd +++ b/ld/testsuite/ld-tic6x/shlib-1r.rd @@ -16,7 +16,7 @@ Section Headers: \[11\] \.neardata PROGBITS 10000128 002128 000008 00 WA 0 0 4 \[12\] \.bss NOBITS 10000130 002130 000004 00 WA 0 0 4 \[13\] \.c6xabi\.attributes C6000_ATTRIBUTES 00000000 002130 000019 00 0 0 1 - \[14\] \.symtab SYMTAB 00000000 00214c 0001b0 10 15 21 4 + \[14\] \.symtab SYMTAB 00000000 00214c 000190 10 15 19 4 \[15\] \.strtab STRTAB .* \[16\] \.shstrtab STRTAB .* Key to Flags: @@ -90,7 +90,7 @@ Symbol table '\.dynsym' contains 12 entr 10: 10000128 4 OBJECT GLOBAL DEFAULT 11 a 11: 100000c0 52 FUNC GLOBAL DEFAULT 9 sub -Symbol table '\.symtab' contains 27 entries: +Symbol table '\.symtab' contains 25 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00008000 0 SECTION LOCAL DEFAULT 1.* @@ -106,16 +106,14 @@ Symbol table '\.symtab' contains 27 entr 11: 10000128 0 SECTION LOCAL DEFAULT 11.* 12: 10000130 0 SECTION LOCAL DEFAULT 12.* 13: 00000000 0 SECTION LOCAL DEFAULT 13.* - 14: 00000000 0 FILE LOCAL DEFAULT ABS .*shlib-1\.o - 15: 10000080 0 FUNC LOCAL HIDDEN 9 sub1 - 16: 00000000 0 FILE LOCAL DEFAULT ABS - 17: 00008154 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC - 18: 10000130 4 OBJECT LOCAL DEFAULT 12 c - 19: 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ - 20: 10000100 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE - 21: 00000000 0 NOTYPE WEAK DEFAULT UND b - 22: 00000000 0 NOTYPE WEAK DEFAULT UND g1 - 23: 1000012c 4 OBJECT GLOBAL DEFAULT 11 g2 - 24: 10000088 52 FUNC GLOBAL DEFAULT 9 sub0 - 25: 10000128 4 OBJECT GLOBAL DEFAULT 11 a - 26: 100000c0 52 FUNC GLOBAL DEFAULT 9 sub + 14: 10000080 0 FUNC LOCAL DEFAULT 9 sub1 + 15: 00008154 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC + 16: 10000130 4 OBJECT LOCAL DEFAULT 12 c + 17: 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ + 18: 10000100 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE + 19: 00000000 0 NOTYPE WEAK DEFAULT UND b + 20: 00000000 0 NOTYPE WEAK DEFAULT UND g1 + 21: 1000012c 4 OBJECT GLOBAL DEFAULT 11 g2 + 22: 10000088 52 FUNC GLOBAL DEFAULT 9 sub0 + 23: 10000128 4 OBJECT GLOBAL DEFAULT 11 a + 24: 100000c0 52 FUNC GLOBAL DEFAULT 9 sub --- a/ld/testsuite/ld-tic6x/shlib-1rb.dd +++ b/ld/testsuite/ld-tic6x/shlib-1rb.dd @@ -42,7 +42,7 @@ Disassembly of section \.text: 10000094:[ \t]*0700026e[ \t]*ldw \.D2T2 \*\+b14\(8\),b14 10000098:[ \t]*0ffffa12[ \t]*b \.S2 10000050 1000009c:[ \t]*0ffff712[ \t]*b \.S2 10000038 -100000a0:[ \t]*0ffffc12[ \t]*b \.S2 10000080 +100000a0:[ \t]*0ffff812[ \t]*b \.S2 10000060 100000a4:[ \t]*01bc62e6[ \t]*ldw \.D2T2 \*\+b15\(12\),b3 100000a8:[ \t]*073c82e6[ \t]*ldw \.D2T2 \*\+b15\(16\),b14 100000ac:[ \t]*07800852[ \t]*addk \.S2 16,b15 --- a/ld/testsuite/ld-tic6x/shlib-1rb.rd +++ b/ld/testsuite/ld-tic6x/shlib-1rb.rd @@ -16,7 +16,7 @@ Section Headers: \[11\] \.neardata PROGBITS 10000128 002128 000008 00 WA 0 0 4 \[12\] \.bss NOBITS 10000130 002130 000004 00 WA 0 0 4 \[13\] \.c6xabi\.attributes C6000_ATTRIBUTES 00000000 002130 000019 00 0 0 1 - \[14\] \.symtab SYMTAB 00000000 00214c 0001b0 10 15 21 4 + \[14\] \.symtab SYMTAB 00000000 00214c 000190 10 15 19 4 \[15\] \.strtab STRTAB .* \[16\] \.shstrtab STRTAB .* Key to Flags: @@ -90,7 +90,7 @@ Symbol table '\.dynsym' contains 12 entr 10: 10000128 4 OBJECT GLOBAL DEFAULT 11 a 11: 100000c0 52 FUNC GLOBAL DEFAULT 9 sub -Symbol table '\.symtab' contains 27 entries: +Symbol table '\.symtab' contains 25 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00008000 0 SECTION LOCAL DEFAULT 1.* @@ -106,16 +106,14 @@ Symbol table '\.symtab' contains 27 entr 11: 10000128 0 SECTION LOCAL DEFAULT 11.* 12: 10000130 0 SECTION LOCAL DEFAULT 12.* 13: 00000000 0 SECTION LOCAL DEFAULT 13.* - 14: 00000000 0 FILE LOCAL DEFAULT ABS .*shlib-1\.o - 15: 10000080 0 FUNC LOCAL HIDDEN 9 sub1 - 16: 00000000 0 FILE LOCAL DEFAULT ABS - 17: 00008154 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC - 18: 10000130 4 OBJECT LOCAL DEFAULT 12 c - 19: 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ - 20: 10000100 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE - 21: 00000000 0 NOTYPE WEAK DEFAULT UND b - 22: 00000000 0 NOTYPE WEAK DEFAULT UND g1 - 23: 1000012c 4 OBJECT GLOBAL DEFAULT 11 g2 - 24: 10000088 52 FUNC GLOBAL DEFAULT 9 sub0 - 25: 10000128 4 OBJECT GLOBAL DEFAULT 11 a - 26: 100000c0 52 FUNC GLOBAL DEFAULT 9 sub + 14: 10000080 0 FUNC LOCAL DEFAULT 9 sub1 + 15: 00008154 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC + 16: 10000130 4 OBJECT LOCAL DEFAULT 12 c + 17: 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ + 18: 10000100 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE + 19: 00000000 0 NOTYPE WEAK DEFAULT UND b + 20: 00000000 0 NOTYPE WEAK DEFAULT UND g1 + 21: 1000012c 4 OBJECT GLOBAL DEFAULT 11 g2 + 22: 10000088 52 FUNC GLOBAL DEFAULT 9 sub0 + 23: 10000128 4 OBJECT GLOBAL DEFAULT 11 a + 24: 100000c0 52 FUNC GLOBAL DEFAULT 9 sub --- a/ld/testsuite/ld-tic6x/shlib-noindex.rd +++ b/ld/testsuite/ld-tic6x/shlib-noindex.rd @@ -17,7 +17,7 @@ Section Headers: \[12\] \.neardata PROGBITS 10000128 002128 000008 00 WA 0 0 4 \[13\] \.bss NOBITS 10000130 002130 000004 00 WA 0 0 4 \[14\] \.c6xabi\.attributes C6000_ATTRIBUTES 00000000 002130 000019 00 0 0 1 - \[15\] \.symtab SYMTAB 00000000 00214c 0001c0 10 16 22 4 + \[15\] \.symtab SYMTAB 00000000 00214c 0001a0 10 16 20 4 \[16\] \.strtab STRTAB .* \[17\] \.shstrtab STRTAB .* Key to Flags: @@ -96,7 +96,7 @@ Symbol table '\.dynsym' contains 12 entr 10: 10000128 4 OBJECT GLOBAL DEFAULT 12 a 11: 100000c0 52 FUNC GLOBAL DEFAULT 10 sub -Symbol table '\.symtab' contains 28 entries: +Symbol table '\.symtab' contains 26 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00008000 0 SECTION LOCAL DEFAULT 1.* @@ -113,16 +113,14 @@ Symbol table '\.symtab' contains 28 entr 12: 10000128 0 SECTION LOCAL DEFAULT 12.* 13: 10000130 0 SECTION LOCAL DEFAULT 13.* 14: 00000000 0 SECTION LOCAL DEFAULT 14.* - 15: 00000000 0 FILE LOCAL DEFAULT ABS .*shlib-1\.o - 16: 10000080 0 FUNC LOCAL HIDDEN 10 sub1 - 17: 00000000 0 FILE LOCAL DEFAULT ABS - 18: 00008160 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC - 19: 10000130 4 OBJECT LOCAL DEFAULT 13 c - 20: 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ - 21: 10000100 0 NOTYPE LOCAL DEFAULT 11 __c6xabi_DSBT_BASE - 22: 00000000 0 NOTYPE WEAK DEFAULT UND b - 23: 00000000 0 NOTYPE WEAK DEFAULT UND g1 - 24: 1000012c 4 OBJECT GLOBAL DEFAULT 12 g2 - 25: 10000088 52 FUNC GLOBAL DEFAULT 10 sub0 - 26: 10000128 4 OBJECT GLOBAL DEFAULT 12 a - 27: 100000c0 52 FUNC GLOBAL DEFAULT 10 sub + 15: 10000080 0 FUNC LOCAL DEFAULT 10 sub1 + 16: 00008160 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC + 17: 10000130 4 OBJECT LOCAL DEFAULT 13 c + 18: 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ + 19: 10000100 0 NOTYPE LOCAL DEFAULT 11 __c6xabi_DSBT_BASE + 20: 00000000 0 NOTYPE WEAK DEFAULT UND b + 21: 00000000 0 NOTYPE WEAK DEFAULT UND g1 + 22: 1000012c 4 OBJECT GLOBAL DEFAULT 12 g2 + 23: 10000088 52 FUNC GLOBAL DEFAULT 10 sub0 + 24: 10000128 4 OBJECT GLOBAL DEFAULT 12 a + 25: 100000c0 52 FUNC GLOBAL DEFAULT 10 sub --- a/ld/testsuite/ld-tic6x/static-app-1.rd +++ b/ld/testsuite/ld-tic6x/static-app-1.rd @@ -14,7 +14,7 @@ Section Headers: \[ 9\] \.neardata PROGBITS [0-9a-f]* [0-9a-f]* 000014 00 WA 0 0 4 \[10\] \.bss NOBITS [0-9a-f]* [0-9a-f]* 000004 00 WA 0 0 4 \[11\] \.c6xabi\.attributes C6000_ATTRIBUTES 00000000 [0-9a-f]* 000019 00 0 0 1 - \[12\] \.symtab SYMTAB 00000000 [0-9a-f]* 0001c0 10 13 22 4 + \[12\] \.symtab SYMTAB 00000000 [0-9a-f]* 0001b0 10 13 20 4 \[13\] \.strtab STRTAB .* \[14\] \.shstrtab STRTAB .* Key to Flags: @@ -78,7 +78,7 @@ Symbol table '\.dynsym' contains 8 entri 6: 00000000 0 NOTYPE WEAK DEFAULT UND g1 7: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 a -Symbol table '\.symtab' contains 28 entries: +Symbol table '\.symtab' contains 27 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: [0-9a-f]* 0 SECTION LOCAL DEFAULT 1.* @@ -92,19 +92,18 @@ Symbol table '\.symtab' contains 28 entr 9: [0-9a-f]* 0 SECTION LOCAL DEFAULT 9.* 10: [0-9a-f]* 0 SECTION LOCAL DEFAULT 10.* 11: [0-9a-f]* 0 SECTION LOCAL DEFAULT 11.* - 12: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS .*shlib-1\.o - 13: [0-9a-f]* 0 FUNC LOCAL HIDDEN 7 sub1 - 14: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS .*shlib-app-1\.o - 15: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 7 fish - 16: [0-9a-f]* 8 OBJECT LOCAL DEFAULT 9 w - 17: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS - 18: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 6 _DYNAMIC - 19: [0-9a-f]* 4 OBJECT LOCAL DEFAULT 10 c - 20: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 8 _GLOBAL_OFFSET_TABLE_ - 21: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 8 __c6xabi_DSBT_BASE - 22: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 b - 23: [0-9a-f]* 0 NOTYPE WEAK DEFAULT UND g1 - 24: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 g2 - 25: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub0 - 26: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 a - 27: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub + 12: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS .*shlib-app-1\.o + 13: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 7 fish + 14: [0-9a-f]* 8 OBJECT LOCAL DEFAULT 9 w + 15: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS ? + 16: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 6 _DYNAMIC + 17: [0-9a-f]* 4 OBJECT LOCAL DEFAULT 10 c + 18: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 8 _GLOBAL_OFFSET_TABLE_ + 19: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 8 __c6xabi_DSBT_BASE + 20: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 b + 21: [0-9a-f]* 0 FUNC GLOBAL HIDDEN 7 sub1 + 22: [0-9a-f]* 0 NOTYPE WEAK DEFAULT UND g1 + 23: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 g2 + 24: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub0 + 25: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 a + 26: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub --- a/ld/testsuite/ld-tic6x/static-app-1b.rd +++ b/ld/testsuite/ld-tic6x/static-app-1b.rd @@ -14,7 +14,7 @@ Section Headers: \[ 9\] \.neardata PROGBITS [0-9a-f]* [0-9a-f]* 000014 00 WA 0 0 4 \[10\] \.bss NOBITS [0-9a-f]* [0-9a-f]* 000004 00 WA 0 0 4 \[11\] \.c6xabi\.attributes C6000_ATTRIBUTES 00000000 [0-9a-f]* 000019 00 0 0 1 - \[12\] \.symtab SYMTAB 00000000 [0-9a-f]* 0001c0 10 13 22 4 + \[12\] \.symtab SYMTAB 00000000 [0-9a-f]* 0001b0 10 13 20 4 \[13\] \.strtab STRTAB .* \[14\] \.shstrtab STRTAB .* Key to Flags: @@ -78,7 +78,7 @@ Symbol table '\.dynsym' contains 8 entri 6: 00000000 0 NOTYPE WEAK DEFAULT UND g1 7: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 a -Symbol table '\.symtab' contains 28 entries: +Symbol table '\.symtab' contains 27 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: [0-9a-f]* 0 SECTION LOCAL DEFAULT 1.* @@ -92,19 +92,18 @@ Symbol table '\.symtab' contains 28 entr 9: [0-9a-f]* 0 SECTION LOCAL DEFAULT 9.* 10: [0-9a-f]* 0 SECTION LOCAL DEFAULT 10.* 11: [0-9a-f]* 0 SECTION LOCAL DEFAULT 11.* - 12: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS .*shlib-1\.o - 13: [0-9a-f]* 0 FUNC LOCAL HIDDEN 7 sub1 - 14: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS .*shlib-app-1\.o - 15: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 7 fish - 16: [0-9a-f]* 8 OBJECT LOCAL DEFAULT 9 w - 17: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS - 18: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 6 _DYNAMIC - 19: [0-9a-f]* 4 OBJECT LOCAL DEFAULT 10 c - 20: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 8 _GLOBAL_OFFSET_TABLE_ - 21: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 8 __c6xabi_DSBT_BASE - 22: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 b - 23: [0-9a-f]* 0 NOTYPE WEAK DEFAULT UND g1 - 24: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 g2 - 25: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub0 - 26: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 a - 27: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub + 12: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS .*shlib-app-1\.o + 13: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 7 fish + 14: [0-9a-f]* 8 OBJECT LOCAL DEFAULT 9 w + 15: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS ? + 16: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 6 _DYNAMIC + 17: [0-9a-f]* 4 OBJECT LOCAL DEFAULT 10 c + 18: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 8 _GLOBAL_OFFSET_TABLE_ + 19: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 8 __c6xabi_DSBT_BASE + 20: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 b + 21: [0-9a-f]* 0 FUNC GLOBAL HIDDEN 7 sub1 + 22: [0-9a-f]* 0 NOTYPE WEAK DEFAULT UND g1 + 23: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 g2 + 24: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub0 + 25: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 a + 26: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub --- a/ld/testsuite/ld-tic6x/static-app-1r.dd +++ b/ld/testsuite/ld-tic6x/static-app-1r.dd @@ -15,7 +15,7 @@ Disassembly of section \.text: 10000014:[ \t]*0700006e[ \t]*ldw \.D2T2 \*\+b14\(0\),b14 10000018:[ \t]*00000812[ \t]*b \.S2 10000040 1000001c:[ \t]*00000112[ \t]*b \.S2 10000008 -10000020:[ \t]*0ffffc12[ \t]*b \.S2 10000000 +10000020:[ \t]*0ffff812[ \t]*b \.S2 [0-9a-f]+ <_DYNAMIC\+0x[0-9a-f]+> 10000024:[ \t]*01bc62e6[ \t]*ldw \.D2T2 \*\+b15\(12\),b3 10000028:[ \t]*073c82e6[ \t]*ldw \.D2T2 \*\+b15\(16\),b14 1000002c:[ \t]*07800852[ \t]*addk \.S2 16,b15 --- a/ld/testsuite/ld-tic6x/static-app-1r.rd +++ b/ld/testsuite/ld-tic6x/static-app-1r.rd @@ -14,7 +14,7 @@ Section Headers: \[ 9\] \.neardata PROGBITS [0-9a-f]* [0-9a-f]* 00000c 00 WA 0 0 4 \[10\] \.bss NOBITS [0-9a-f]* [0-9a-f]* 000004 00 WA 0 0 4 \[11\] \.c6xabi\.attributes C6000_ATTRIBUTES 00000000 [0-9a-f]* 000019 00 0 0 1 - \[12\] \.symtab SYMTAB 00000000 [0-9a-f]* 0001b0 10 13 21 4 + \[12\] \.symtab SYMTAB 00000000 [0-9a-f]* 0001a0 10 13 19 4 \[13\] \.strtab STRTAB .* \[14\] \.shstrtab STRTAB .* Key to Flags: @@ -76,7 +76,7 @@ Symbol table '\.dynsym' contains 8 entri 6: 00000000 0 NOTYPE WEAK DEFAULT UND g1 7: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 a -Symbol table '\.symtab' contains 27 entries: +Symbol table '\.symtab' contains 26 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: [0-9a-f]* 0 SECTION LOCAL DEFAULT 1.* @@ -90,18 +90,17 @@ Symbol table '\.symtab' contains 27 entr 9: [0-9a-f]* 0 SECTION LOCAL DEFAULT 9.* 10: [0-9a-f]* 0 SECTION LOCAL DEFAULT 10.* 11: [0-9a-f]* 0 SECTION LOCAL DEFAULT 11.* - 12: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS .*shlib-1\.o - 13: [0-9a-f]* 0 FUNC LOCAL HIDDEN 7 sub1 - 14: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS .*shlib-app-1r\.o - 15: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 7 fish - 16: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS - 17: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 6 _DYNAMIC - 18: [0-9a-f]* 4 OBJECT LOCAL DEFAULT 10 c - 19: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 8 _GLOBAL_OFFSET_TABLE_ - 20: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 8 __c6xabi_DSBT_BASE - 21: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 b - 22: [0-9a-f]* 0 NOTYPE WEAK DEFAULT UND g1 - 23: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 g2 - 24: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub0 - 25: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 a - 26: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub + 12: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS .*shlib-app-1r\.o + 13: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 7 fish + 14: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS ? + 15: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 6 _DYNAMIC + 16: [0-9a-f]* 4 OBJECT LOCAL DEFAULT 10 c + 17: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 8 _GLOBAL_OFFSET_TABLE_ + 18: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 8 __c6xabi_DSBT_BASE + 19: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 b + 20: [0-9a-f]* 0 FUNC GLOBAL HIDDEN 7 sub1 + 21: [0-9a-f]* 0 NOTYPE WEAK DEFAULT UND g1 + 22: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 g2 + 23: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub0 + 24: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 a + 25: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub --- a/ld/testsuite/ld-tic6x/static-app-1rb.dd +++ b/ld/testsuite/ld-tic6x/static-app-1rb.dd @@ -15,7 +15,7 @@ Disassembly of section \.text: 10000014:[ \t]*0700006e[ \t]*ldw \.D2T2 \*\+b14\(0\),b14 10000018:[ \t]*00000812[ \t]*b \.S2 10000040 1000001c:[ \t]*00000112[ \t]*b \.S2 10000008 -10000020:[ \t]*0ffffc12[ \t]*b \.S2 10000000 +10000020:[ \t]*0ffff812[ \t]*b \.S2 [0-9a-f]+ <_DYNAMIC\+0x[0-9a-f]+> 10000024:[ \t]*01bc62e6[ \t]*ldw \.D2T2 \*\+b15\(12\),b3 10000028:[ \t]*073c82e6[ \t]*ldw \.D2T2 \*\+b15\(16\),b14 1000002c:[ \t]*07800852[ \t]*addk \.S2 16,b15 --- a/ld/testsuite/ld-tic6x/static-app-1rb.rd +++ b/ld/testsuite/ld-tic6x/static-app-1rb.rd @@ -14,7 +14,7 @@ Section Headers: \[ 9\] \.neardata PROGBITS [0-9a-f]* [0-9a-f]* 00000c 00 WA 0 0 4 \[10\] \.bss NOBITS [0-9a-f]* [0-9a-f]* 000004 00 WA 0 0 4 \[11\] \.c6xabi\.attributes C6000_ATTRIBUTES 00000000 [0-9a-f]* 000019 00 0 0 1 - \[12\] \.symtab SYMTAB 00000000 [0-9a-f]* 0001b0 10 13 21 4 + \[12\] \.symtab SYMTAB 00000000 [0-9a-f]* 0001a0 10 13 19 4 \[13\] \.strtab STRTAB .* \[14\] \.shstrtab STRTAB .* Key to Flags: @@ -76,7 +76,7 @@ Symbol table '\.dynsym' contains 8 entri 6: 00000000 0 NOTYPE WEAK DEFAULT UND g1 7: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 a -Symbol table '\.symtab' contains 27 entries: +Symbol table '\.symtab' contains 26 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: [0-9a-f]* 0 SECTION LOCAL DEFAULT 1.* @@ -90,18 +90,17 @@ Symbol table '\.symtab' contains 27 entr 9: [0-9a-f]* 0 SECTION LOCAL DEFAULT 9.* 10: [0-9a-f]* 0 SECTION LOCAL DEFAULT 10.* 11: [0-9a-f]* 0 SECTION LOCAL DEFAULT 11.* - 12: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS .*shlib-1\.o - 13: [0-9a-f]* 0 FUNC LOCAL HIDDEN 7 sub1 - 14: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS .*shlib-app-1r\.o - 15: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 7 fish - 16: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS - 17: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 6 _DYNAMIC - 18: [0-9a-f]* 4 OBJECT LOCAL DEFAULT 10 c - 19: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 8 _GLOBAL_OFFSET_TABLE_ - 20: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 8 __c6xabi_DSBT_BASE - 21: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 b - 22: [0-9a-f]* 0 NOTYPE WEAK DEFAULT UND g1 - 23: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 g2 - 24: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub0 - 25: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 a - 26: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub + 12: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS .*shlib-app-1r\.o + 13: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 7 fish + 14: [0-9a-f]* 0 FILE LOCAL DEFAULT ABS ? + 15: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 6 _DYNAMIC + 16: [0-9a-f]* 4 OBJECT LOCAL DEFAULT 10 c + 17: [0-9a-f]* 0 OBJECT LOCAL DEFAULT 8 _GLOBAL_OFFSET_TABLE_ + 18: [0-9a-f]* 0 NOTYPE LOCAL DEFAULT 8 __c6xabi_DSBT_BASE + 19: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 b + 20: [0-9a-f]* 0 FUNC GLOBAL HIDDEN 7 sub1 + 21: [0-9a-f]* 0 NOTYPE WEAK DEFAULT UND g1 + 22: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 g2 + 23: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub0 + 24: [0-9a-f]* 4 OBJECT GLOBAL DEFAULT 9 a + 25: [0-9a-f]* 52 FUNC GLOBAL DEFAULT 7 sub From patchwork Fri Apr 10 13:32:10 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 132913 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 2641F4BA2E0F for ; Fri, 10 Apr 2026 13:33:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2641F4BA2E0F Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=TuFw/Wkz X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id 87D6C4BA2E32 for ; Fri, 10 Apr 2026 13:32:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 87D6C4BA2E32 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 87D6C4BA2E32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::333 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775827933; cv=none; b=qpP8kaJKmc7B7k6S3AkZm4DeOr4FzeIuWtoTuhpzEC90TxguBfjM3HZSpa5vfXcbRhaefbd7zEGWeKGTDdYxqOYuAX5qZIBdPgnKJrECAURF/ld9PUpDrLVDNqIH2Va1j82WXy8GAK728CNm61X3XDamPuCz792e6GYUXfG62QY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775827933; c=relaxed/simple; bh=8yo2S+JMK1/Fya1g7Tl7+mgB0GKJU8rIctRxK5P+ggY=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=upSgga5ulkVHBEbXcECtr8z/jLhzCThDcnjIdrNaJcasIp6ND7I/Dptw49yrA7zimK/1VQ7Z81bG/6+Cbg/furg76t+ueAcAsbTcPwliNcsV98idqRgw3/3ZA6nhIIoKKMvOJhEbHy1CucFt1ThQfD5elADdlMmxifuwmnxVjRo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 87D6C4BA2E32 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-488b00ed86fso22033505e9.3 for ; Fri, 10 Apr 2026 06:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1775827932; x=1776432732; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=QJHD2hA81fU3WwP3MmK3JeYCh6jGLTVPkdrOAuku6oA=; b=TuFw/WkzBco0/LsMrlV3rx6woWGMqj+Ucj6cCnDPCFiprp8o9tTT48KvfIsyoFwr0t 8sbaqoKd1+CqLeIBQW5N69bvcudbtevF5xONWfo4Fd85W/HCubDRv8yr4XYzNTtaHYDW FKECo8M3yykvlallU2f8IdQNH3LQZYJvwgLzBRN/v3VEHqPVWf3axfD1lqA9HbUWzTX6 CzEFkXvwbhm4ThNhe6EQC+vKXg0WDKhWolQSbrHI0hm21tKeb2R3XJHQwRgqGemmqTY7 R+hJqEPZBKjhqSQhFRn5uxLDwQpcLF+GiQ7Rg8cnNY89pOSFWYIqJcUnr/iC/VM++12A RX0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775827932; x=1776432732; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QJHD2hA81fU3WwP3MmK3JeYCh6jGLTVPkdrOAuku6oA=; b=VcG9eLHv/F7Cz42ifIIVQf4bG5/S7a6vob5IPP6XjIeq1CXQoerLHR+BXIs8OYe2YF YTUWUpQbYzNpGuBX5O1Y76/9dv9JF2cjKGwEZTZnBSf5BIXHN7iD73t7bmmn9+l8aLlF sKNfweUIrPjQ92O6EY+s3gbQhJO+TTCiHdFcOjXgveErj027D5q+4nLl9I0JfBO1rkN1 vLFTOmX73hZdv9MzN4Fsona8ApOQaGPrjwKsPn5G0km0XBD/xZF6baNno46pYhoDN/03 wF29E5cUa5qIx6AXeXL17lncC4XPLSJFspnql80lZ+VV/PyO4ggs5ufGV6NRqjmNhNg3 oUGg== X-Gm-Message-State: AOJu0Ywt9i0jhAp7qYHxmrt8j/LRXXVQDTMqyFAKhBfZa/ArHQ9ORDzz 0ujEq1hm04MVe/c7zlCn2axcEfk4Fe3Bx34F2MbFvWeo2u5Fm+M4GmZpNbMbdTDdeXHLuFIQvL0 pqnKh/Q== X-Gm-Gg: AeBDietUOZcsnoLRdTkR0HVnOgjVphWPIo9AfyordZFNtIW+hGblKiZWGdkqQHA3uUM SRUpRD0EwofBLGgrB2lKU8lb26lCAP5GZ4sVa6LrljrIO8ua/hk9W5ePnC2im4sJOZXd8TKU4OH OI9BC4MUCCELXTlG5sitjnxdS3NR3i9c7H/VQK6xR496Bq0LFKNpvt5IN3LvF8dVs1dyA6Y4+15 BWO0ohKPqCm9QATMSQjK40dcO50ylWufcNyUt0iRno7vuG5AZxr2uRm9zoIpIzjLGAHKsEUnFnA yQ6Pl81wlO/PYv1s6y53pBEUXq5+sEixsgT4oSh5pwl0x4e+msd/R4Kqh47Ak7EN89bQjt3hhOn wieUW9OoxK45qmKSArwDTi7FvqOavWdY1xWsLZV10TlDiYiTU+r9sznUpnSlPg9WI13Xhr32mHh KY23NxRZv6yG1bq3mqWzdop42i3/WWzWXVN3YoererCW/Bg0WZgTFffFtR4BzClJFCKsKEBs7cJ LcyKbDH25t1RUU= X-Received: by 2002:a05:600c:5299:b0:487:1fb4:7e1 with SMTP id 5b1f17b1804b1-488d6875f3emr39502615e9.22.1775827932288; Fri, 10 Apr 2026 06:32:12 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d63deb904sm8270194f8f.9.2026.04.10.06.32.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Apr 2026 06:32:12 -0700 (PDT) Message-ID: <40a01241-563a-44ce-aeb9-4ae8fa55c8f3@suse.com> Date: Fri, 10 Apr 2026 15:32:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 3/3] objcopy: zap ELF visibility when localizing symbols From: Jan Beulich To: Binutils References: Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: X-Spam-Status: No, score=-3016.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org The spec explicitly precludes STB_LOCAL together with STV_PROTECTED (and, implicitly, STV_HIDDEN or STV_INTERNAL), so we better wouldn't (entirely silently) write out symbols violating this. --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1532,6 +1532,15 @@ is_hidden_symbol (asymbol *sym) return false; } +static void +clear_visibility (asymbol *sym) +{ + elf_symbol_type *elf_sym = elf_symbol_from (sym); + + if (elf_sym != NULL) + elf_sym->internal_elf_sym.st_other &= ~ELF_ST_VISIBILITY (~0); +} + /* Empty name is hopefully never a valid symbol name. */ static const char * empty_name = ""; @@ -1765,6 +1774,7 @@ filter_symbols (bfd *abfd, bfd *obfd, as { flags &= ~(BSF_GLOBAL | BSF_WEAK); flags |= BSF_LOCAL; + clear_visibility (sym); } else if (!undefined --- a/binutils/testsuite/binutils-all/localize-hidden-1.d +++ b/binutils/testsuite/binutils-all/localize-hidden-1.d @@ -4,15 +4,15 @@ #name: --localize-hidden test 1 #warning_output: localize-hidden-1.l #... -0+1200 l .*\*ABS\* 0+ \.hidden Lhidden -0+1300 l .*\*ABS\* 0+ \.internal Linternal -0+1400 l .*\*ABS\* 0+ \.protected Lprotected +0+1200 l .*\*ABS\* 0+ (\.hidden )?Lhidden +0+1300 l .*\*ABS\* 0+ (\.internal )?Linternal +0+1400 l .*\*ABS\* 0+ (\.protected )?Lprotected 0+1100 l .*\*ABS\* 0+ Ldefault #... -0+2200 l .*\*ABS\* 0+ \.hidden Ghidden -0+2300 l .*\*ABS\* 0+ \.internal Ginternal -0+3200 l .*\*ABS\* 0+ \.hidden Whidden -0+3300 l .*\*ABS\* 0+ \.internal Winternal +0+2200 l .*\*ABS\* 0+ Ghidden +0+2300 l .*\*ABS\* 0+ Ginternal +0+3200 l .*\*ABS\* 0+ Whidden +0+3300 l .*\*ABS\* 0+ Winternal #... 0+2100 g .*\*ABS\* 0+ Gdefault 0+2400 g .*\*ABS\* 0+ \.protected Gprotected