diff mbox series

[4/4] xen/link: Misc cleanup

Message ID 1560975087-25632-5-git-send-email-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show
Series xen/link: Fixes and improvements to Xen's linking | expand

Commit Message

Andrew Cooper June 19, 2019, 8:11 p.m. UTC
* Drop .gnu.warning.  Xen, not being a library, has no need for
   __attribute__((__warning__("str"))) and isn't liable to ever gain such
   annotations for link time warnings.
 * Adjust the indentation of the start of ARM's .rodata section.
 * Discard .discard on ARM.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/xen.lds.S | 7 ++++---
 xen/arch/x86/xen.lds.S | 1 -
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Julien Grall June 19, 2019, 9:30 p.m. UTC | #1
Hi,

On 6/19/19 9:11 PM, Andrew Cooper wrote:
>   * Drop .gnu.warning.  Xen, not being a library, has no need for
>     __attribute__((__warning__("str"))) and isn't liable to ever gain such
>     annotations for link time warnings.

What if this is introduced? How do we catch it?

>   * Adjust the indentation of the start of ARM's .rodata section.
>   * Discard .discard on ARM.

Cheers,
Andrew Cooper June 19, 2019, 9:38 p.m. UTC | #2
On 19/06/2019 22:30, Julien Grall wrote:
> Hi,
>
> On 6/19/19 9:11 PM, Andrew Cooper wrote:
>>   * Drop .gnu.warning.  Xen, not being a library, has no need for
>>     __attribute__((__warning__("str"))) and isn't liable to ever gain
>> such
>>     annotations for link time warnings.
>
> What if this is introduced?

Then attempting to link Xen as a library against another object file
won't emit the custom linker warning.

Its main use is for phase-out of problematic API's, but for Xen (and
other standalone binaries) we do that by replacing problematic functions
entirely.

> How do we catch it?

Code review?

~Andrew
Roger Pau Monné June 20, 2019, 8:43 a.m. UTC | #3
On Wed, Jun 19, 2019 at 09:11:27PM +0100, Andrew Cooper wrote:
>  * Drop .gnu.warning.  Xen, not being a library, has no need for
>    __attribute__((__warning__("str"))) and isn't liable to ever gain such
>    annotations for link time warnings.
>  * Adjust the indentation of the start of ARM's .rodata section.
>  * Discard .discard on ARM.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

For x86:

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.
Julien Grall June 20, 2019, 12:29 p.m. UTC | #4
Hi Andrew,

On 6/19/19 10:38 PM, Andrew Cooper wrote:
> On 19/06/2019 22:30, Julien Grall wrote:
>> Hi,
>>
>> On 6/19/19 9:11 PM, Andrew Cooper wrote:
>>>    * Drop .gnu.warning.  Xen, not being a library, has no need for
>>>      __attribute__((__warning__("str"))) and isn't liable to ever gain
>>> such
>>>      annotations for link time warnings.
>>
>> What if this is introduced?
> 
> Then attempting to link Xen as a library against another object file
> won't emit the custom linker warning.

Ok, so it is not like Xen will crash.

> Its main use is for phase-out of problematic API's, but for Xen (and
> other standalone binaries) we do that by replacing problematic functions
> entirely.
>> How do we catch it?
> 
> Code review?

I usually quite like when the tools help us to catch such issue :).

Anyway, as this is not overly critical:

Acked-by: Julien Grall <julien.grall@arm.com>

Cheers,
Jan Beulich June 21, 2019, 9:34 a.m. UTC | #5
>>> On 19.06.19 at 22:11, <andrew.cooper3@citrix.com> wrote:
> * Drop .gnu.warning.  Xen, not being a library, has no need for
>    __attribute__((__warning__("str"))) and isn't liable to ever gain such
>    annotations for link time warnings.
>  * Adjust the indentation of the start of ARM's .rodata section.
>  * Discard .discard on ARM.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

x86:
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
diff mbox series

Patch

diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 3dc5117..c5ef5d5 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -35,14 +35,13 @@  SECTIONS
        *(.text.cold)
        *(.text.unlikely)
        *(.fixup)
-       *(.gnu.warning)
        _etext = .;             /* End of text section */
   } :text = 0x9090
 
   . = ALIGN(PAGE_SIZE);
   .rodata : {
-        _srodata = .;          /* Read-only data */
-        /* Bug frames table */
+       _srodata = .;           /* Read-only data */
+       /* Bug frames table */
        __start_bug_frames = .;
        *(.bug_frames.0)
        __stop_bug_frames_0 = .;
@@ -209,6 +208,8 @@  SECTIONS
        *(.exit.text)
        *(.exit.data)
        *(.exitcall.exit)
+       *(.discard)
+       *(.discard.*)
        *(.eh_frame)
   }
 
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index ef11949..8bc2be3 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -82,7 +82,6 @@  SECTIONS
        *(.text.unlikely)
        *(.fixup)
        *(.text.kexec)
-       *(.gnu.warning)
        _etext = .;             /* End of text section */
   } :text = 0x9090