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.
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#
I checked in this patch: http://sourceware.org/ml/binutils/2006-01/msg00062.html
Reopened since the patch is reverted.
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
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
Fixed as of 2010-01-25.