comp.lang.ada
 help / color / mirror / Atom feed
* -dead_strip and exception handling
@ 2011-08-20 19:07 ytomino
  2011-08-20 21:48 ` Simon Wright
  0 siblings, 1 reply; 4+ messages in thread
From: ytomino @ 2011-08-20 19:07 UTC (permalink / raw)


Hello.

I'm using Mac (Leopard), and found -dead_strip option of Apple's ld.
(instead of --gc-sections)
It's good, The size of my executable file has been reduced to half.

But I found it causes an exception handler is ignored.

with Ada.Text_IO;
procedure test1 is
begin
   raise Constraint_Error;
exception
   when Constraint_Error => Ada.Text_IO.Put_Line ("OK");
end test1;

$ gnatmake test1.adb -largs -dead_strip
gcc -c test1.adb
gnatbind -x test1.ali
gnatlink test1.ali -dead_strip
~/projects/exam/ada/compiler/dead_strip_and_eh
$ ./test1

raised CONSTRAINT_ERROR : test1.adb:4 explicit raise
~/projects/exam/ada/compiler/dead_strip_and_eh
$ gnatclean test1
"./test1.ali" has been deleted
"./test1.o" has been deleted
"test1" has been deleted
~/projects/exam/ada/compiler/dead_strip_and_eh
$ gnatmake test1.adb
gcc -c test1.adb
gnatbind -x test1.ali
gnatlink test1.ali
~/projects/exam/ada/compiler/dead_strip_and_eh
$ ./test1
OK

And I tried g++ with -dead_strip, it's ok. It could catch the
exception I threw.
Could you try it if you are Mac user ?

Thank you.



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

end of thread, other threads:[~2011-08-25 19:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-20 19:07 -dead_strip and exception handling ytomino
2011-08-20 21:48 ` Simon Wright
2011-08-20 22:29   ` ytomino
2011-08-25 19:46   ` ytomino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox