comp.lang.ada
 help / color / mirror / Atom feed
From: ytomino <aghia05@gmail.com>
Subject: -dead_strip and exception handling
Date: Sat, 20 Aug 2011 12:07:28 -0700 (PDT)
Date: 2011-08-20T12:07:28-07:00	[thread overview]
Message-ID: <a5527b52-dcc4-431a-a79d-b792e937f014@p37g2000prp.googlegroups.com> (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.



             reply	other threads:[~2011-08-20 19:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-20 19:07 ytomino [this message]
2011-08-20 21:48 ` -dead_strip and exception handling Simon Wright
2011-08-20 22:29   ` ytomino
2011-08-25 19:46   ` ytomino
replies disabled

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