diff mbox

PATCH: Use crtbegin_so%O%s/crtend_so%O%s for -mandroid -shared

Message ID 20111214171156.GC6579@intel.com
State New
Headers show

Commit Message

H.J. Lu Dec. 14, 2011, 5:11 p.m. UTC
Hi,

Android uses crtbegin_so.o and crtend_so.o to build shared library with
-mshared.  OK for trunk in stage 1?


H.J.
---
2011-12-13  H.J. Lu  <hongjiu.lu@intel.com>

	* config/linux-android.h (ANDROID_STARTFILE_SPEC): Use
	crtbegin_so%O%s for -shared.
	(ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared.
---
 gcc/ChangeLog.android      |    5 +++++
 gcc/config/linux-android.h |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)
 create mode 100644 gcc/ChangeLog.android

Comments

Jing Yu Feb. 23, 2012, 12:41 a.m. UTC | #1
I am OK with the patch, I am not a maintainer though.

Jing

On Wed, Dec 14, 2011 at 9:11 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> Android uses crtbegin_so.o and crtend_so.o to build shared library with
> -mshared.  OK for trunk in stage 1?
>
>
> H.J.
> ---
> 2011-12-13  H.J. Lu  <hongjiu.lu@intel.com>
>
>        * config/linux-android.h (ANDROID_STARTFILE_SPEC): Use
>        crtbegin_so%O%s for -shared.
>        (ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared.
> ---
>  gcc/ChangeLog.android      |    5 +++++
>  gcc/config/linux-android.h |    4 ++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
>  create mode 100644 gcc/ChangeLog.android
>
> diff --git a/gcc/ChangeLog.android b/gcc/ChangeLog.android
> new file mode 100644
> index 0000000..fc54522
> --- /dev/null
> +++ b/gcc/ChangeLog.android
> @@ -0,0 +1,5 @@
> +2011-12-13  H.J. Lu  <hongjiu.lu@intel.com>
> +
> +       * config/linux-android.h (ANDROID_STARTFILE_SPEC): Use
> +       crtbegin_so%O%s for -shared.
> +       (ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared.
> diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
> index 94c5274..acbc662 100644
> --- a/gcc/config/linux-android.h
> +++ b/gcc/config/linux-android.h
> @@ -53,8 +53,8 @@
>   "%{!static: -ldl}"
>
>  #define ANDROID_STARTFILE_SPEC                                         \
> -  "%{!shared:"                                                         \
> +  "%{shared: crtbegin_so%O%s;:"                                                \
>   "  %{static: crtbegin_static%O%s;: crtbegin_dynamic%O%s}}"
>
>  #define ANDROID_ENDFILE_SPEC \
> -  "%{!shared: crtend_android%O%s}"
> +  "%{shared: crtend_so%O%s;: crtend_android%O%s}"
> --
> 1.7.6.4
>
Maxim Kuvyrkov March 29, 2012, 5:04 a.m. UTC | #2
This is OK.  I didn't encounter building shared libraries for Android when developed the original Android support.

You can commit this under the "obvious patch" rule.  [I've asked SC for reviewer privileges for Android support, so that I can approve more complex patches.]

Thank you,

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics



On 15/12/2011, at 6:11 AM, H.J. Lu wrote:

> Hi,
> 
> Android uses crtbegin_so.o and crtend_so.o to build shared library with
> -mshared.  OK for trunk in stage 1?
> 
> 
> H.J.
> ---
> 2011-12-13  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	* config/linux-android.h (ANDROID_STARTFILE_SPEC): Use
> 	crtbegin_so%O%s for -shared.
> 	(ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared.
> ---
> gcc/ChangeLog.android      |    5 +++++
> gcc/config/linux-android.h |    4 ++--
> 2 files changed, 7 insertions(+), 2 deletions(-)
> create mode 100644 gcc/ChangeLog.android
> 
> diff --git a/gcc/ChangeLog.android b/gcc/ChangeLog.android
> new file mode 100644
> index 0000000..fc54522
> --- /dev/null
> +++ b/gcc/ChangeLog.android
> @@ -0,0 +1,5 @@
> +2011-12-13  H.J. Lu  <hongjiu.lu@intel.com>
> +
> +	* config/linux-android.h (ANDROID_STARTFILE_SPEC): Use
> +	crtbegin_so%O%s for -shared.
> +	(ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared.
> diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
> index 94c5274..acbc662 100644
> --- a/gcc/config/linux-android.h
> +++ b/gcc/config/linux-android.h
> @@ -53,8 +53,8 @@
>   "%{!static: -ldl}"
> 
> #define ANDROID_STARTFILE_SPEC						\
> -  "%{!shared:"								\
> +  "%{shared: crtbegin_so%O%s;:"						\
>   "  %{static: crtbegin_static%O%s;: crtbegin_dynamic%O%s}}"
> 
> #define ANDROID_ENDFILE_SPEC \
> -  "%{!shared: crtend_android%O%s}"
> +  "%{shared: crtend_so%O%s;: crtend_android%O%s}"
> -- 
> 1.7.6.4
>
diff mbox

Patch

diff --git a/gcc/ChangeLog.android b/gcc/ChangeLog.android
new file mode 100644
index 0000000..fc54522
--- /dev/null
+++ b/gcc/ChangeLog.android
@@ -0,0 +1,5 @@ 
+2011-12-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* config/linux-android.h (ANDROID_STARTFILE_SPEC): Use
+	crtbegin_so%O%s for -shared.
+	(ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared.
diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
index 94c5274..acbc662 100644
--- a/gcc/config/linux-android.h
+++ b/gcc/config/linux-android.h
@@ -53,8 +53,8 @@ 
   "%{!static: -ldl}"
 
 #define ANDROID_STARTFILE_SPEC						\
-  "%{!shared:"								\
+  "%{shared: crtbegin_so%O%s;:"						\
   "  %{static: crtbegin_static%O%s;: crtbegin_dynamic%O%s}}"
 
 #define ANDROID_ENDFILE_SPEC \
-  "%{!shared: crtend_android%O%s}"
+  "%{shared: crtend_so%O%s;: crtend_android%O%s}"