Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D3KdC-0002Zg-Uc for qemu-devel@nongnu.org; Mon, 21 Feb 2005 15:58:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D3KZf-0001UD-4U for qemu-devel@nongnu.org; Mon, 21 Feb 2005 15:54:37 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D3KZZ-0001L4-Pd for qemu-devel@nongnu.org; Mon, 21 Feb 2005 15:54:30 -0500 Received: from [157.193.204.1] (helo=trappist.elis.UGent.be) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D3KBQ-0006Ma-Lr for qemu-devel@nongnu.org; Mon, 21 Feb 2005 15:29:33 -0500 Received: from [157.193.206.33] (bigmac.elis.UGent.be [157.193.206.33]) by trappist.elis.UGent.be (8.11.6/8.11.6) with ESMTP id j1LKTV428184 for ; Mon, 21 Feb 2005 21:29:31 +0100 Mime-Version: 1.0 (Apple Message framework v619.2) In-Reply-To: <421A3FAD.7040709@bellard.org> References: <6a3c367237141a46e9d50c2806a212c0@elis.ugent.be> <67020f2e144efbf20ea9d0eb09315239@elis.ugent.be> <87491237e8d0eaafae0d0da9f45799de@elis.ugent.be> <421A2F44.9040304@bellard.org> <7c6cbcb9cc4011580b78748d71caae54@elis.ugent.be> <421A3FAD.7040709@bellard.org> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <60f60d09f383bc7986bf01008871889b@elis.ugent.be> Content-Transfer-Encoding: 7bit From: Jonas Maebe Subject: Re: [Qemu-devel] Patch to fix Mac OS X compilation Date: Mon, 21 Feb 2005 21:29:31 +0100 Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 21 feb 2005, at 21:08, Fabrice Bellard wrote: >> PS: symbols which are still in the dynamic symbol table and therefore >> not properly relocated under Mac OS X (also not in Qemu 0.61) are >> rclw_table, rclb_table and parity_table. The hack to declare them as >> "static" does not currently work for them, because then you get >> definition conflicts. A proper fix would be to add support for >> parsing the dynamic symbol table as well. >> A hack would be to move some things to different include files so the >> "static" definition is the only one that appears when compiling op.o, >> and the "extern" definitions when compiling other files. Another >> solution is to parse the output of "otool -IV op.o", as these >> variables/symbols are shown by that one in the contents of the >> "(__DATA,__nl_symbol_ptr)" section. > > What not just keeping them as they are now ? Are you sure the code is > badly relocated ? Yes. Just search for "warning" in the generated op.h (i.e., they are not relocated at all). > It seems that a reference to the equivalent of the ELF GOT is used to > access these tables That is correct. > - I don't understand why a specific relocation is needed. It's not a special relocation, but a different symbol table. Mach-O object files contain two symbol tables: one which contains all private symbols (called the "symbol table", and which is already fully parsed by dyngen), and one which contains all imported and exported symbols (the "dynamic symbol table"). This dynamic symbol table command is loaded by dyngen (search for "dysymtab"), but the table itself is not loaded nor parsed. As such, when you find a relocated symbol in an instruction (which only contains a section number, an index and things like that, but no name) and this is an external (or exported) symbol, then dyngen won't be able to find its name (since it will only search the regular symbol table). When dyngen can't find the name of a relocation, it can't create a fixup for it since it needs to print the name in the generated op.h > The real problem is that gcc for Mac OS X does not support the > "visibility" attribute. Setting the visibility of the symbol to > "hidden" would solve the problem ! That's possible. If this attribute would result in the symbols becoming private, they would indeed move from the dynamic symbol table to the regular symbol table. Jonas