bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

-relax broken for SH assembler


From: Richard Shann
Subject: -relax broken for SH assembler
Date: Wed, 13 Jun 2001 13:59:39 +0100

The SH4 assembler source

/************** relax.s ******************/

        .L3:
        mov.l   .L13,r1
        .uses .L3
        jsr     @r1
        nop
        .L13:
        .long   foo
/*********** end of relax.s **************/

When assembled with -relax

3.0-20010507/bin/sh-hitachi-elf-as -v -relax relax.s -o relax.o

coredumps as follows

3.0-20010507/bin/sh-hitachi-elf-as -v -relax relax.s -o relax.o
GNU assembler version 2.11.90.0.7 (sh-hitachi-elf) using BFD version
2.11.90.0.7
Segmentation Fault (core dumped).
Version 2.10.1 does the same
Some earlier versions do not coredump eg 2.9.1, but do not seem to generate
correct object code. for example with the source
/********************** relax2.s ******************/
before:
        .L3:
        mov.l   .L13,r1
        .uses .L3
        jsr     @r1
after:
        nop
        nop
        .L13:
        .long   foo
        .long after - before

/**************** end of relax2.s *****************/

the idea is to test whether the value (after-before) is correctly stored if the
branch is shortened by relaxation.

sh-hitachi-elf-as -relax -v relax2.s -o relax2.o
GNU assembler version 2.9.1 (sh-hitachi-elf), using BFD version 2.9.1

generates an object file with no information to enable the value (after-before)
to be re-calculated at link time as seen from the relocation section:

sh-hitachi-elf-objdump -r relax2.o

relax2.o:     file format elf32-sh

RELOCATION RECORDS FOR [.text]:
OFFSET   TYPE              VALUE
00000000 R_SH_CODE         *ABS*
00000000 R_SH_DIR8WPL      .text
00000002 R_SH_USES         .text+0xfffffffa
00000004 R_SH_LABEL        *ABS*
00000008 R_SH_LABEL        *ABS*
00000008 R_SH_DATA         *ABS*
00000008 R_SH_DIR32        foo
00000008 R_SH_COUNT        *ABS*+0x00000001


I've been trying to get this working with a view to understanding how gas can
handle linker relaxation - originally I guess gas assumed it could finalize the
size of frags and stitch them all together - if you break this I would expect
all hell to break loose.

Richard Shann








-- 
Richard Shann



reply via email to

[Prev in Thread] Current Thread [Next in Thread]