From patchwork Mon Jun 26 09:16:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 112807 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7347042vqr; Mon, 26 Jun 2023 02:17:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ41vrYcVO7hNGhI+4yIM69jGzlF2GNhXxkHGM74LMu3nfsMMlPJ9vC2pzZ/9hWURVABHwLn X-Received: by 2002:a17:907:3605:b0:96a:52e:5379 with SMTP id bk5-20020a170907360500b0096a052e5379mr19659534ejc.63.1687771043548; Mon, 26 Jun 2023 02:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687771043; cv=none; d=google.com; s=arc-20160816; b=FDE+8pTbbqtqs3T6HXoo5PrboIPx1kFy+dwE8048kOBsxs+5xIhcLCaVOE4wjnHX58 Q26S6akoiwjC/SsTkCYf+vLiAXMV0jz6vE+6BiDiAWB6r5Wyp4T8EuhCuICjEEqywiZy 6/+5BMbhrHudeolQGGWTjqTc8VN8mZ0C1ggWhkLN74ptMcsb2lPQTYu90PZjzNrgEzrT upiE7gIKlVqD3yyIBcGBqpwGzfPpZxfYSPzkrFD7PvF2UgoBAWKD7vgjzXDHk4XwWgBu RQ2t360xznuK7m6HB8ZMEigmgIm8F7A1wB+IhhAT3AoOReUtzqtPgHyf7q6ss4CiVQgt GG5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=mNqDS0XBisl0OQSBU/pwu/nJpDf9uADsDBDrqlb8LOc=; fh=sSamgrGhOZEnFM9kFYY6RhTqUl4gamh34WnHk3A4zIk=; b=tyeLWAofQP/OXbIXAcdmowrTWJEjE9hvHhnZWAS/wymADgi7qevZnEtjjjhleTVFcR Atzc/+Hgq73OQ5p117lq634yXbKLxv86v+RRVwxmDD5HFDgIeFsBdKRcWv2FHHP7pzXP MwE0hXgziRYFUMu1+C2r4p9I4cBEHHkocWtFxnsF5B41gfSML3lspcWDsNdbyYPIH2dA 7oCIYwK+JgpUVOPcaAqc7j2Xw3lXlOC93aV+qV+0IgqX3//Voq+Ictjy26BuKOcpeCY/ Jr2Y+HXdTSF6kklQRc/yVjSiuHin6HAR5MaGSMrXG1LUCxt2fynx7iwfvXNCaG7azgM8 fFAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=en3aVuid; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id r7-20020a170906280700b00987a1ee44d7si2722057ejc.691.2023.06.26.02.17.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 02:17:23 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=en3aVuid; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5BA4B3858D20 for ; Mon, 26 Jun 2023 09:17:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5BA4B3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1687771035; bh=mNqDS0XBisl0OQSBU/pwu/nJpDf9uADsDBDrqlb8LOc=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=en3aVuidUw2ez4bI+AeQYH7qFwLVoTtaZIxZ6r/M+blvNQKGO6vF2IYbRD7Nm3aqG owU9hnMgbyhnXKsMWeg+9R5fuNz7hbD6NXkXKkecbOMvgXe2sQpzymRUVqXlZMe+My 522ZPdDBON6WHoBlj6dXHVaMG9zRTYudyN33rSIg= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 99FC73858409 for ; Mon, 26 Jun 2023 09:17:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99FC73858409 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35Q8jpTI010033 for ; Mon, 26 Jun 2023 09:17:02 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rf7ex8yhp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 26 Jun 2023 09:17:02 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35Q8wGBf019818 for ; Mon, 26 Jun 2023 09:17:01 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rf7ex8yex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Jun 2023 09:17:01 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35Q5xr8X014878; Mon, 26 Jun 2023 09:16:59 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma06fra.de.ibm.com (PPS) with ESMTPS id 3rdqre0u4p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Jun 2023 09:16:59 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35Q9Gu6I17171014 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Jun 2023 09:16:56 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CD1E220043; Mon, 26 Jun 2023 09:16:56 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 952E920040; Mon, 26 Jun 2023 09:16:56 +0000 (GMT) Received: from li-ecc9ffcc-3485-11b2-a85c-e633c5126265.fritz.box (unknown [9.179.6.127]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 26 Jun 2023 09:16:56 +0000 (GMT) To: binutils@sourceware.org Cc: amodra@gmail.com Subject: [PATCH] ld - Add SYMBOL_ABI_ALIGNMENT variable and apply to __bss_start Date: Mon, 26 Jun 2023 11:16:56 +0200 Message-Id: <20230626091656.31782-1-krebbel@linux.ibm.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: BIGyQqX9k0cIQIuTFOq4vyoIMLg1ED-N X-Proofpoint-ORIG-GUID: GS3i-nbmD1EFfkXe5PwKxk7YPaUaktSh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-26_06,2023-06-22_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxscore=0 malwarescore=0 mlxlogscore=631 clxscore=1015 adultscore=0 lowpriorityscore=0 priorityscore=1501 phishscore=0 spamscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306260082 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Andreas Krebbel via Binutils From: Andreas Krebbel Reply-To: Andreas Krebbel Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769756210013567600?= X-GMAIL-MSGID: =?utf-8?q?1769756210013567600?= Currently not specific alignment is applied to the __bss_start symbol. However, on s390x we require every symbol to be on an even address. The patch introduces a new variable for the elf.sc template which allows to specify such an symbol alignment requirement. ld/ * scripttempl/elf.sc: New variable SYMBOL_ABI_ALIGNMENT. Apply to __bss_start. * emulparams/elf_s390.sh: Set SYMBOL_ABI_ALIGNMENT to 2. * emulparams/elf64_s390.sh: Likewise. --- ld/emulparams/elf64_s390.sh | 1 + ld/emulparams/elf_s390.sh | 1 + ld/scripttempl/elf.sc | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ld/emulparams/elf64_s390.sh b/ld/emulparams/elf64_s390.sh index 899efd7f532..d0a2a59a092 100644 --- a/ld/emulparams/elf64_s390.sh +++ b/ld/emulparams/elf64_s390.sh @@ -17,6 +17,7 @@ EXTRA_EM_FILE=s390 IREL_IN_PLT= SEPARATE_GOTPLT=0 test -z "$RELRO" && unset SEPARATE_GOTPLT +SYMBOL_ABI_ALIGNMENT=2 # Treat a host that matches the target with the possible exception of "x" # in the name as if it were native. diff --git a/ld/emulparams/elf_s390.sh b/ld/emulparams/elf_s390.sh index cb1c6b5b04d..1b2fca3f937 100644 --- a/ld/emulparams/elf_s390.sh +++ b/ld/emulparams/elf_s390.sh @@ -12,3 +12,4 @@ GENERATE_SHLIB_SCRIPT=yes GENERATE_PIE_SCRIPT=yes NO_SMALL_DATA=yes IREL_IN_PLT= +SYMBOL_ABI_ALIGNMENT=2 diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 1e3c5aa8504..59a851fb47d 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -78,6 +78,8 @@ # USER_LABEL_PREFIX - prefix to add to user-visible symbols. # RODATA_NAME, SDATA_NAME, SBSS_NAME, BSS_NAME - base parts of names # for standard sections, without initial "." or suffixes. +# SYMBOL_ABI_ALIGNMENT - minimum alignment in bytes which needs to be +# applied to every symbol definition # # When adding sections, do note that the names of some sections are used # when specifying the start address of the next. @@ -165,6 +167,7 @@ if test -z "$GOT"; then GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt)${RELOCATING+ *(.igot.plt)} }" fi fi +test -z "${SYMBOL_ABI_ALIGNMENT}" && SYMBOL_ABI_ALIGNMENT=1 REL_IFUNC=".rel.ifunc ${RELOCATING-0} : { *(.rel.ifunc) }" RELA_IFUNC=".rela.ifunc ${RELOCATING-0} : { *(.rela.ifunc) }" REL_IPLT=".rel.iplt ${RELOCATING-0} : @@ -678,7 +681,7 @@ cat <