Bug 99410 - Nios II Error: branch offset out of range
Summary: Nios II Error: branch offset out of range
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 7.3.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-05 14:30 UTC by Giulio Benetti
Modified: 2022-07-29 16:17 UTC (History)
0 users

See Also:
Host:
Target: Nios
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Pre-processed belle_sip_messageParser.c(belle_sip_messageParser.i) (329.73 KB, application/x-bzip)
2021-08-20 23:28 UTC, Giulio Benetti
Details
Pre-processed belle_sip_messageParser.c(belle_sip_messageParser.s) (437.29 KB, application/x-bzip)
2021-08-20 23:29 UTC, Giulio Benetti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Giulio Benetti 2021-03-05 14:30:34 UTC
When building git package on Buildroot gcc throws:
'''
[ 98%] Building C object src/CMakeFiles/bellesip.dir/antlr3c/src/antlr3treeparser.c.o
/tmp/ccDtjRfo.s: Assembler messages:
/tmp/ccDtjRfo.s:210798: Error: branch offset out of range

/tmp/ccDtjRfo.s: Fatal error: branch relaxation failed
'''

To reproduce it:

# git clone git://git.busybox.net/buildroot
# wget https://git.busybox.net/buildroot-test/tree/utils/br-reproduce-build

- modify BASE_GIT=... with your buildroot path in br-reproduce-build then:
# chmod a+x br-reproduce-build
# ./br-reproduce-build 71f26fd81db8e9b19b3f18f3f3cefd9c768f094f

The only way I've found to build correctly is to turn off optimization overriding CFLAGS with -O0.
Comment 1 Andrew Pinski 2021-03-05 18:47:52 UTC
I think this is the same as https://sourceware.org/bugzilla/show_bug.cgi?id=27243 .
Comment 2 Giulio Benetti 2021-03-05 19:03:07 UTC
You’re right, it’s an assembler bug, not gcc.
And yes it’s the same.

Thank you.
Comment 3 Giulio Benetti 2021-03-05 19:28:03 UTC
Ah no, wait, that happens with older binutils too, so it doesn't look like the same and most of all it stop to show with gcc 8.x, so it seems that gcc create
a particular Assembly that GAS doesn't like or can't handle.
Comment 4 Giulio Benetti 2021-08-20 23:13:52 UTC
It's not git package but belle-sip package that fails to build.
I'm going to add .i and .s file soon.
Comment 5 Giulio Benetti 2021-08-20 23:22:10 UTC
Disabling parallel build it turns out that the file where it hangs is:
src/grammars/belle_sip_messageParser.c

So I'm going to add .i and .s attachments for it.
Comment 6 Giulio Benetti 2021-08-20 23:28:50 UTC
Created attachment 51338 [details]
Pre-processed belle_sip_messageParser.c(belle_sip_messageParser.i)
Comment 7 Giulio Benetti 2021-08-20 23:29:21 UTC
Created attachment 51339 [details]
Pre-processed belle_sip_messageParser.c(belle_sip_messageParser.s)
Comment 8 Giulio Benetti 2021-08-21 21:12:21 UTC
This bug still shows up on gcc 9.3.0
Comment 9 Giulio Benetti 2022-07-29 16:17:33 UTC
This bug shows up with gcc 11.3.0 and 12.1.0