[v2] gcc: xtensa: don't force PIC for uclinux target

Message ID 20181105190711.4626-1-jcmvbkbc@gmail.com
State New
Headers show
Series
  • [v2] gcc: xtensa: don't force PIC for uclinux target
Related show

Commit Message

Max Filippov Nov. 5, 2018, 7:07 p.m.
xtensa-uclinux uses bFLT executable file format that cannot relocate
fields representing offsets from data to code. C++ objects built as PIC
use offsets to encode FDE structures. As a result C++ exception handling
doesn't work correctly on xtensa-uclinux. Don't use PIC by default on
xtensa-uclinux.

gcc/
2018-11-04  Max Filippov  <jcmvbkbc@gmail.com>

	* config/xtensa/uclinux.h (XTENSA_ALWAYS_PIC): Change to 0.
---
Changes v1->v2:
- fix up comment for the XTENSA_ALWAYS_PIC macro

 gcc/config/xtensa/uclinux.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.11.0

Comments

augustine.sterling@gmail.com Nov. 5, 2018, 11:17 p.m. | #1
On Mon, Nov 5, 2018 at 11:07 AM Max Filippov <jcmvbkbc@gmail.com> wrote:

> xtensa-uclinux uses bFLT executable file format that cannot relocate

> fields representing offsets from data to code. C++ objects built as PIC

> use offsets to encode FDE structures. As a result C++ exception handling

> doesn't work correctly on xtensa-uclinux. Don't use PIC by default on

> xtensa-uclinux.

>

> gcc/

> 2018-11-04  Max Filippov  <jcmvbkbc@gmail.com>

>

>         * config/xtensa/uclinux.h (XTENSA_ALWAYS_PIC): Change to 0.

>


Approved.
Max Filippov Nov. 6, 2018, midnight | #2
On Mon, Nov 5, 2018 at 3:18 PM augustine.sterling@gmail.com
<augustine.sterling@gmail.com> wrote:
>

> On Mon, Nov 5, 2018 at 11:07 AM Max Filippov <jcmvbkbc@gmail.com> wrote:

>>

>> xtensa-uclinux uses bFLT executable file format that cannot relocate

>> fields representing offsets from data to code. C++ objects built as PIC

>> use offsets to encode FDE structures. As a result C++ exception handling

>> doesn't work correctly on xtensa-uclinux. Don't use PIC by default on

>> xtensa-uclinux.

>>

>> gcc/

>> 2018-11-04  Max Filippov  <jcmvbkbc@gmail.com>

>>

>>         * config/xtensa/uclinux.h (XTENSA_ALWAYS_PIC): Change to 0.

>

> Approved.


Thanks! Applied to trunk. Will also backport it to gcc-8, gcc-7 and
gcc-6 branches.

-- Max

Patch

diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h
index ba26187c8f7a..c7743df9d97c 100644
--- a/gcc/config/xtensa/uclinux.h
+++ b/gcc/config/xtensa/uclinux.h
@@ -59,8 +59,8 @@  along with GCC; see the file COPYING3.  If not see
 #undef LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX	"."
 
-/* Always enable "-fpic" for Xtensa Linux.  */
-#define XTENSA_ALWAYS_PIC 1
+/* Don't enable "-fpic" for Xtensa uclinux.  */
+#define XTENSA_ALWAYS_PIC 0
 
 #undef TARGET_LIBC_HAS_FUNCTION
 #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function