Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Sep 2010 17:58:40 +0300
From:      Andriy Gapon <avg@icyb.net.ua>
To:        PL <kadupl@wp.pl>
Cc:        freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: question regarding link_elf.c
Message-ID:  <4CA35420.1030108@icyb.net.ua>
In-Reply-To: <4ca350c1278010.73850128@wp.pl>
References:  <4ca2f64ee66683.99262397@wp.pl> <4CA2FFAE.6030906@icyb.net.ua> <4ca3496d8ce8b3.74842248@wp.pl> <4CA34BCF.6090701@icyb.net.ua> <4ca350c1278010.73850128@wp.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
on 29/09/2010 17:44 PL said the following:
> Dnia 29-09-2010 o godz. 16:23 Andriy Gapon napisał(a):
>> on 29/09/2010 17:13 PL said the following:
>>> It seems like it is not a problem in my own code, since readelf -S on a
>>> elf file
>>> gives me the same results as my debug messages. I've created an empty
>>> module, to
>>> simplify debugging. Both my code, and readelf says, that '.text' section
>>> address
>>> is 0x3e0, and its size is 7 bytes. Adding 0x3e0 to lf->address points to
>>> a valid location.
>>>
>>> '.data' is supposed to be at 0x1424 (again, both my code and readelf
>>> returns the same thing),
>>> but the actual data starts at lf->address + 0x3e7. How do I know ? I've
>>> added global
>>> initialized string variable in empty test module, and Im looking at the
>>> memory to determine
>>> it's location. I'm not sure what is wrong then.
>>
>>
>> Can you post a link to the compiled test module?
>>
>> --
>> Andriy Gapon
> 
> Well.. i don't have any public 'hosting', but I put it in here:
> 
> http://www.4shared.com/dir/LHn_I393/sharing.html
> 
> Also, the code is as simple as:
> 
>   1 #include <sys/param.h>
>   2 #include <sys/kernel.h>
>   3 #include <sys/module.h>
>   4
>   5
>   6 char *str =   "THIS IS A STR MARKING DATA START";

You marker was put into .rodata section.
Try char str[] instead.

>   8 static int kms_null_handler(module_t m, int op, void *data)
>   9 {
>  10         return (0);
>  11 }
>  12
>  13 static moduledata_t kms_null_data = {
>  14         "kms_null",
>  15         kms_null_handler,
>  16         NULL,
>  17 };
>  18
>  19 DECLARE_MODULE(kms_null, kms_null_data, SI_SUB_EXEC, SI_ORDER_ANY);
> 
> It is being compiled on i386/GENERIC kernel.
> 
> 


-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4CA35420.1030108>