Patchwork [google/gcc-4_6] Port arm hardfp patch from Linaro (issue 6206055)

login
register
mail settings
Submitter Han Shen
Date May 11, 2012, 6:26 p.m.
Message ID <20cf305e236faae5d304bfc6e0fe@google.com>
Download mbox | patch
Permalink /patch/158564/
State New
Headers show

Comments

Han Shen - May 11, 2012, 6:26 p.m.
Reviewers: carrot, xur,

Message:
Hi Rong and Carrot, could you take a look at this patch, thanks!

The modification is in upstream (with a minor modification).

Background -

There is the need to agree on the runtime linker path for the various
ARM
hard-float ports that distros are working on right now. Without doing
this,
we'll break binary compatibility between the distros.

The conclusion was made. And here is the detailed information -
https://wiki.linaro.org/OfficeofCTO/HardFloat/LinkerPathCallApr2012

Patch

===== Patch starts
diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
index 3a32188..58d06c2 100644
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -32,7 +32,8 @@ 
    while (false)

  /* We default to a soft-float ABI so that binaries can run on all
-   target hardware.  */
+   target hardware.  If you override this to use the hard-float ABI
then
+   change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well.  */
  #undef  TARGET_DEFAULT_FLOAT_ABI
  #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT

@@ -59,10 +60,26 @@ 
  #undef  SUBTARGET_EXTRA_LINK_SPEC
  #define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION

-/* Use ld-linux.so.3 so that it will be possible to run "classic"
-   GNU/Linux binaries on an EABI system.  */
+/* GNU/Linux on ARM currently supports three dynamic linkers:
+   - ld-linux.so.2 - for the legacy ABI
+   - ld-linux.so.3 - for the EABI-derived soft-float ABI
+   - ld-linux-armhf.so.3 - for the EABI-derived hard-float ABI.
+   All the dynamic linkers live in /lib.
+   We default to soft-float, but this can be overridden by changing
both
+   GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
+
  #undef  GLIBC_DYNAMIC_LINKER
-#define GLIBC_DYNAMIC_LINKER RUNTIME_ROOT_PREFIX "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT \
+  RUNTIME_ROOT_PREFIX "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT \
+  RUNTIME_ROOT_PREFIX "/lib/ld-linux-armhf.so.3"
+#define GLIBC_DYNAMIC_LINKER_DEFAULT \
+  RUNTIME_ROOT_PREFIX GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
+
+#define GLIBC_DYNAMIC_LINKER \
+   "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
+    %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
+    %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"

  /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
     use the GNU/Linux version, not the generic BPABI version.  */


Description:
Hi Rong and Carrot, could you take a look at this patch, thanks!

The modification is in upstream (with a minor modification).

Background -

There is the need to agree on the runtime linker path for the various
ARM hard-float ports that distros are working on right now. Without
doing this, we'll break binary compatibility between the distros.

The conclusion was made. And here is the detailed information -
https://wiki.linaro.org/OfficeofCTO/HardFloat/LinkerPathCallApr2012

===== Patch starts
diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
index 3a32188..58d06c2 100644
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -32,7 +32,8 @@ 
    while (false)

  /* We default to a soft-float ABI so that binaries can run on all
-   target hardware.  */
+   target hardware.  If you override this to use the hard-float ABI
then
+   change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well.  */
  #undef  TARGET_DEFAULT_FLOAT_ABI
  #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT

@@ -59,10 +60,26 @@ 
  #undef  SUBTARGET_EXTRA_LINK_SPEC
  #define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION

-/* Use ld-linux.so.3 so that it will be possible to run "classic"
-   GNU/Linux binaries on an EABI system.  */
+/* GNU/Linux on ARM currently supports three dynamic linkers:
+   - ld-linux.so.2 - for the legacy ABI
+   - ld-linux.so.3 - for the EABI-derived soft-float ABI
+   - ld-linux-armhf.so.3 - for the EABI-derived hard-float ABI.
+   All the dynamic linkers live in /lib.
+   We default to soft-float, but this can be overridden by changing
both
+   GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
+
  #undef  GLIBC_DYNAMIC_LINKER
-#define GLIBC_DYNAMIC_LINKER RUNTIME_ROOT_PREFIX "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT \
+  RUNTIME_ROOT_PREFIX "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT \
+  RUNTIME_ROOT_PREFIX "/lib/ld-linux-armhf.so.3"
+#define GLIBC_DYNAMIC_LINKER_DEFAULT \
+  RUNTIME_ROOT_PREFIX GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
+
+#define GLIBC_DYNAMIC_LINKER \
+   "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
+    %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
+    %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"

  /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
     use the GNU/Linux version, not the generic BPABI version.  */





Please review this at http://codereview.appspot.com/6206055/

Affected files:
   M gcc/config/arm/linux-eabi.h


Index: gcc/config/arm/linux-eabi.h
diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
index 3a32188..58d06c2 100644
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -32,7 +32,8 @@ 
    while (false)

  /* We default to a soft-float ABI so that binaries can run on all
-   target hardware.  */
+   target hardware.  If you override this to use the hard-float ABI then
+   change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well.  */
  #undef  TARGET_DEFAULT_FLOAT_ABI
  #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT

@@ -59,10 +60,26 @@ 
  #undef  SUBTARGET_EXTRA_LINK_SPEC
  #define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION

-/* Use ld-linux.so.3 so that it will be possible to run "classic"
-   GNU/Linux binaries on an EABI system.  */
+/* GNU/Linux on ARM currently supports three dynamic linkers:
+   - ld-linux.so.2 - for the legacy ABI
+   - ld-linux.so.3 - for the EABI-derived soft-float ABI
+   - ld-linux-armhf.so.3 - for the EABI-derived hard-float ABI.
+   All the dynamic linkers live in /lib.
+   We default to soft-float, but this can be overridden by changing both
+   GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
+
  #undef  GLIBC_DYNAMIC_LINKER
-#define GLIBC_DYNAMIC_LINKER RUNTIME_ROOT_PREFIX "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT \
+  RUNTIME_ROOT_PREFIX "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT \
+  RUNTIME_ROOT_PREFIX "/lib/ld-linux-armhf.so.3"
+#define GLIBC_DYNAMIC_LINKER_DEFAULT \
+  RUNTIME_ROOT_PREFIX GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
+
+#define GLIBC_DYNAMIC_LINKER \
+   "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
+    %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
+    %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"

  /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
     use the GNU/Linux version, not the generic BPABI version.  */