Bug 2117 - IA64 assembler is broken
Summary: IA64 assembler is broken
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: unspecified
: P2 critical
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-06 19:59 UTC by H.J. Lu
Modified: 2010-01-25 14:01 UTC (History)
2 users (show)

See Also:
Host:
Target: ia64-unknown-linux-gnu
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2006-01-06 19:59:08 UTC
I got

[hjl@gnu-11 gas]$ cat bar.s
        .global _rtld_local_ro#
        .hidden _rtld_local_ro#
_rtld_local_ro# = _rtld_global_ro#
        .global _rtld_global_ro#
        .data
        .align 8
        .type   _rtld_global_ro#, @object
        .size   _rtld_global_ro#, 4
_rtld_global_ro:
        data4   2
        .text
        .align 16
        .proc process_dl_debug#
process_dl_debug:
        (p6) addl r38 = @ltoffx(_rtld_local_ro#), r1
        ;;
        (p6) ld8.mov r38 = [r38], _rtld_local_ro#
        ;;
        .endp process_dl_debug#
[hjl@gnu-11 gas]$ ./as-new -x -o bar.o bar.s
[hjl@gnu-11 gas]$ readelf -r bar.o

Relocation section '.rela.text' at offset 0x368 contains 2 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000000000  000500000086 R_IA64_LTOFF22X   0000000000000000 _rtld_local_ro + 0
000000000001  000600000087 R_IA64_LDXMOV     0000000000000000 _rtld_global_ro + 0
[hjl@gnu-11 gas]$

Those relocations should be against the same symbol.
Comment 1 H.J. Lu 2006-01-06 22:17:16 UTC
We have 2 problems here:

1. foo in

        addl    r3 = @ltoffx(foo#), gp

is treated differently from foo in

        ld8.mov r3 = [r3], foo#

That is because the first "foo" is marked as O_max + 1 while the second "foo"
is marked as O_symbol. That is why they are treated differently.

2.

        .global foo#
        foo# = bar#
        .global bar#
        .data
bar:
        data4 0

is treated differently from

        .global bar#
        .data
bar:
        data4 0
        .global foo#
        foo# = bar#
Comment 2 H.J. Lu 2006-01-09 18:26:47 UTC
I checked in this patch:

http://sourceware.org/ml/binutils/2006-01/msg00062.html
Comment 3 H.J. Lu 2009-10-05 23:27:53 UTC
Reopened since the patch is reverted.
Comment 4 cvs-commit@gcc.gnu.org 2009-10-07 05:14:10 UTC
Subject: Bug 2117

CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2009-10-07 05:13:54

Modified files:
	gas            : ChangeLog 
	gas/config     : tc-ia64.c 

Log message:
	PR gas/2117
	* config/tc-ia64.c (parse_operand): Use expression rather than
	expression_and_evalute.
	(parse_operand_and_eval): New function.  Replace all uses of
	parse_operand outside of parse_operands with this function.
	(parse_operans_maybe_eval): New function.  Replace uses of
	parse_operand in parse_operands, except for the dummy, with
	this function.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.3979&r2=1.3980
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/config/tc-ia64.c.diff?cvsroot=src&r1=1.209&r2=1.210

Comment 5 cvs-commit@gcc.gnu.org 2009-10-13 11:52:49 UTC
Subject: Bug 2117

CVSROOT:	/cvs/src
Module name:	src
Branch: 	binutils-2_20-branch
Changes by:	gingold@sourceware.org	2009-10-13 11:52:35

Modified files:
	gas            : ChangeLog 
	gas/config     : tc-ia64.c 

Log message:
	2009-10-13  Alan Modra  <amodra@bigpond.net.au>
	H.J. Lu  <hongjiu.lu@intel.com>
	
	PR gas/2117
	* config/tc-ia64.c (parse_operand): Use expression rather than
	expression_and_evalute.
	(parse_operand_and_eval): New function.  Replace all uses of
	parse_operand outside of parse_operands with this function.
	(parse_operans_maybe_eval): New function.  Replace uses of
	parse_operand in parse_operands, except for the dummy, with
	this function.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.3938.2.25&r2=1.3938.2.26
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/config/tc-ia64.c.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.209&r2=1.209.2.1

Comment 6 H.J. Lu 2010-01-25 14:01:56 UTC
Fixed as of 2010-01-25.