From patchwork Tue Aug 9 13:34:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 14450 Received: (qmail 35401 invoked by alias); 9 Aug 2016 13:35:19 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 34060 invoked by uid 89); 9 Aug 2016 13:35:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=TCB, tcb, family X-HELO: mx0a-001b2d01.pphosted.com X-IBM-Helo: d06dlp01.portsmouth.uk.ibm.com X-IBM-MailFrom: stli@linux.vnet.ibm.com X-IBM-RcptTo: libc-alpha@sourceware.org To: libc-alpha@sourceware.org From: Stefan Liebler Subject: [PATCH] S390: Support PLT and GOT references in check-localplt. Date: Tue, 9 Aug 2016 15:34:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16080913-0020-0000-0000-000001E530D9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16080913-0021-0000-0000-00001D0C0A07 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-09_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608090141 Hi, on s390x the test elf/check-localplt is failing after recent commits: "elf: Do not use memalign for TCB/TLS blocks allocation [BZ #17730]" "elf: Avoid using memalign for TLS allocations [BZ #17730]" "elf: dl-minimal malloc needs to respect fundamental alignment" due to "Missing required PLT reference: ld.so: __libc_memalign". After the commits __libc_memalign is only called in elf/dl-minimal.c in malloc() function in ld.so and gcc -O2/-O3 leads to R_390_GLOB_DAT instead of R_390_JMP_SLOT. __libc_memalign is called via function-pointer loaded from GOT instead of calling via a plt-stub. In this case there is the R_390_GLOB_DAT relocation in section .rela.dyn instead of R_390_JMP_SLOT in .rela.plt. This patch marks ld.so: __libc_memalign with R_390_GLOB_DAT in localplt.data to allow both relocations. If build with -fno-optimize-sibling-calls or on s390(31bit) a R_390_JMP_SLOT is generated. Okay to commit? Bye Stefan ChangeLog: * sysdeps/unix/sysv/linux/s390/localplt.data: Mark ld.so: __libc_memalign with "+ RELA R_390_GLOB_DAT". diff --git a/sysdeps/unix/sysv/linux/s390/localplt.data b/sysdeps/unix/sysv/linux/s390/localplt.data index b25abf8..1226413 100644 --- a/sysdeps/unix/sysv/linux/s390/localplt.data +++ b/sysdeps/unix/sysv/linux/s390/localplt.data @@ -8,7 +8,14 @@ libm.so: matherr # The dynamic loader uses __libc_memalign internally to allocate aligned # TLS storage. The other malloc family of functions are expected to allow # user symbol interposition. -ld.so: __libc_memalign +# It is also allowed to call __libc_memalign via function-pointer loaded from +# GOT instead of calling via a plt-stub. In this case there is a R_390_GLOB_DAT +# relocation in section .rela.dyn instead of R_390_JMP_SLOT in .rela.plt. +# After commit "elf: Do not use memalign for TCB/TLS blocks allocation +# [BZ #17730]" __libc_memalign is only called in elf/dl-minimal.c: malloc() in +# ld.so and gcc -O2/-O3 leads to R_390_GLOB_DAT. If build with +# -fno-optimize-sibling-calls an R_390_JMP_SLOT is generated. +ld.so: __libc_memalign + RELA R_390_GLOB_DAT ld.so: malloc ld.so: calloc ld.so: realloc