From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3598 invoked by alias); 23 May 2014 08:53:25 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 3549 invoked by uid 48); 23 May 2014 08:53:21 -0000 From: "gjl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/61044] Computed goto on AVR fails to use word-addressing Date: Fri, 23 May 2014 08:53:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gjl at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-05/txt/msg02062.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61044 Georg-Johann Lay changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gjl at gcc dot gnu.org, | |senthil_kumar.selvaraj@atme | |l.com --- Comment #2 from Georg-Johann Lay --- I don't see any difference in generated code with that patch. Anyway, the question is /what/ the generated code should be? The label differences would be something like .word pm(.L3-.L2) because we must not generate stubs for the offset. pm() works under the assumption that gas does not resolve the difference and emits relocs for it, and that pm() accepts differences. Currently, gas will compute the difference and come up with somethink like pm(4) which it resolves to 4 and not as 2. Senthil, I searched for a user level documentation of -mlink-relax but with no avail. Is there a special reason for why there is no documentation for that new gas command line option? And why is this option needed in the first place? Why not always emitting relocs for differences of labels? It does not buy us anything if gas computes the difference ... except for annoyance like checking for -mlink-relax during GCC configury. What does not work is to add offsets to stub addresses, e.g. gs(.L2)+4 will point to the next stub (if any) and *not* to .L2 + 4. Thus, I don't think it's worth to fix this PR and go through all the hassle with/without linker relaxation and cater for all situations. Instead, we should mention in the manual that the second example for computed goto (with label differences) is not supported for AVR. Not to mention that alternative #1 will yield better code because there is not need to add offsets at run time.