diff mbox

[i386,Android] Enable exceptions and RTTI by default for Android

Message ID CAMbmDYbVb0ksxY2FFy9+0rzJKve+-BHeERxVBPJtJ_wZMQtG2A@mail.gmail.com
State New
Headers show

Commit Message

Ilya Enkovich Feb. 22, 2012, 2:57 p.m. UTC
Hello,

Here is a simple patch which enables exceptions and RTTI by default
for Android target. OK for trunk?

Thanks,
Ilya
--

2012-02-22  Enkovich Ilya  <ilya.enkovich@intel.com>

	* gcc/config/linux-android.h (ANDROID_CC1PLUS_SPEC): Enable
	exceptions and rtti by default.

Comments

Richard Biener Feb. 22, 2012, 3:07 p.m. UTC | #1
On Wed, Feb 22, 2012 at 3:57 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> Hello,
>
> Here is a simple patch which enables exceptions and RTTI by default
> for Android target. OK for trunk?

Err - isn't that the default?  Thus, simply delete the bogus spec?

Richard.


> Thanks,
> Ilya
> --
>
> 2012-02-22  Enkovich Ilya  <ilya.enkovich@intel.com>
>
>        * gcc/config/linux-android.h (ANDROID_CC1PLUS_SPEC): Enable
>        exceptions and rtti by default.
>
>
> diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
> index 94c5274..7256082 100644
> --- a/gcc/config/linux-android.h
> +++ b/gcc/config/linux-android.h
> @@ -46,8 +46,8 @@
>   "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}"
>
>  #define ANDROID_CC1PLUS_SPEC                                           \
> -  "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} "               \
> -  "%{!frtti:%{!fno-rtti: -fno-rtti}}"
> +  "%{!fexceptions:%{!fno-exceptions: -fexceptions}} "          \
> +  "%{!frtti:%{!fno-rtti: -frtti}}"
>
>  #define ANDROID_LIB_SPEC \
>   "%{!static: -ldl}"
Jing Yu Feb. 22, 2012, 7:20 p.m. UTC | #2
So far, Android ARM toolchain, which builds Android platform for ARM
boards, does not enable RTTI and exceptions by default. There are
license concerns with the use of GNU libstdc++ and libsupc++.

Thanks,
Jing

On Wed, Feb 22, 2012 at 7:07 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Wed, Feb 22, 2012 at 3:57 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>> Hello,
>>
>> Here is a simple patch which enables exceptions and RTTI by default
>> for Android target. OK for trunk?
>
> Err - isn't that the default?  Thus, simply delete the bogus spec?
>
> Richard.
>
>
>> Thanks,
>> Ilya
>> --
>>
>> 2012-02-22  Enkovich Ilya  <ilya.enkovich@intel.com>
>>
>>        * gcc/config/linux-android.h (ANDROID_CC1PLUS_SPEC): Enable
>>        exceptions and rtti by default.
>>
>>
>> diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
>> index 94c5274..7256082 100644
>> --- a/gcc/config/linux-android.h
>> +++ b/gcc/config/linux-android.h
>> @@ -46,8 +46,8 @@
>>   "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}"
>>
>>  #define ANDROID_CC1PLUS_SPEC                                           \
>> -  "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} "               \
>> -  "%{!frtti:%{!fno-rtti: -fno-rtti}}"
>> +  "%{!fexceptions:%{!fno-exceptions: -fexceptions}} "          \
>> +  "%{!frtti:%{!fno-rtti: -frtti}}"
>>
>>  #define ANDROID_LIB_SPEC \
>>   "%{!static: -ldl}"
H.J. Lu Feb. 22, 2012, 7:32 p.m. UTC | #3
On Wed, Feb 22, 2012 at 11:20 AM, Jing Yu <jingyu@google.com> wrote:
> So far, Android ARM toolchain, which builds Android platform for ARM
> boards, does not enable RTTI and exceptions by default. There are
> license concerns with the use of GNU libstdc++ and libsupc++.
>

I am not a lawyer.  From

http://www.gnu.org/licenses/gcc-exception-faq.html

I use a proprietary compiler toolchain without any parts of GCC to
compile my program, and link it with libstdc++. My program itself does
not include any runtime library code the same way that GCC-compiled
programs include libgcc. Can I still take advantage of the exception?

    Yes. While combining libgcc with GCC-compiled object code is
probably the most common way the exception is used, neither the GPL
nor the GCC Runtime Library Exception distinguish between static
linking, dynamic linking, and other methods for combining code in
their conditions. The same permissions are available to you, under the
same terms, no matter which method you use.

It indicates both libstdc++.a and libstdc++.so are covered by GPLv3
run-time exception.
Richard Biener Feb. 23, 2012, 8:56 a.m. UTC | #4
On Wed, Feb 22, 2012 at 8:20 PM, Jing Yu <jingyu@google.com> wrote:
> So far, Android ARM toolchain, which builds Android platform for ARM
> boards, does not enable RTTI and exceptions by default. There are
> license concerns with the use of GNU libstdc++ and libsupc++.

That, of course, does not answer my question why

>>> +  "%{!fexceptions:%{!fno-exceptions: -fexceptions}} "          \
>>> +  "%{!frtti:%{!fno-rtti: -frtti}}"

is not a no-op.

Richard.

> Thanks,
> Jing
>
> On Wed, Feb 22, 2012 at 7:07 AM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> On Wed, Feb 22, 2012 at 3:57 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>>> Hello,
>>>
>>> Here is a simple patch which enables exceptions and RTTI by default
>>> for Android target. OK for trunk?
>>
>> Err - isn't that the default?  Thus, simply delete the bogus spec?
>>
>> Richard.
>>
>>
>>> Thanks,
>>> Ilya
>>> --
>>>
>>> 2012-02-22  Enkovich Ilya  <ilya.enkovich@intel.com>
>>>
>>>        * gcc/config/linux-android.h (ANDROID_CC1PLUS_SPEC): Enable
>>>        exceptions and rtti by default.
>>>
>>>
>>> diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
>>> index 94c5274..7256082 100644
>>> --- a/gcc/config/linux-android.h
>>> +++ b/gcc/config/linux-android.h
>>> @@ -46,8 +46,8 @@
>>>   "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}"
>>>
>>>  #define ANDROID_CC1PLUS_SPEC                                           \
>>> -  "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} "               \
>>> -  "%{!frtti:%{!fno-rtti: -fno-rtti}}"
>>> +  "%{!fexceptions:%{!fno-exceptions: -fexceptions}} "          \
>>> +  "%{!frtti:%{!fno-rtti: -frtti}}"
>>>
>>>  #define ANDROID_LIB_SPEC \
>>>   "%{!static: -ldl}"
diff mbox

Patch

diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
index 94c5274..7256082 100644
--- a/gcc/config/linux-android.h
+++ b/gcc/config/linux-android.h
@@ -46,8 +46,8 @@ 
   "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}"

 #define ANDROID_CC1PLUS_SPEC						\
-  "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} "		\
-  "%{!frtti:%{!fno-rtti: -fno-rtti}}"
+  "%{!fexceptions:%{!fno-exceptions: -fexceptions}} "		\
+  "%{!frtti:%{!fno-rtti: -frtti}}"

 #define ANDROID_LIB_SPEC \
   "%{!static: -ldl}"