From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28602 invoked by alias); 12 Jul 2006 01:16:17 -0000 Received: (qmail 28594 invoked by uid 22791); 12 Jul 2006 01:16:16 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 12 Jul 2006 01:16:13 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k6C1GBpX018971 for ; Tue, 11 Jul 2006 21:16:11 -0400 Received: from post-office.corp.redhat.com (post-office.corp.redhat.com [172.16.52.227]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k6C1GBWh021976 for ; Tue, 11 Jul 2006 21:16:11 -0400 Received: from greed.delorie.com (dj.cipe.redhat.com [10.0.0.222]) by post-office.corp.redhat.com (8.11.6/8.11.6) with ESMTP id k6C1G9R28932 for ; Tue, 11 Jul 2006 21:16:09 -0400 Received: from greed.delorie.com (greed.delorie.com [127.0.0.1]) by greed.delorie.com (8.13.1/8.13.1) with ESMTP id k6C1G518029651 for ; Tue, 11 Jul 2006 21:16:05 -0400 Received: (from dj@localhost) by greed.delorie.com (8.13.1/8.13.1/Submit) id k6C1Fx2x029648; Tue, 11 Jul 2006 21:15:59 -0400 Date: Wed, 12 Jul 2006 01:16:00 -0000 Message-Id: <200607120115.k6C1Fx2x029648@greed.delorie.com> From: DJ Delorie To: binutils@sourceware.org Subject: mn10300 relaxation vs got X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00149.txt.bz2 In bfd/elf-m10300.c's mn10300_elf_relax_section(), we have this code: /* Try to turn a 32bit immediate, displacement or absolute address into a 16bit immediate, displacement or absolute address. */ if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_32 || ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOT32 || ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOTOFF32 || ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOTPC32) However, GOTPC32 is not an immediate, displacement, or absolute address. It's a pc-relative special case. The attached sample code demonstrates a problem with this: relaxing can move the opcode too far away for the relaxed value to fit (the values are carefully chosen so that the GOT relax must happen before the others). Why is GOTPC32 included in this part of the code? As a cross-section pcrel reloc, it seems to me that it would be difficult to properly relax these, except perhaps as a single pass after everything else, so we know these opcodes won't move any more after they've been relaxed. Ideas? Can we just not relax those for now? ---------- 8< ---------- dj.s ---------- 8< ---------- .text .global _start _start: add foo+32607,a0 add foo+32607,a0 add foo+32607,a0 add foo+32607,a0 add foo+32607,a0 add foo+32607,a0 .LIL1: mov pc,a2 add _GLOBAL_OFFSET_TABLE_+150-(.LIL1-.),a2 nop .global foo foo: nop ---------- 8< ---------- dj.ld ---------- 8< ---------- OUTPUT_FORMAT("elf32-am33lin", "elf32-am33lin", "elf32-am33lin") OUTPUT_ARCH(mn10300) ENTRY(_start) SECTIONS { /* Read-only sections, merged into text segment: */ PROVIDE (__executable_start = 0x000000); . = 0x000000 + SIZEOF_HEADERS; .text : { *(.text) } =0xcbcb . = 0x8000; .got : { *(.got.plt) *(.got) } .data : { *(.data) } }