From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 964 invoked by alias); 7 Aug 2012 08:25:12 -0000 Received: (qmail 917 invoked by uid 22791); 7 Aug 2012 08:25:05 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-pb0-f41.google.com (HELO mail-pb0-f41.google.com) (209.85.160.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Aug 2012 08:24:52 +0000 Received: by pbbjt11 with SMTP id jt11so3830029pbb.0 for ; Tue, 07 Aug 2012 01:24:52 -0700 (PDT) Received: by 10.68.197.202 with SMTP id iw10mr25844549pbc.161.1344327892120; Tue, 07 Aug 2012 01:24:52 -0700 (PDT) Received: from localhost.localdomain ([124.207.145.166]) by mx.google.com with ESMTPS id wh7sm7306364pbc.33.2012.08.07.01.24.47 (version=SSLv3 cipher=OTHER); Tue, 07 Aug 2012 01:24:50 -0700 (PDT) Message-ID: <5020D0CA.9010306@gmail.com> Date: Tue, 07 Aug 2012 10:25:00 -0000 From: "WANG.Jiong" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: davem@davemloft.net, iant@google.com CC: binutils@sourceware.org Subject: [GOLD] question about gold handling SPARC style .rela.plt, .rela.plt overlapping Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2012-08/txt/msg00119.txt.bz2 Hi David & Ian, currently, I am porting gold linker for a private target which allow PLTREL overlapping so, I met exactly the same problem as you have discussed two years ago http://sourceware.org/ml/binutils/2010-02/msg00140.html I see you have done a fix with the following logic: 1. .rela.dyn, .rela.plt are seperate 2. generate DT_RELA only when there is .rela.dyn, and DT_RELASZ be the total size of both .rela.dyn and .rela.plt But, If there is no .rela.dyn, without DT_RELA, it seems dynamic linker behave incorrectly when ELF_MACHINE_PLTREL_OVERLAP defined I checked the implementation of _ELF_DYNAMIC_DO_RELOC in glib elf/dynamic-link.h:260 # define _ELF_DYNAMIC_DO_RELOC(RELOC, reloc, map, do_lazy, skip_ifunc, test_rel) without DT_REL or DT_RELA, ranges[0] are not initialized properly. So, should we always generate DT_RELA, DT_RELASZ, DT_RELAENT, and make DT_RELA, DT_RELASZ exactly the same value as DT_JMPREL, DT_PLTRELSZ ? that is, for the following condition check in Layout::add_target_dynamic_tags 4344 if (dyn_rel != NULL && dyn_rel->output_section() != NULL) 4345 { 4346 odyn->add_section_address(use_rel ? elfcpp::DT_REL : elfcpp::DT_RELA, 4347 dyn_rel->output_section()); 4348 if (plt_rel != NULL 4349 && plt_rel->output_section() != NULL 4350 && dynrel_includes_plt) should we check dynrel_includes_plt even when dyn_rel == NULL ? or I have misunderstood something ? thanks very much --- Regards, WANG.Jiong