ld-elf/ehdr_start: Pass --build-id to ld

Message ID 20180216164955.26757-1-hjl.tools@gmail.com
State New
Headers show
Series
  • ld-elf/ehdr_start: Pass --build-id to ld
Related show

Commit Message

H.J. Lu Feb. 16, 2018, 4:49 p.m.
ld-elf/ehdr_start fails with -z separate-code.  Since there is no data
LOAD segment before code LOAD segment:

There are 2 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  LOAD           0x200000 0x0000000000600000 0x0000000000600000 0x000010 0x000010 R E 0x200000
  LOAD           0x400000 0x0000000000800000 0x0000000000800000 0x000008 0x000008 R   0x200000

 Section to Segment mapping:
  Segment Sections...
   00     .text
   01     .rodata

the program header isn't included in any LOAD segment.  As the result,
reference to __ehdr_start is resolved to zero.  Pass --build-id to ld
to add a data LOAD segment before code LOAD segment to put the program
header in the  data LOAD segment.

	PR ld/22845
	* testsuite/ld-elf/ehdr_start.d: Pass --build-id to ld.
---
 ld/testsuite/ld-elf/ehdr_start.d | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.14.3

Comments

H.J. Lu Feb. 17, 2018, 2:56 p.m. | #1
On Fri, Feb 16, 2018 at 8:49 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> ld-elf/ehdr_start fails with -z separate-code.  Since there is no data

> LOAD segment before code LOAD segment:

>

> There are 2 program headers, starting at offset 64

>

> Program Headers:

>   Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align

>   LOAD           0x200000 0x0000000000600000 0x0000000000600000 0x000010 0x000010 R E 0x200000

>   LOAD           0x400000 0x0000000000800000 0x0000000000800000 0x000008 0x000008 R   0x200000

>

>  Section to Segment mapping:

>   Segment Sections...

>    00     .text

>    01     .rodata

>

> the program header isn't included in any LOAD segment.  As the result,

> reference to __ehdr_start is resolved to zero.  Pass --build-id to ld

> to add a data LOAD segment before code LOAD segment to put the program

> header in the  data LOAD segment.

>

>         PR ld/22845

>         * testsuite/ld-elf/ehdr_start.d: Pass --build-id to ld.

> ---

>  ld/testsuite/ld-elf/ehdr_start.d | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/ld/testsuite/ld-elf/ehdr_start.d b/ld/testsuite/ld-elf/ehdr_start.d

> index d538b66d9d..14a85d03e7 100644

> --- a/ld/testsuite/ld-elf/ehdr_start.d

> +++ b/ld/testsuite/ld-elf/ehdr_start.d

> @@ -1,5 +1,5 @@

>  #source: ehdr_start.s

> -#ld: -e _start

> +#ld: -e _start --build-id

>  #nm: -n

>  #target: *-*-linux* *-*-gnu* *-*-nacl*

>  #xfail: frv-*-*

> --

> 2.14.3

>


I'd like to check it next week if there are no objections.

Thanks.

-- 
H.J.
Alan Modra Feb. 17, 2018, 10:41 p.m. | #2
On Sat, Feb 17, 2018 at 06:56:59AM -0800, H.J. Lu wrote:
> On Fri, Feb 16, 2018 at 8:49 AM, H.J. Lu <hjl.tools@gmail.com> wrote:

> > ld-elf/ehdr_start fails with -z separate-code.  Since there is no data

> > LOAD segment before code LOAD segment:

> >

> > There are 2 program headers, starting at offset 64

> >

> > Program Headers:

> >   Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align

> >   LOAD           0x200000 0x0000000000600000 0x0000000000600000 0x000010 0x000010 R E 0x200000

> >   LOAD           0x400000 0x0000000000800000 0x0000000000800000 0x000008 0x000008 R   0x200000

> >

> >  Section to Segment mapping:

> >   Segment Sections...

> >    00     .text

> >    01     .rodata

> >

> > the program header isn't included in any LOAD segment.  As the result,

> > reference to __ehdr_start is resolved to zero.  Pass --build-id to ld

> > to add a data LOAD segment before code LOAD segment to put the program

> > header in the  data LOAD segment.

> >

> >         PR ld/22845

> >         * testsuite/ld-elf/ehdr_start.d: Pass --build-id to ld.

> > ---

> >  ld/testsuite/ld-elf/ehdr_start.d | 2 +-

> >  1 file changed, 1 insertion(+), 1 deletion(-)

> >

> > diff --git a/ld/testsuite/ld-elf/ehdr_start.d b/ld/testsuite/ld-elf/ehdr_start.d

> > index d538b66d9d..14a85d03e7 100644

> > --- a/ld/testsuite/ld-elf/ehdr_start.d

> > +++ b/ld/testsuite/ld-elf/ehdr_start.d

> > @@ -1,5 +1,5 @@

> >  #source: ehdr_start.s

> > -#ld: -e _start

> > +#ld: -e _start --build-id

> >  #nm: -n

> >  #target: *-*-linux* *-*-gnu* *-*-nacl*

> >  #xfail: frv-*-*

> > --

> > 2.14.3

> >

> 

> I'd like to check it next week if there are no objections.


The change seems reasonable to me.

-- 
Alan Modra
Australia Development Lab, IBM
H.J. Lu Feb. 17, 2018, 11 p.m. | #3
On Sat, Feb 17, 2018 at 2:41 PM, Alan Modra <amodra@gmail.com> wrote:
> On Sat, Feb 17, 2018 at 06:56:59AM -0800, H.J. Lu wrote:

>> On Fri, Feb 16, 2018 at 8:49 AM, H.J. Lu <hjl.tools@gmail.com> wrote:

>> > ld-elf/ehdr_start fails with -z separate-code.  Since there is no data

>> > LOAD segment before code LOAD segment:

>> >

>> > There are 2 program headers, starting at offset 64

>> >

>> > Program Headers:

>> >   Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align

>> >   LOAD           0x200000 0x0000000000600000 0x0000000000600000 0x000010 0x000010 R E 0x200000

>> >   LOAD           0x400000 0x0000000000800000 0x0000000000800000 0x000008 0x000008 R   0x200000

>> >

>> >  Section to Segment mapping:

>> >   Segment Sections...

>> >    00     .text

>> >    01     .rodata

>> >

>> > the program header isn't included in any LOAD segment.  As the result,

>> > reference to __ehdr_start is resolved to zero.  Pass --build-id to ld

>> > to add a data LOAD segment before code LOAD segment to put the program

>> > header in the  data LOAD segment.

>> >

>> >         PR ld/22845

>> >         * testsuite/ld-elf/ehdr_start.d: Pass --build-id to ld.

>> > ---

>> >  ld/testsuite/ld-elf/ehdr_start.d | 2 +-

>> >  1 file changed, 1 insertion(+), 1 deletion(-)

>> >

>> > diff --git a/ld/testsuite/ld-elf/ehdr_start.d b/ld/testsuite/ld-elf/ehdr_start.d

>> > index d538b66d9d..14a85d03e7 100644

>> > --- a/ld/testsuite/ld-elf/ehdr_start.d

>> > +++ b/ld/testsuite/ld-elf/ehdr_start.d

>> > @@ -1,5 +1,5 @@

>> >  #source: ehdr_start.s

>> > -#ld: -e _start

>> > +#ld: -e _start --build-id

>> >  #nm: -n

>> >  #target: *-*-linux* *-*-gnu* *-*-nacl*

>> >  #xfail: frv-*-*

>> > --

>> > 2.14.3

>> >

>>

>> I'd like to check it next week if there are no objections.

>

> The change seems reasonable to me.

>


Great.  I am checking it in now.

Thanks.

-- 
H.J.

Patch

diff --git a/ld/testsuite/ld-elf/ehdr_start.d b/ld/testsuite/ld-elf/ehdr_start.d
index d538b66d9d..14a85d03e7 100644
--- a/ld/testsuite/ld-elf/ehdr_start.d
+++ b/ld/testsuite/ld-elf/ehdr_start.d
@@ -1,5 +1,5 @@ 
 #source: ehdr_start.s
-#ld: -e _start
+#ld: -e _start --build-id
 #nm: -n
 #target: *-*-linux* *-*-gnu* *-*-nacl*
 #xfail: frv-*-*