tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] I need help adding custom sections to a c program


From: grischka
Subject: Re: [Tinycc-devel] I need help adding custom sections to a c program
Date: Mon, 16 Feb 2009 17:08:40 +0100
User-agent: Thunderbird 1.5.0.10 (Windows/20070221)

Simon Lehmayr wrote:
Hello tinycc-fans,
I must add 2 custom sections to a program called myinit and mynoinit. When I write a litte program to test that:
int myvar __attribute__ ((aligned(8), section(".myinit")));
void main()
{
  myvar=10;
  printf("%u",myvar);
}
I get a exe file (windows) but it won't run. I always get a runtime error when the program reaches the assignment. When I use cygwin's "nm" tool on the object file, I see that variable myvar is at address 00000000 and location R... that's wrong.
What must I do to make this work?
I can compile tcc on my machine and add sections in tcc itself with new_section. This didn't work yet, too.

The problem is that sections created by find_section() are non-writeable
& non-executable and also that the PE code ignores such sections except
some special ones (as .rsrc).

Here is something that might help:
  http://repo.or.cz/w/tinycc.git?a=commitdiff;h=97ac6935

--- grischka




reply via email to

[Prev in Thread] Current Thread [Next in Thread]