diff mbox series

[ARM/FDPIC,v5,01/21,ARM] FDPIC: Add -mfdpic option support

Message ID 20190515124006.25840-2-christophe.lyon@st.com
State Superseded
Headers show
Series FDPIC ABI for ARM | expand

Commit Message

Christophe Lyon May 15, 2019, 12:39 p.m. UTC
2019-XX-XX  Christophe Lyon  <christophe.lyon@st.com>
	Mickaël Guêné  <mickael.guene@st.com>

	gcc/
	* config/arm/arm.opt: Add -mfdpic option.
	* doc/invoke.texi: Add documentation for -mfdpic.

Change-Id: I0eabd1d11c9406fd4a43c4333689ebebbfcc4fe8

-- 
2.6.3

Comments

Richard Sandiford July 16, 2019, 10:11 a.m. UTC | #1
[This isn't really something that should be reviewed under global
reviewership, but if it's either that or nothing, I'll do it anyway...]

Christophe Lyon <christophe.lyon@st.com> writes:
> 2019-XX-XX  Christophe Lyon  <christophe.lyon@st.com>

> 	Mickaël Guêné  <mickael.guene@st.com>

>

> 	gcc/

> 	* config/arm/arm.opt: Add -mfdpic option.

> 	* doc/invoke.texi: Add documentation for -mfdpic.

>

> Change-Id: I0eabd1d11c9406fd4a43c4333689ebebbfcc4fe8

>

> diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt

> index 9067d49..2ed3bd5 100644

> --- a/gcc/config/arm/arm.opt

> +++ b/gcc/config/arm/arm.opt

> @@ -306,3 +306,7 @@ Cost to assume for a branch insn.

>  mgeneral-regs-only

>  Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Save

>  Generate code which uses the core registers only (r0-r14).

> +

> +mfdpic

> +Target Report Mask(FDPIC)

> +Enable Function Descriptor PIC mode.

> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi

> index 29585cf..805d7cc 100644

> --- a/gcc/doc/invoke.texi

> +++ b/gcc/doc/invoke.texi

> @@ -703,7 +703,8 @@ Objective-C and Objective-C++ Dialects}.

>  -mrestrict-it @gol

>  -mverbose-cost-dump @gol

>  -mpure-code @gol

> --mcmse}

> +-mcmse @gol

> +-mfdpic}

>  

>  @emph{AVR Options}

>  @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol

> @@ -17912,6 +17913,23 @@ MOVT instruction.

>  Generate secure code as per the "ARMv8-M Security Extensions: Requirements on

>  Development Tools Engineering Specification", which can be found on

>  @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.

> +

> +@item -mfdpic

> +@itemx -mno-fdpic

> +@opindex mfdpic

> +@opindex mno-fdpic

> +Select the FDPIC ABI, which uses function descriptors to represent


Maybe "64-bit function descriptors"?  Just a suggestion, might not be useful.

OK with that change, thanks.

Richard

> +pointers to functions.  When the compiler is configured for

> +@code{arm-*-uclinuxfdpiceabi} targets, this option is on by default

> +and implies @option{-fPIE} if none of the PIC/PIE-related options is

> +provided.  On other targets, it only enables the FDPIC-specific code

> +generation features, and the user should explicitly provide the

> +PIC/PIE-related options as needed.

> +

> +The opposite @option{-mno-fdpic} option is useful (and required) to

> +build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})

> +toolchain as the one used to build the userland programs.

> +

>  @end table

>  

>  @node AVR Options
Christophe Lyon Aug. 29, 2019, 2:47 p.m. UTC | #2
On 16/07/2019 12:11, Richard Sandiford wrote:
> [This isn't really something that should be reviewed under global

> reviewership, but if it's either that or nothing, I'll do it anyway...]

> 

> Christophe Lyon <christophe.lyon@st.com> writes:

>> 2019-XX-XX  Christophe Lyon  <christophe.lyon@st.com>

>> 	Mickaël Guêné  <mickael.guene@st.com>

>>

>> 	gcc/

>> 	* config/arm/arm.opt: Add -mfdpic option.

>> 	* doc/invoke.texi: Add documentation for -mfdpic.

>>

>> Change-Id: I0eabd1d11c9406fd4a43c4333689ebebbfcc4fe8

>>

>> diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt

>> index 9067d49..2ed3bd5 100644

>> --- a/gcc/config/arm/arm.opt

>> +++ b/gcc/config/arm/arm.opt

>> @@ -306,3 +306,7 @@ Cost to assume for a branch insn.

>>   mgeneral-regs-only

>>   Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Save

>>   Generate code which uses the core registers only (r0-r14).

>> +

>> +mfdpic

>> +Target Report Mask(FDPIC)

>> +Enable Function Descriptor PIC mode.

>> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi

>> index 29585cf..805d7cc 100644

>> --- a/gcc/doc/invoke.texi

>> +++ b/gcc/doc/invoke.texi

>> @@ -703,7 +703,8 @@ Objective-C and Objective-C++ Dialects}.

>>   -mrestrict-it @gol

>>   -mverbose-cost-dump @gol

>>   -mpure-code @gol

>> --mcmse}

>> +-mcmse @gol

>> +-mfdpic}

>>   

>>   @emph{AVR Options}

>>   @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol

>> @@ -17912,6 +17913,23 @@ MOVT instruction.

>>   Generate secure code as per the "ARMv8-M Security Extensions: Requirements on

>>   Development Tools Engineering Specification", which can be found on

>>   @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.

>> +

>> +@item -mfdpic

>> +@itemx -mno-fdpic

>> +@opindex mfdpic

>> +@opindex mno-fdpic

>> +Select the FDPIC ABI, which uses function descriptors to represent

> 

> Maybe "64-bit function descriptors"?  Just a suggestion, might not be useful.

> 

> OK with that change, thanks.


OK, here is a new version, where I added a few words to explain that -static
is not supported.

Thanks,
Christophe

> 

> Richard

> 

>> +pointers to functions.  When the compiler is configured for

>> +@code{arm-*-uclinuxfdpiceabi} targets, this option is on by default

>> +and implies @option{-fPIE} if none of the PIC/PIE-related options is

>> +provided.  On other targets, it only enables the FDPIC-specific code

>> +generation features, and the user should explicitly provide the

>> +PIC/PIE-related options as needed.

>> +

>> +The opposite @option{-mno-fdpic} option is useful (and required) to

>> +build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})

>> +toolchain as the one used to build the userland programs.

>> +

>>   @end table

>>   

>>   @node AVR Options

> .

>
From c936684e2b77ff5716bd8b67c617dcad088c72e0 Mon Sep 17 00:00:00 2001
From: Christophe Lyon <christophe.lyon@linaro.org>

Date: Thu, 8 Feb 2018 10:44:32 +0100
Subject: [ARM/FDPIC v6 01/24] [ARM] FDPIC: Add -mfdpic option support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

2019-XX-XX  Christophe Lyon  <christophe.lyon@st.com>
	Mickaël Guêné  <mickael.guene@st.com>

	gcc/
	* config/arm/arm.opt: Add -mfdpic option.
	* doc/invoke.texi: Add documentation for -mfdpic.

Change-Id: I05b98d6ae87c2b3fc04dd7fba415c730accdf33e

diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt
index 9067d49..2ed3bd5 100644
--- a/gcc/config/arm/arm.opt
+++ b/gcc/config/arm/arm.opt
@@ -306,3 +306,7 @@ Cost to assume for a branch insn.
 mgeneral-regs-only
 Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Save
 Generate code which uses the core registers only (r0-r14).
+
+mfdpic
+Target Report Mask(FDPIC)
+Enable Function Descriptor PIC mode.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 29585cf..b77fa06 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -703,7 +703,8 @@ Objective-C and Objective-C++ Dialects}.
 -mrestrict-it @gol
 -mverbose-cost-dump @gol
 -mpure-code @gol
--mcmse}
+-mcmse @gol
+-mfdpic}
 
 @emph{AVR Options}
 @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol
@@ -17912,6 +17913,27 @@ MOVT instruction.
 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
 Development Tools Engineering Specification", which can be found on
 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
+
+@item -mfdpic
+@itemx -mno-fdpic
+@opindex mfdpic
+@opindex mno-fdpic
+Select the FDPIC ABI, which uses 64-bit function descriptors to
+represent pointers to functions.  When the compiler is configured for
+@code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
+and implies @option{-fPIE} if none of the PIC/PIE-related options is
+provided.  On other targets, it only enables the FDPIC-specific code
+generation features, and the user should explicitly provide the
+PIC/PIE-related options as needed.
+
+Note that static linking is not supported because it would still
+involve the dynamic linker when the program self-relocates.  If such
+behaviour is acceptable, use -static and -Wl,-dynamic-linker options.
+
+The opposite @option{-mno-fdpic} option is useful (and required) to
+build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
+toolchain as the one used to build the userland programs.
+
 @end table
 
 @node AVR Options
-- 
2.6.3
Richard Sandiford Aug. 30, 2019, 9:24 a.m. UTC | #3
Christophe Lyon <christophe.lyon@st.com> writes:
> On 16/07/2019 12:11, Richard Sandiford wrote:

>> [This isn't really something that should be reviewed under global

>> reviewership, but if it's either that or nothing, I'll do it anyway...]

>> 

>> Christophe Lyon <christophe.lyon@st.com> writes:

>>> 2019-XX-XX  Christophe Lyon  <christophe.lyon@st.com>

>>> 	Mickaël Guêné  <mickael.guene@st.com>

>>>

>>> 	gcc/

>>> 	* config/arm/arm.opt: Add -mfdpic option.

>>> 	* doc/invoke.texi: Add documentation for -mfdpic.

>>>

>>> Change-Id: I0eabd1d11c9406fd4a43c4333689ebebbfcc4fe8

>>>

>>> diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt

>>> index 9067d49..2ed3bd5 100644

>>> --- a/gcc/config/arm/arm.opt

>>> +++ b/gcc/config/arm/arm.opt

>>> @@ -306,3 +306,7 @@ Cost to assume for a branch insn.

>>>   mgeneral-regs-only

>>>   Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Save

>>>   Generate code which uses the core registers only (r0-r14).

>>> +

>>> +mfdpic

>>> +Target Report Mask(FDPIC)

>>> +Enable Function Descriptor PIC mode.

>>> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi

>>> index 29585cf..805d7cc 100644

>>> --- a/gcc/doc/invoke.texi

>>> +++ b/gcc/doc/invoke.texi

>>> @@ -703,7 +703,8 @@ Objective-C and Objective-C++ Dialects}.

>>>   -mrestrict-it @gol

>>>   -mverbose-cost-dump @gol

>>>   -mpure-code @gol

>>> --mcmse}

>>> +-mcmse @gol

>>> +-mfdpic}

>>>   

>>>   @emph{AVR Options}

>>>   @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol

>>> @@ -17912,6 +17913,23 @@ MOVT instruction.

>>>   Generate secure code as per the "ARMv8-M Security Extensions: Requirements on

>>>   Development Tools Engineering Specification", which can be found on

>>>   @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.

>>> +

>>> +@item -mfdpic

>>> +@itemx -mno-fdpic

>>> +@opindex mfdpic

>>> +@opindex mno-fdpic

>>> +Select the FDPIC ABI, which uses function descriptors to represent

>> 

>> Maybe "64-bit function descriptors"?  Just a suggestion, might not be useful.

>> 

>> OK with that change, thanks.

>

> OK, here is a new version, where I added a few words to explain that -static

> is not supported.

>

> Thanks,

> Christophe

>

>> 

>> Richard

>> 

>>> +pointers to functions.  When the compiler is configured for

>>> +@code{arm-*-uclinuxfdpiceabi} targets, this option is on by default

>>> +and implies @option{-fPIE} if none of the PIC/PIE-related options is

>>> +provided.  On other targets, it only enables the FDPIC-specific code

>>> +generation features, and the user should explicitly provide the

>>> +PIC/PIE-related options as needed.

>>> +

>>> +The opposite @option{-mno-fdpic} option is useful (and required) to

>>> +build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})

>>> +toolchain as the one used to build the userland programs.

>>> +

>>>   @end table

>>>   

>>>   @node AVR Options

>> .

>> 

>

> From c936684e2b77ff5716bd8b67c617dcad088c72e0 Mon Sep 17 00:00:00 2001

> From: Christophe Lyon <christophe.lyon@linaro.org>

> Date: Thu, 8 Feb 2018 10:44:32 +0100

> Subject: [ARM/FDPIC v6 01/24] [ARM] FDPIC: Add -mfdpic option support

> MIME-Version: 1.0

> Content-Type: text/plain; charset=UTF-8

> Content-Transfer-Encoding: 8bit

>

> 2019-XX-XX  Christophe Lyon  <christophe.lyon@st.com>

> 	Micka«l Guªn©  <mickael.guene@st.com>

>

> 	gcc/

> 	* config/arm/arm.opt: Add -mfdpic option.

> 	* doc/invoke.texi: Add documentation for -mfdpic.

>

> Change-Id: I05b98d6ae87c2b3fc04dd7fba415c730accdf33e

>

> diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt

> index 9067d49..2ed3bd5 100644

> --- a/gcc/config/arm/arm.opt

> +++ b/gcc/config/arm/arm.opt

> @@ -306,3 +306,7 @@ Cost to assume for a branch insn.

>  mgeneral-regs-only

>  Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Save

>  Generate code which uses the core registers only (r0-r14).

> +

> +mfdpic

> +Target Report Mask(FDPIC)

> +Enable Function Descriptor PIC mode.

> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi

> index 29585cf..b77fa06 100644

> --- a/gcc/doc/invoke.texi

> +++ b/gcc/doc/invoke.texi

> @@ -703,7 +703,8 @@ Objective-C and Objective-C++ Dialects}.

>  -mrestrict-it @gol

>  -mverbose-cost-dump @gol

>  -mpure-code @gol

> --mcmse}

> +-mcmse @gol

> +-mfdpic}

>  

>  @emph{AVR Options}

>  @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol

> @@ -17912,6 +17913,27 @@ MOVT instruction.

>  Generate secure code as per the "ARMv8-M Security Extensions: Requirements on

>  Development Tools Engineering Specification", which can be found on

>  @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.

> +

> +@item -mfdpic

> +@itemx -mno-fdpic

> +@opindex mfdpic

> +@opindex mno-fdpic

> +Select the FDPIC ABI, which uses 64-bit function descriptors to

> +represent pointers to functions.  When the compiler is configured for

> +@code{arm-*-uclinuxfdpiceabi} targets, this option is on by default

> +and implies @option{-fPIE} if none of the PIC/PIE-related options is

> +provided.  On other targets, it only enables the FDPIC-specific code

> +generation features, and the user should explicitly provide the

> +PIC/PIE-related options as needed.

> +

> +Note that static linking is not supported because it would still

> +involve the dynamic linker when the program self-relocates.  If such

> +behaviour is acceptable, use -static and -Wl,-dynamic-linker options.


"behavior".  (To correct correct spelling :-/)

OK with that change if there are no objections before the rest of
the series is approved.

> +

> +The opposite @option{-mno-fdpic} option is useful (and required) to

> +build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})

> +toolchain as the one used to build the userland programs.

> +

>  @end table

>  

>  @node AVR Options
diff mbox series

Patch

diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt
index 9067d49..2ed3bd5 100644
--- a/gcc/config/arm/arm.opt
+++ b/gcc/config/arm/arm.opt
@@ -306,3 +306,7 @@  Cost to assume for a branch insn.
 mgeneral-regs-only
 Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Save
 Generate code which uses the core registers only (r0-r14).
+
+mfdpic
+Target Report Mask(FDPIC)
+Enable Function Descriptor PIC mode.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 29585cf..805d7cc 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -703,7 +703,8 @@  Objective-C and Objective-C++ Dialects}.
 -mrestrict-it @gol
 -mverbose-cost-dump @gol
 -mpure-code @gol
--mcmse}
+-mcmse @gol
+-mfdpic}
 
 @emph{AVR Options}
 @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol
@@ -17912,6 +17913,23 @@  MOVT instruction.
 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
 Development Tools Engineering Specification", which can be found on
 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
+
+@item -mfdpic
+@itemx -mno-fdpic
+@opindex mfdpic
+@opindex mno-fdpic
+Select the FDPIC ABI, which uses function descriptors to represent
+pointers to functions.  When the compiler is configured for
+@code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
+and implies @option{-fPIE} if none of the PIC/PIE-related options is
+provided.  On other targets, it only enables the FDPIC-specific code
+generation features, and the user should explicitly provide the
+PIC/PIE-related options as needed.
+
+The opposite @option{-mno-fdpic} option is useful (and required) to
+build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
+toolchain as the one used to build the userland programs.
+
 @end table
 
 @node AVR Options