From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 860 invoked by alias); 27 Apr 2009 09:46:06 -0000 Received: (qmail 849 invoked by uid 22791); 27 Apr 2009 09:46:04 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from web65409.mail.ac4.yahoo.com (HELO web65409.mail.ac4.yahoo.com) (76.13.9.29) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Mon, 27 Apr 2009 09:45:59 +0000 Received: (qmail 73144 invoked by uid 60001); 27 Apr 2009 09:45:56 -0000 Message-ID: <888872.73079.qm@web65409.mail.ac4.yahoo.com> Received: from [129.247.247.240] by web65409.mail.ac4.yahoo.com via HTTP; Mon, 27 Apr 2009 02:45:56 PDT Date: Mon, 27 Apr 2009 09:46:00 -0000 From: Denis Scherbakov Reply-To: denis_scherbakov@yahoo.com Subject: What are the differences between HP's COMMON and ANSI_COMMON? To: binutils@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2009-04/txt/msg00380.txt.bz2 I am currently working on ia64-hp-hpux* linker. So far I've already managed to compile GCC 4.3.3, but Dave Korn noticed, that there might be a problem in LD that it does not handle ANSI_COMMON symbols correctly. That is why they appear in *ABS* section. So I wanted to ask anybody to explain me, what is the difference between these two symbols in HP and what should I expect on output? So far I found SHN_IA_64_ANSI_COMMON in 1) elfNN_ia64_relax_section -> case with SHN_IA_64_ANSI_COMMON is never reached 2) elfNN_ia64_hpux_backend_section_from_bfd_section -> case never reached 3) elfNN_ia64_hpux_backend_symbol_processing -> case reached too late through reloc_overflow (gdb) backtrace #0 elf32_ia64_hpux_backend_symbol_processing (abfd=0x89fd168, asym=0x8a2916c) at elf32-ia64.c:5646 #1 0x080a18b8 in bfd_elf32_slurp_symbol_table (abfd=0x89fd168, symptrs=0x8a29140, dynamic=0) at ../../bfd/elfcode.h:1330 #2 0x080b4fac in _bfd_elf_canonicalize_symtab (abfd=0x89fd168, allocation=0x8a29140) at ../../bfd/elf.c:6561 #3 0x08083f2e in bfd_generic_link_read_symbols (abfd=0x89fd168) at ../../bfd/linker.c:754 #4 0x0806554d in vfinfo (fp=0xb7f77560, fmt=0x81101ea ":", arg=0xbfbc3154 "", is_warning=1) at ../../ld/ldmisc.c:284 #5 0x080659dc in einfo (fmt=0x81101e6 "%X%C:") at ../../ld/ldmisc.c:438 #6 0x08060bf0 in reloc_overflow (info=0x8167ec0, entry=0x89f4288, name=0x8a04a1e "varTest", reloc_name=0x8153000 "GPREL22", addend=0, abfd=0x89fd168, section=0x89ff404, address=17) at ../../ld/ldmain.c:1293 #7 0x0809dfe0 in elf32_ia64_relocate_section (output_bfd=0x89f1ee0, info=0x8167ec0, input_bfd=0x89fd168, input_section=0x89ff404, contents=0x89feff8 "", relocs=0x8a04a2c, local_syms=0x8a3f0e8, local_sections=0x89fa538) at elf32-ia64.c:5174 #8 0x080cdd00 in elf_link_input_bfd (finfo=0xbfbc3628, input_bfd=0x89fd168) at ../../bfd/elflink.c:9425 #9 0x080d0bb7 in bfd_elf_final_link (abfd=0x89f1ee0, info=0x8167ec0) at ../../bfd/elflink.c:10555 #10 0x0809c021 in elf32_ia64_final_link (abfd=0x89f1ee0, info=0x8167ec0) at elf32-ia64.c:4403 #11 0x08061d2a in ldwrite () at ../../ld/ldwrite.c:567 #12 0x0805f340 in main (argc=7, argv=0xbfbc3934) at ../../ld/ldmain.c:464 4) I added: elfNN_ia64_hpux_common_definition #define elf_backend_common_definition elfNN_ia64_hpux_common_definition static bfd_boolean elfNN_ia64_hpux_common_definition (Elf_Internal_Sym *sym) { return (sym->st_shndx == SHN_COMMON || sym->st_shndx == SHN_IA_64_ANSI_COMMON); } So far I understand - it is reached exactly, where needed - just before LD decides to which section a symbol belongs. (gdb) backtrace #0 elf32_ia64_hpux_common_definition (sym=0x8931244) at elf32-ia64.c:4453 #1 0x080bf8d6 in elf_link_add_object_symbols (abfd=0x8930168, info=0x8167ec0) at ../../bfd/elflink.c:3943 #2 0x080c21aa in bfd_elf_link_add_symbols (abfd=0x8930168, info=0x8167ec0) at ../../bfd/elflink.c:5143 #3 0x08055627 in load_symbols (entry=0x89180e4, place=0xbfc830c4) at ../../ld/ldlang.c:2652 #4 0x08056059 in open_input_bfds (s=0x89180e4, force=0) at ../../ld/ldlang.c:3083 #5 0x0805b976 in lang_process () at ../../ld/ldlang.c:6169 #6 0x0805f303 in main (argc=7, argv=0xbfc83234) at ../../ld/ldmain.c:455 // in elflink.c: common = bed->common_definition (isym); // ... a few lines later else if (isym->st_shndx == SHN_COMMON) if I replace IF with else if (isym->st_shndx == SHN_COMMON || common) LD runs without errors. Any comments are appreciated. Denis