public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Code Optimization
@ 2002-01-13 15:19 Roger Faust
  0 siblings, 0 replies; 3+ messages in thread
From: Roger Faust @ 2002-01-13 15:19 UTC (permalink / raw)
  To: gcc-help

hi

can it be, that code optimization creates error (the manual doesn't seem to 
make it clear to me)? 
i'm quite sure, that the code is ok. it work allright, until i'm using 
optimization. then i'm getting a segmentation fault, with O1 and O2 on the 
same position, with O3 earlier. the postion doesn't help my much, because the 
line where the error occurs seems for me ok (one time it's a return statment 
from main, the other one a asignment) and refering to the manual, it doesn't 
has to be this line.
any tipps to track down the bugs?

i'm using gcc 2.95.2 on suse 7.1 and gcc 2.95.4 on debian woody where the 
error was both times the same

thanks
--
	Roger Faust

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: code optimization.
  2013-08-07  7:16 AW: " Christoph Kobe
@ 2013-08-07  7:35 ` hemant undale
  0 siblings, 0 replies; 3+ messages in thread
From: hemant undale @ 2013-08-07  7:35 UTC (permalink / raw)
  To: 'Christoph Kobe', gcc-help

Thanks for prompt reply Christoph,
I will take care for your valuable suggestions. 
I tried already using --gc-sections during linking but no improvements.
I really have same questions
1. How to optimize (reduce size of .abs) by using complier or linker
specific options?
2. There is number of not used global variables and blank function calls in
my C files (but no dead Code!).Is it possible to perform some link time
optimization?
3. Please elaborate as I am new to this, I have referred sites, gcc help and
tried some "lto" options but no reduction is size.
4.	I also tried using -fdata-sections -ffunction-sections but it has
increased my firmware.abs file size from KB to MB (yes it is MB!)I wondered
WHY? 
I am using codesourcery arm toolchain evaluation.
It has gcc version 4.5.2

Cheers
Hemant

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Christoph Kobe
Sent: 07/08/2013 12:46 PM
To: hemantu@renuelectronics.com; gcc-help@gcc.gnu.org
Subject: AW: code optimization.

-----Ursprüngliche Nachricht-----
Von: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] Im
Auftrag von hemant undale
Gesendet: Mittwoch, 7. August 2013 08:04
An: gcc-help@gcc.gnu.org
Betreff: code optimization.

Hi to All,
My current compiler settings are
arm-none-eabi-gcc -Wall -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
-fshort-double-mcpu=cortex-m4 -mthumb -Qn -Os -finstrument-functions
-mlong-calls -c temp.c -o temp.o so on for temp1, temp2... Etc I am
compiling multiple C files.
and linker settings are
ld -r temp.o -o one.o
so on for temp1, temp2... Etc
I am linking multiple .O files.
Also I am using linker script i.e link.txt (invoked externally as below) ld
-cref -Map map.txt -S -T link.txt -temp.o -lm -lc -lgcc arm-none-eabi-gcc
-Wall sample.o -O Firmware.abs Now, At output I get .abs file of 140KB.
My Questions are
1.	How to optimize (reduce size of .abs) by using complier or linker
specific options??????
2.	There are Number of NOT used global variables and Blank Function
Calls in my C files (NO Dead Code!!!!). Is it possible to perform some link
time optimization??????????
3.	Please Elaborate as I am new to this, I have referred sites, gcc
help and tried some "lto" options but NO reduction is size!!!!!!!!!!!!!
4.	I also tried using 
	-fdata-sections
	-ffunction-sections
But It has INCREASED my firmware.abs file size from KB to MB (yes it is
MB!!!!) I also wondered WHY??????????
I am using codesourcery arm toolchain evaluation.
It has gcc version 4.5.2 

Thanks for patiently reading my question.

----

Hi hemantu,

when using -fdata-sections and -ffunction-sections you also need
to use --gc-sections during linking.

Also, people might find it easier to read your email carefully
(and you will get more quality responses) if you invest some more
time into formatting your text (paragrahs, less exclamation marks
& question marks, no capitals). As a good starting point, a google
search for "mailing list etiquette" points here:
http://www.freebsd.org/doc/en/articles/mailing-list-faq/etiquette.html

Regards
Christoph



^ permalink raw reply	[flat|nested] 3+ messages in thread

* code optimization.
@ 2013-08-07  6:01 hemant undale
  0 siblings, 0 replies; 3+ messages in thread
From: hemant undale @ 2013-08-07  6:01 UTC (permalink / raw)
  To: gcc-help

Hi to All,
My current compiler settings are 
arm-none-eabi-gcc -Wall -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
-fshort-double-mcpu=cortex-m4 -mthumb -Qn -Os -finstrument-functions
-mlong-calls -c temp.c -o temp.o
so on for temp1, temp2... Etc
I am compiling multiple C files.
and linker settings are
ld -r temp.o -o one.o
so on for temp1, temp2... Etc
I am linking multiple .O files.
Also I am using linker script i.e link.txt (invoked externally as below)
ld -cref -Map map.txt -S -T link.txt -temp.o -lm -lc -lgcc
arm-none-eabi-gcc -Wall sample.o -O Firmware.abs
Now, At output I get .abs file of 140KB.
My Questions are
1.	How to optimize (reduce size of .abs) by using complier or linker
specific options??????
2.	There are Number of NOT used global variables and Blank Function
Calls in my C files (NO Dead Code!!!!). Is it possible to perform some link
time optimization??????????
3.	Please Elaborate as I am new to this, I have referred sites, gcc
help and tried some "lto" options but NO reduction is size!!!!!!!!!!!!!
4.	I also tried using 
	-fdata-sections
	-ffunction-sections
But It has INCREASED my firmware.abs file size from KB to MB (yes it is
MB!!!!) I also wondered WHY??????????
I am using codesourcery arm toolchain evaluation.
It has gcc version 4.5.2 

Thanks for patiently reading my question.






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-07  7:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-13 15:19 Code Optimization Roger Faust
2013-08-07  6:01 code optimization hemant undale
2013-08-07  7:16 AW: " Christoph Kobe
2013-08-07  7:35 ` hemant undale

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).