Patchwork at91bootstrap: fix gcc-4.6.x overlap linker issue

login
register
mail settings
Submitter Peter Korsgaard
Date Oct. 8, 2012, 8:04 p.m.
Message ID <87txu43f30.fsf@macbook.be.48ers.dk>
Download mbox | patch
Permalink /patch/190117/
State Superseded
Headers show

Comments

Peter Korsgaard - Oct. 8, 2012, 8:04 p.m.
>>>>> "Grégory" == Grégory Hermant <gregory.hermant@calao-systems.com> writes:

 Grégory> ---
 Grégory>  ...at91bootstrap-1.16-gcc-4.6.x-ldscript-fix.patch |   53 ++++++++++++++++++++
 Grégory>  1 file changed, 53 insertions(+)
 Grégory>  create mode 100644 boot/at91bootstrap/at91bootstrap-1.16-gcc-4.6.x-ldscript-fix.patch

 Grégory> diff --git a/boot/at91bootstrap/at91bootstrap-1.16-gcc-4.6.x-ldscript-fix.patch b/boot/at91bootstrap/at91bootstrap-1.16-gcc-4.6.x-ldscript-fix.patch
 Grégory> new file mode 100644
 Grégory> index 0000000..56947c7
 Grégory> --- /dev/null
 Grégory> +++ b/boot/at91bootstrap/at91bootstrap-1.16-gcc-4.6.x-ldscript-fix.patch
 Grégory> @@ -0,0 +1,53 @@
 Grégory> +From 5a094e959cd216c1be148effc624eb12e2083de9 Mon Sep 17 00:00:00 2001
 Grégory> +From: Gregory Hermant <gregory.hermant@calao-systems.com>
 Grégory> +Date: Mon, 1 Oct 2012 16:54:43 +0200
 Grégory> +Subject: [PATCH] at91bootstrap-v1.16-ldscript-fix
 Grégory> +
 Grégory> +---
 Grégory> + crt0_gnu.S          |    2 +-
 Grégory> + elf32-littlearm.lds |   12 +++++++++++-
 Grégory> + 2 files changed, 12 insertions(+), 2 deletions(-)
 Grégory> +
 Grégory> +diff --git a/crt0_gnu.S b/crt0_gnu.S
 Grégory> +index 002feef..ea6581f 100644
 Grégory> +--- a/crt0_gnu.S
 Grégory> ++++ b/crt0_gnu.S
 Grégory> +@@ -191,7 +191,7 @@ _go:
 Grégory> + + 	.align
 Grégory> + _lp_data:
 Grégory> +-        .word _etext
 Grégory> ++        .word _edummy
 Grégory> +         .word _sdata
 Grégory> +         .word _edata
 Grégory> + +diff --git a/elf32-littlearm.lds b/elf32-littlearm.lds
 Grégory> +index a33952f..17b1646 100644
 Grégory> +--- a/elf32-littlearm.lds
 Grégory> ++++ b/elf32-littlearm.lds
 Grégory> +@@ -10,11 +10,21 @@ SECTIONS
 Grégory> + 		*(.rodata)                 /* read-only data (constants) */
 Grégory> + 		*(.rodata*)
 Grégory> + 		. = ALIGN(4);
 Grégory> ++		*(.glue_7)
 Grégory> ++		. = ALIGN(4);
 Grégory> ++		*(.eh_frame)
 Grégory> ++		. = ALIGN(4);

Is all of that needed? Isn't it just that gcc 4.6+ adds a bunch of
.text.<blah> sections? I've fixed it up for an internal tree at work by
just doing:
Gregory Hermant - Oct. 9, 2012, 4:37 p.m.
Hello peter,
You are right there's no need to add the code below in the linker script to fix this issue.
Thanks for your time.
gregory

Le 08/10/2012 22:04, Peter Korsgaard a écrit :
>>>>>> "Grégory" == Grégory Hermant <gregory.hermant@calao-systems.com> writes:
> 
>  Grégory> ---
>  Grégory>  ...at91bootstrap-1.16-gcc-4.6.x-ldscript-fix.patch |   53 ++++++++++++++++++++
>  Grégory>  1 file changed, 53 insertions(+)
>  Grégory>  create mode 100644 boot/at91bootstrap/at91bootstrap-1.16-gcc-4.6.x-ldscript-fix.patch
> 
>  Grégory> diff --git a/boot/at91bootstrap/at91bootstrap-1.16-gcc-4.6.x-ldscript-fix.patch b/boot/at91bootstrap/at91bootstrap-1.16-gcc-4.6.x-ldscript-fix.patch
>  Grégory> new file mode 100644
>  Grégory> index 0000000..56947c7
>  Grégory> --- /dev/null
>  Grégory> +++ b/boot/at91bootstrap/at91bootstrap-1.16-gcc-4.6.x-ldscript-fix.patch
>  Grégory> @@ -0,0 +1,53 @@
>  Grégory> +From 5a094e959cd216c1be148effc624eb12e2083de9 Mon Sep 17 00:00:00 2001
>  Grégory> +From: Gregory Hermant <gregory.hermant@calao-systems.com>
>  Grégory> +Date: Mon, 1 Oct 2012 16:54:43 +0200
>  Grégory> +Subject: [PATCH] at91bootstrap-v1.16-ldscript-fix
>  Grégory> +
>  Grégory> +---
>  Grégory> + crt0_gnu.S          |    2 +-
>  Grégory> + elf32-littlearm.lds |   12 +++++++++++-
>  Grégory> + 2 files changed, 12 insertions(+), 2 deletions(-)
>  Grégory> +
>  Grégory> +diff --git a/crt0_gnu.S b/crt0_gnu.S
>  Grégory> +index 002feef..ea6581f 100644
>  Grégory> +--- a/crt0_gnu.S
>  Grégory> ++++ b/crt0_gnu.S
>  Grégory> +@@ -191,7 +191,7 @@ _go:
>  Grégory> + + 	.align
>  Grégory> + _lp_data:
>  Grégory> +-        .word _etext
>  Grégory> ++        .word _edummy
>  Grégory> +         .word _sdata
>  Grégory> +         .word _edata
>  Grégory> + +diff --git a/elf32-littlearm.lds b/elf32-littlearm.lds
>  Grégory> +index a33952f..17b1646 100644
>  Grégory> +--- a/elf32-littlearm.lds
>  Grégory> ++++ b/elf32-littlearm.lds
>  Grégory> +@@ -10,11 +10,21 @@ SECTIONS
>  Grégory> + 		*(.rodata)                 /* read-only data (constants) */
>  Grégory> + 		*(.rodata*)
>  Grégory> + 		. = ALIGN(4);
>  Grégory> ++		*(.glue_7)
>  Grégory> ++		. = ALIGN(4);
>  Grégory> ++		*(.eh_frame)
>  Grégory> ++		. = ALIGN(4);
> 
> Is all of that needed? Isn't it just that gcc 4.6+ adds a bunch of
> .text.<blah> sections? I've fixed it up for an internal tree at work by
> just doing:
> 
> diff --git a/elf32-littlearm.lds b/elf32-littlearm.lds
> index a33952f..f50c30c 100644
> --- a/elf32-littlearm.lds
> +++ b/elf32-littlearm.lds
> @@ -6,7 +6,7 @@ SECTIONS
>          . = ALIGN(4);
>         .text : { 
>                 _stext = .;
> -               *(.text)
> +               *(.text*)
>                 *(.rodata)                 /* read-only data (constants) */
>                 *(.rodata*)
>                 . = ALIGN(4);
>

Patch

diff --git a/elf32-littlearm.lds b/elf32-littlearm.lds
index a33952f..f50c30c 100644
--- a/elf32-littlearm.lds
+++ b/elf32-littlearm.lds
@@ -6,7 +6,7 @@  SECTIONS
         . = ALIGN(4);
        .text : { 
                _stext = .;
-               *(.text)
+               *(.text*)
                *(.rodata)                 /* read-only data (constants) */
                *(.rodata*)
                . = ALIGN(4);