From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by sourceware.org (Postfix) with ESMTPS id C21383945050 for ; Tue, 10 Mar 2020 13:34:59 +0000 (GMT) Received: by mail-qk1-x741.google.com with SMTP id c145so6866848qke.12 for ; Tue, 10 Mar 2020 06:34:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=GuJL1DhCFeBIBoMk8nxstm1S9I6ByQHNlmhsyfWqnpM=; b=Uk9Hwv97F7vKLfgVfpVktV1bgfEOhed9wqdkfqohwGwoZgcnQOzorwnRQh2hrDwda8 8uzcLJ0WxCNV5AjQzE8fvlCeQD6UjNqNRtgnKBjqPhgBjh6SDrRgCXS24R4//h5EOmzq CECGDinR9NPN4qCMXyNO42AW94z++YrJi1DuN0HFST0KI6OKGhgkdtMcCdjzqG3NLPwr pWT5OFORDsqU8AQd2YmAZKhHxVGf9GPYZ23SItY/Fw1HksDY7JkFCu6txpetqI5WpRL8 ynY45z0XZjb0Zt+e764hMbwgoI+m6IBfqHjReS0pXQnJtrWvtixofZNnKFF7ys/+LOwG ml7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=GuJL1DhCFeBIBoMk8nxstm1S9I6ByQHNlmhsyfWqnpM=; b=DbKeBhMX5XCfHfJyS+NYKQtefJhS8ZM8LpG/xgDLWoFk4dz+EsJbsuWEt8/VotYtd8 FkhDgP7kt1ZXsHPAGMThvyvSvZp4owsE4ch2ecAM2i+gAXHqua0WmuEhMB7GABIGwxbI 4X73HDETrvMSvnhaE01G5Ys8yBij4WSZxWHV1ukwcMTvXTs00X7JdJRn3m3M4764gCGZ EqdK1/1PsV4TX1GhjdYorhtVny3g5Fa3E6ZbioK8fgw47nN4EHMKfnqNvafWz1z4Fx3z HOAP6R1wDwhanOwZ3q82SW04dOWJGhYGuoBnyeUdONK/S+5YbHPJ7EW5SckMpqQ/5hPz MtMw== X-Gm-Message-State: ANhLgQ1cB+A0tkrxdNgr5sDoNnWNlt82I/F1ixtAtRLYPlbpzFqBNUfL rT4+S0iR1oXQ/p2PBNCXNzYq9UecOMY= X-Google-Smtp-Source: ADFU+vut19C3z00Cnhquoj/cGo5YJOflv9Jg7H0hHPr2WKa0B1wNkCfhODJhhLO43YOQtN5lMozxrQ== X-Received: by 2002:a05:620a:1362:: with SMTP id d2mr20215521qkl.120.1583847298867; Tue, 10 Mar 2020 06:34:58 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id g2sm23674070qkb.27.2020.03.10.06.34.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 06:34:58 -0700 (PDT) From: Adhemerval Zanella To: libc-stable@sourceware.org Subject: [2.31 COMMITTED] i386: Use comdat instead of .gnu.linkonce for i386 setup pic register (BZ #20543) Date: Tue, 10 Mar 2020 10:34:50 -0300 Message-Id: <20200310133454.20821-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-27.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS 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: libc-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2020 13:35:00 -0000 GCC has moved from using .gnu.linkonce for i386 setup pic register with minimum current version (as for binutils minimum binutils that support comdat). Trying to pinpoint when binutils has added comdat support for i686, it seems it was around 2004 [1]. I also checking with some ancient binutils older than 2.16 I see: test.o: In function `__x86.get_pc_thunk.bx': test.o(.text.__x86.get_pc_thunk.bx+0x0): multiple definition of `__x86.get_pc_thunk.bx' /usr/lib/gcc/x86_64-linux-gnu/5/../../../i386-linux-gnu/crti.o(.gnu.linkonce.t.__x86.get_pc_thunk.bx+0x0): first defined here Which seems that such version can not handle either comdat at all or a mix of linkonce and comdat. For binutils 2.16.1 I am getting a different issue trying to link a binary with and more recent ctri.o (unrecognized relocation (0x2b) in section `.init', which is R_386_GOT32X and old binutils won't generate it anyway). So I think that either unlikely someone will use an older binutils than the one used to glibc and even this scenario may fail with some issue as the R_386_GOT32X. Also, 2.16.1 is quite old and not really supported (glibc itself required 2.25). Checked on i686-linux-gnu. [1] https://gcc.gnu.org/ml/gcc/2004-05/msg00030.html (cherry picked from commit 35200fd3892f6caf867bf89bc8048e553906af28) --- sysdeps/i386/sysdep.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h index b4bcd8fb6c..6094af8fec 100644 --- a/sysdeps/i386/sysdep.h +++ b/sysdeps/i386/sysdep.h @@ -61,7 +61,7 @@ lose: SYSCALL_PIC_SETUP \ # define SETUP_PIC_REG(reg) \ .ifndef GET_PC_THUNK(reg); \ - .section .gnu.linkonce.t.GET_PC_THUNK(reg),"ax",@progbits; \ + .section .text.GET_PC_THUNK(reg),"axG",@progbits,GET_PC_THUNK(reg),comdat; \ .globl GET_PC_THUNK(reg); \ .hidden GET_PC_THUNK(reg); \ .p2align 4; \ @@ -97,7 +97,8 @@ GET_PC_THUNK(reg): \ # define SETUP_PIC_REG_STR(reg) \ ".ifndef " GET_PC_THUNK_STR (reg) "\n" \ - ".section .gnu.linkonce.t." GET_PC_THUNK_STR (reg) ",\"ax\",@progbits\n" \ + ".section .text." GET_PC_THUNK_STR (reg) ",\"axG\",@progbits," \ + GET_PC_THUNK_STR (reg) ",comdat\n" \ ".globl " GET_PC_THUNK_STR (reg) "\n" \ ".hidden " GET_PC_THUNK_STR (reg) "\n" \ ".p2align 4\n" \ -- 2.17.1