Bug 7525 - [ARM/Thumb] long calls stubs only in one code section, cannot branch to them from other section
Summary: [ARM/Thumb] long calls stubs only in one code section, cannot branch to them ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.0.4
: P2 normal
Target Milestone: 4.0.0
Assignee: Richard Earnshaw
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2002-08-07 08:46 UTC by andy.green
Modified: 2005-01-14 14:17 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: arm-elf
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2005-01-12 18:11:28


Attachments
bug.tar (3.59 KB, application/octet-stream)
2003-05-21 15:17 UTC, andy.green
Details

Note You need to log in before you can comment on or make changes to this bug.
Description andy.green 2002-08-07 08:46:05 UTC
I have two output sections (highcode and lowcode). I can call functions in highcode from lowcode, but not the other way. It seems that the _call_via_rX stubs are all in the lowcode section, and code in highcode cannot branch to the stub.

see make.sh for options used (assembler, compiler and linker)

highcode.o: In function `DoStuffInHiArea(int)':
highcode.o(.highcode+0x12): relocation truncated to fit: R_ARM_THM_PC22 _call_via_r3

Release:
3.0.4 (with long calls patch)

Environment:
running on Redhat linux 7.3, building for embedded ARM7TDMI

How-To-Repeat:
Sorry it has to be multiple files (they are a single directory - extract to anywhere)
run ./make.sh, it will compile and try to link
Comment 1 andy.green 2002-08-07 08:46:05 UTC
Fix:
none I can find
Comment 2 Dara Hazeghi 2003-05-26 04:10:11 UTC
Hello

gcc 3.0.4 is rather old at this point. Would it be possible for you to check whether this problem 
still occurs with gcc 3.3? Thanks,

Dara
Comment 3 Andrew Pinski 2003-05-26 04:11:37 UTC
See Dara's Question
Comment 4 andy.green 2003-05-28 14:18:46 UTC
Subject: Re:  [ARM/Thumb] long calls stubs only in one code
 section, cannot branch to them from other section

dhazeghi@yahoo.com wrote:
> 
> ------- Additional Comments From dhazeghi@yahoo.com  2003-05-26 04:10 -------
> Hello
> 
> gcc 3.0.4 is rather old at this point. Would it be possible for you to 
 > check whether this problem still occurs with gcc 3.3? Thanks,
> 
> Dara
> 


I can't easily check 3.3 until a colleague returns from holiday. I'll get him to 
try it as soon as he gets back.

However, in the meantime, I can confirm that 3.2 had the problem.

Andy



Comment 5 Dara Hazeghi 2003-06-16 19:36:51 UTC
Andy,

just a reminder that this bug is awaiting feedback...

Dara
Comment 6 Richard Earnshaw 2003-06-18 16:06:22 UTC
I know this hasn't been fixed yet.  No need for further confirmation.
Comment 7 Richard Earnshaw 2003-06-18 16:07:02 UTC
I know this hasn't been fixed yet.  No need for further confirmation.
Comment 8 andy.green 2003-06-18 16:12:35 UTC
Subject: Re:  [ARM/Thumb] long calls stubs only in one code
 section, cannot branch to them from other section

rearnsha at gcc dot gnu dot org wrote:
> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7525
> 
> 
> rearnsha at gcc dot gnu dot org changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |rearnsha@arm.com
>              Status|NEW                         |SUSPENDED
> 
> 
> ------- Additional Comments From rearnsha at gcc dot gnu dot org  2003-06-18 16:07 -------
> I know this hasn't been fixed yet.  No need for further confirmation.
> 

Thanks - we're actually having some trouble building version 3.3 right now, let 
alone testing the problem!

Andy


Comment 9 Richard Earnshaw 2003-06-18 16:16:23 UTC
Whoops!  Did not intend to suspend this
Comment 10 thomas 2003-10-27 18:15:53 UTC
Bug still exists in 3.3.1, in case anybody cares. 
Comment 11 Richard Earnshaw 2005-01-12 18:11:27 UTC
In the general case of calling library support functions, this really needs
fixing in the linker.  I'm going to fix this for the specific case of
__call_via_<rn> because this is necessary to generate code that conforms to the
EABI (__call_via_<rn> isn't a recognized library entry point).
Comment 12 CVS Commits 2005-01-14 13:59:00 UTC
Subject: Bug 7525

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rearnsha@gcc.gnu.org	2005-01-14 13:58:42

Modified files:
	gcc            : ChangeLog 
	gcc/config/arm : arm-protos.h arm.c arm.h arm.md 

Log message:
	PR target/7525
	* arm.h (struct machine_function): Add call_via field.
	(thumb_call_via_label): Declare.
	* arm.c (thumb_call_via_label): New variable.
	(thumb_call_reg_needed): New variable.
	(arm_output_function_epilogue): For Thumb code, output any per-function
	call-indirect trampolines.
	(thumb_call_via_reg): New function.
	(arm_file_end): New function.
	(TARGET_ASM_FILE_END): Call arm_file_end.
	(aof_file_end): Likewise.
	* arm-protos.h (thumb_call_via_reg): Declare.
	* arm.md (call_reg_thumb, call_value_reg_thumb): Call
	thumb_call_via_reg in normal case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7120&r2=2.7121
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm-protos.h.diff?cvsroot=gcc&r1=1.79&r2=1.80
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm.c.diff?cvsroot=gcc&r1=1.426&r2=1.427
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm.h.diff?cvsroot=gcc&r1=1.264&r2=1.265
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm.md.diff?cvsroot=gcc&r1=1.188&r2=1.189

Comment 13 Richard Earnshaw 2005-01-14 14:17:35 UTC
http://gcc.gnu.org/ml/gcc-patches/2005-01/msg00813.html

Fixed for the common case, but not for caller super-inteworking.  I don't intend
to change that case, since that's outside the EABI and I still think the linker
should be fixing these types of problems up with linker-generated stubs.
Comment 14 CVS Commits 2005-03-22 20:19:25 UTC
Subject: Bug 7525

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	csl-arm-branch
Changes by:	mmitchel@gcc.gnu.org	2005-03-22 20:19:20

Modified files:
	gcc            : ChangeLog.csl-arm 
	gcc/config/arm : arm-protos.h arm.c arm.h arm.md 

Log message:
	Merge from mainline.
	2005-01-14  Richard Earnshaw  <rearnsha@arm.com>
	PR target/7525
	* arm.h (struct machine_function): Add call_via field.
	(thumb_call_via_label): Declare.
	* arm.c (thumb_call_via_label): New variable.
	(thumb_call_reg_needed): New variable.
	(arm_output_function_epilogue): For Thumb code, output any per-function
	call-indirect trampolines.
	(thumb_call_via_reg): New function.
	(arm_file_end): New function.
	(TARGET_ASM_FILE_END): Call arm_file_end.
	(aof_file_end): Likewise.
	* arm-protos.h (thumb_call_via_reg): Declare.
	* arm.md (call_reg_thumb, call_value_reg_thumb): Call
	thumb_call_via_reg in normal case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.csl-arm.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.1.2.95&r2=1.1.2.96
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm-protos.h.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.60.4.17&r2=1.60.4.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.303.2.72&r2=1.303.2.73
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm.h.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.210.2.55&r2=1.210.2.56
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm.md.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.145.2.29&r2=1.145.2.30