From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7924 invoked by alias); 2 Dec 2011 04:59:10 -0000 Received: (qmail 7914 invoked by uid 22791); 2 Dec 2011 04:59:08 -0000 X-SWARE-Spam-Status: No, hits=-3.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-iy0-f169.google.com (HELO mail-iy0-f169.google.com) (209.85.210.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Dec 2011 04:58:55 +0000 Received: by iapp10 with SMTP id p10so991323iap.0 for ; Thu, 01 Dec 2011 20:58:54 -0800 (PST) Received: by 10.42.172.70 with SMTP id m6mr12142627icz.37.1322801934566; Thu, 01 Dec 2011 20:58:54 -0800 (PST) Received: by 10.42.172.70 with SMTP id m6mr12142615icz.37.1322801934413; Thu, 01 Dec 2011 20:58:54 -0800 (PST) Received: from coign.google.com ([216.239.45.130]) by mx.google.com with ESMTPS id dd36sm29855156ibb.7.2011.12.01.20.58.51 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Dec 2011 20:58:53 -0800 (PST) From: Ian Lance Taylor To: John Marino Cc: binutils@sourceware.org Subject: Re: gold linker 2.22 regressed for DragonFly References: <4ED7FCA6.8090706@marino.st> Date: Fri, 02 Dec 2011 04:59:00 -0000 In-Reply-To: <4ED7FCA6.8090706@marino.st> (John Marino's message of "Thu, 01 Dec 2011 23:16:06 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes 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: 2011-12/txt/msg00018.txt.bz2 John Marino writes: > When binutils 2.21 was imported into DragonFly, gold could successful > link world and kernel, but not the kernel modules. When binutils 2.22 > was imported, gold can no longer even link itself. > > After executing "gmake check-TESTS", the new version of gold linked by > gold segfaults immediately. The General_Options->format() method > returns null, crashing string_to_object_format in options.cc. I'm not > very strong in C++, so I'm having trouble figuring out why format() is > not getting defined, or what has changed between gold 2.21 and gold > 2.22. > > The backtrace is attached. I'm sure somebody here should be able to > point me to code that should be modified to support DragonFly BSD. > > Thanks, > John > > The program being debugged has been started already. > Start it from the beginning? (y or n) > Starting program: /home/marino/workzone/test-222/gold/ld1 > > Program received signal SIGSEGV, Segmentation fault. > 0x000000000052e534 in gold::General_options::string_to_object_format (arg=0x0) > at ../../binutils-2.22/gold/options.cc:655 > 655 if (strncmp(arg, "elf", 3) == 0) > #0 0x000000000052e534 in gold::General_options::string_to_object_format ( > arg=0x0) at ../../binutils-2.22/gold/options.cc:655 string_to_object_format is being called with a NULL pointer. > #1 0x000000000053b5e2 in format_enum (this=0x62a5fe) > at ../../binutils-2.22/gold/options.cc:937 This line is return General_options::string_to_object_format(this->format()); so this->format() is return a NULL string. That should not happen. this->format() is going to return the value of this->format_.value. That should be initialized to "elf" and nothing should ever change it to NULL. In this case "this" appears to refer to the static variable Position_dependent_options::default_options_. I'm not aware of anything that has changed in this area between binutils 2.21 and 2.22. The same code is in 2.21. I guess I would debug it by verifying that Position_independent_options::default_options_.format_.value is in fact initialized to "elf". If not, why not? If it is, when does it change? Ian