Il giorno 09/ott/2012, alle ore 03:15, Alexander Bokovikov 
<openwo...@uralweb.ru> ha scritto:

> 
> On Oct 9, 2012, at 1:00 AM, Simone Tellini wrote:
> 
>> 
>> this is way overkill. You can simply write a simple utility to dump the 
>> content of your resource in a C file:
>> 
>> static char foo[] = {
>>       0x01, 0x02, 0x03, 
>> ...
>> };
>> 
>> You don't need to use assembly nor to create bogus functions to get the 
>> address of foo.
> 
> Oops… You haven't caught the idea… Everybody knows how to create a _data_ but 
> I've described, how to _embed_ data into the _code_ segment. This way can be 
> used if it's necessary to hide some data against patching.
> 

oh, sorry I guess I've overlooked that detail :-)

Anyway, then make it:

static const char foo[] = {
      0x01, 0x02, 0x03, 
...
};

llvm/gcc puts const data in the .text segment (or a different read-only data 
segment on some architectures), generating something like:

        .section        __TEXT,__const
        .align  4                       ## @foo
_foo:
...

-- 
Simone Tellini
http://tellini.info




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to