This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC ARM Linker Problem- Static function


Kanwal Preet Singh CHANANA wrote:

I am facing a new problem.

Then you should start a new thread with a meaningful suject only on the appropriate mailing list. And please don't top-post.

I have many static functions in my source files.
The image crashes when it enters a particular function in *.text section
located in Flash. When I debug the image, I found that one of the static
function is overwriting the original function code.

Is this "function code" in RAM or Flash? Unintentionally writing to Flash will result in unpredictable behavior depending on the type of Flash. Typically, subsequent instruction fetches will return all ones from the flash.

This might have happened
during the loading of *.bss & *.data sections during runtime.

The bss is zeroed during the C runtime initialization, and for applications that are run out of Flash, the initialized data is transfered from Flash to their appropriate run-time ".data" locations in RAM.

When I check Image.map file, I am not able to see this static function name.
Also I tried to diassemble the Image.out file  using arm-elf-objdump utility
but still cannot find this function.
The linker script file is correct since there is no section overlaps.

GCC (and other compilers) likes to inline static functions as an optimization, and this may be the reason that your static functions are not showing up in the symbol table.

Where will static section be placed in Image.out? Can we define address for static section also?

There is no such thing as a "static section". Static functions (code) is located in the ".text" segment, while static variables are located either in ".bss" or ".data" depending upon whether they are initialized or uninitialzed or initialized with zero.


-- Michael N. Moran (h) 770 516 7918 5009 Old Field Ct. (c) 678 521 5460 Kennesaw, GA, USA 30144 http://mnmoran.org

"So often times it happens, that we live our lives in chains
 and we never even know we have the key."
The Eagles, "Already Gone"

The Beatles were wrong: 1 & 1 & 1 is 1



--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]