From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105992 invoked by alias); 20 Apr 2015 18:04:37 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 105763 invoked by uid 89); 20 Apr 2015 18:04:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,MALFORMED_FREEMAIL,MISSING_HEADERS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ig0-f169.google.com Received: from mail-ig0-f169.google.com (HELO mail-ig0-f169.google.com) (209.85.213.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 20 Apr 2015 18:04:34 +0000 Received: by igbyr2 with SMTP id yr2so66519408igb.0 for ; Mon, 20 Apr 2015 11:04:32 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.50.111.168 with SMTP id ij8mr22734284igb.43.1429553072548; Mon, 20 Apr 2015 11:04:32 -0700 (PDT) Received: by 10.107.13.133 with HTTP; Mon, 20 Apr 2015 11:04:32 -0700 (PDT) Date: Mon, 20 Apr 2015 18:04:00 -0000 Message-ID: Subject: Re: [AArch64] PR18270, fix handling of GOT entry for local symbol From: Jiong Wang Cc: binutils@sourceware.org Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00304.txt.bz2 2015-04-20 17:22 GMT+01:00 Jiong Wang : > > I reproduced on current binutils-gdb HEAD. The reason is as what RTH has > explained we are handling GOT entry for local symbol incorrectly thus > that relocation still relocate the symbol itself instead of the > associated GOT entry. While the symbol itself may contains value not > 8bytes aligned, then trigger alignment check errors. > > Even worse, if that symbol contains a value 8bytes aligned, then we pass > the later alignment check, report nothing, and generate buggy binary > silently. > > The patch will handle GOT entry for local symbol as the following: > > * apply the relocation using GOT entry address. > * generate a R_AARCH64_RELATIVE relocation for the GOT entry, so the local > symbol's address could be updated with the shared object's runtime base address. > > OK for trunk? > > no regression on binutils-gdb native test. > pass the testcase given by David. > pass my small "exectuable + .so" execution test, verified the runtime behavior is OK. > Sorry, should be PR18270. 2015-04-20 Jiong. Wang bfd/ PR18270 * elfnn-aarch64.c (elfNN_aarch64_size_dynamic): Count local symbol for GOT_NORMAL for both sgot/srelgot section. (elfNN_aarch64_final_link_relocate): Relocate against GOT entry address and generate necessary runtime relocation for GOT entry. Regards, Jiong