From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 25 09:11:23 2007 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BA65916A469 for ; Mon, 25 Jun 2007 09:11:23 +0000 (UTC) (envelope-from bkoenig@alpha-tierchen.de) Received: from mail.liberty-hosting.de (mail.smartterra.de [195.225.132.203]) by mx1.freebsd.org (Postfix) with ESMTP id 64E1313C4B8 for ; Mon, 25 Jun 2007 09:11:23 +0000 (UTC) (envelope-from bkoenig@alpha-tierchen.de) Received: from mail.liberty-hosting.de ([195.225.132.203]) by localhost (liberty-mail [195.225.132.203]) (amavisd-new, port 10024) with ESMTP id 47601-06 for ; Mon, 25 Jun 2007 10:56:41 +0200 (CEST) Received: from home.alpha-tierchen.de (port-212-202-42-120.dynamic.qsc.de [212.202.42.120]) by mail.liberty-hosting.de (Postfix) with ESMTP id 95AFB3E96E7 for ; Mon, 25 Jun 2007 10:56:41 +0200 (CEST) Received: from webmail.alpha-tierchen.de (localhost [127.0.0.1]) by home.alpha-tierchen.de (Postfix) with ESMTP id 58FA445046 for ; Mon, 25 Jun 2007 10:54:06 +0200 (CEST) Received: from 192.168.1.2 (SquirrelMail authenticated user bkoenig) by webmail.alpha-tierchen.de with HTTP; Mon, 25 Jun 2007 10:54:06 +0200 (CEST) Message-ID: <1500.192.168.1.2.1182761646.squirrel@webmail.alpha-tierchen.de> Date: Mon, 25 Jun 2007 10:54:06 +0200 (CEST) From: =?iso-8859-1?Q?Bj=F6rn_K=F6nig?= To: hackers@freebsd.org User-Agent: SquirrelMail/1.4.10a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: by amavisd-new at mail.smartterra.de Cc: Subject: end, edata, etext issues X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2007 09:11:23 -0000 Hello, I'm playing with FreeBSD on ARM. I noticed that sbrk(2) doesn't work properly on this architecture. I still don't understand the whole process of the initialisation of end, edata and etext. There are some oddities that confuse me even more. Let me make an example: 1 #include 2 extern end; 3 extern edata; 4 int main() { 5 printf("edata: %08x\n", edata); 6 printf("end: %08x\n", end); 7 printf("sbrk(0): %08x\n", sbrk(0)); 8 return (0); 9 } > cc test.c && ./a.out edata: 00000000 end: 00000000 sbrk(0): ffffffff This is obviously not correct and the reason why program that rely sbrk(2) are broken. I added the following code: 1 .data 2 .globl curbrk 3 curbrk: 4 .word end and compiled the whole thing again: > cc test.c curbrk.S && ./a.out edata: 00000000 end: 0001070c sbrk(0): 00100000 and it seems to work. Another strange thing is that if I don't access "edata", e.g. leave printf("edata: %08x\n", edata); away, then sbrk still works, but "end" is zero. In case I don't access "edata" or "end" at all I'll get a bus error. Is there somebody who can tell me how end depends on the presence curbrk and edata in this example? Regards Björn