----- Original Message -----
> From: "Jan Stancek" <jstan...@redhat.com>
> To: "Petr Holasek" <phola...@redhat.com>
> Cc: libhugetlbfs-devel@lists.sourceforge.net, "Eric B Munson" 
> <emun...@mgebm.net>
> Sent: Wednesday, 26 November, 2014 10:14:42 AM
> Subject: Re: [PATCH] put address of zero size file segment above 0x80000000
> 
> 
> 
> 
> 
> ----- Original Message -----
> > From: "Petr Holasek" <phola...@redhat.com>
> > To: libhugetlbfs-devel@lists.sourceforge.net
> > Cc: "Jan Stancek" <jstan...@redhat.com>, "Eric B Munson"
> > <emun...@mgebm.net>, phola...@redhat.com
> > Sent: Tuesday, 25 November, 2014 3:00:40 PM
> > Subject: [PATCH] put address of zero size file segment above 0x80000000
> > 
> > zero_filesize_segment tescase fails on s390x with segfault because program
> > header virtual address is set to very low value below zSeries default
> > 0x80000000 address.
> > 
> > I haven't found a way how to set custom virtual base address on s390x since
> > ld
> > option --image-base is not supported there.
> > 
> > When the address of file segment is set above 0x80000000, binary is linked
> > properly and testcase passes.
> 
> Petr,
> 
> This fixes it for me on 64bit:
> # ldd ./tests/obj64/zero_filesize_segment
>       libpthread.so.0 => /lib64/libpthread.so.0 (0x000003fffd54e000)
>       libdl.so.2 => /lib64/libdl.so.2 (0x000003fffd548000)
>       libhugetlbfs_privutils.so => /lib64/libhugetlbfs_privutils.so
>       (0x000003fffd535000)
>       libc.so.6 => /lib64/libc.so.6 (0x000003fffd394000)
>       /lib/ld64.so.1 (0x000002aab7cd5000)
> 
> but output from ldd on 32bit is not what I expected:
> # ldd ./tests/obj32/zero_filesize_segment
> not a dynamic executable
> 
> As another clue for people on list, I'm attaching alternative patch
> from bug report, which can avoid the issue by replacing absolute
> address with one relative to .text.

Scratch that, it doesn't work everywhere, e.g. RHEL6.5. The binary is fine
with the exception, that ".empty" section is not in separate segment:
 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr 
.gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .empty 

Regards,
Jan

> 
> Regards,
> Jan
> 
> 
> diff --git a/tests/Makefile b/tests/Makefile
> index e2e1156..8487cfe 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -179,11 +179,11 @@ obj64/%.ldscript: obj64/%.o obj64/testutils.o
>  
>  $(LDSCRIPT_TESTS:%=obj32/%): obj32/%: %.ld obj32/%.o obj32/testutils.o
>         @$(VECHO) LD32 "(preload test)" $@
> -       $(CC32) $(LDFLAGS) $(LDFLAGS32) -o $@ -Lobj32 $^ $(LDLIBS) || cp
> $(BADTOOLCHAIN) $@
> +       $(CC32) $(LDFLAGS) $(LDFLAGS32) -o $@ -Lobj32 $(filter-out *.ld,$^)
> -T $*.ld $(LDLIBS) || cp $(BADTOOLCHAIN) $@
>  
>  $(LDSCRIPT_TESTS:%=obj64/%): obj64/%: %.ld obj64/%.o obj64/testutils.o
>         @$(VECHO) LD64 "(preload test)" $@
> -       $(CC64) $(LDFLAGS) $(LDFLAGS64) -o $@ -Lobj64 $^ $(LDLIBS) || cp
> $(BADTOOLCHAIN) $@
> +       $(CC64) $(LDFLAGS) $(LDFLAGS64) -o $@ -Lobj64 $(filter-out *.ld,$^)
> -T $*.ld $(LDLIBS) || cp $(BADTOOLCHAIN) $@
>  
>  $(HUGELINK_TESTS:%=obj32/%): %: %.o obj32/testutils.o
>         @$(VECHO) LD32 "(hugelink test)" $@
> diff --git a/tests/zero_filesize_segment.ld b/tests/zero_filesize_segment.ld
> index 7f2fe12..21977e5 100644
> --- a/tests/zero_filesize_segment.ld
> +++ b/tests/zero_filesize_segment.ld
> @@ -1,7 +1,9 @@
>  SECTIONS
>  {
> -       .empty (0x20000000) : {
> +       . = . + 0x4000;
> +       .empty : {
>                 __empty_segment = .;
> -               . = . + 4;
> +               . = . + 0x4000;
>         }
>  }
> +INSERT AFTER .text;
> 
> 
> > 
> > Signed-off-by: Petr Holasek <phola...@redhat.com>
> > ---
> >  tests/zero_filesize_segment.ld | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tests/zero_filesize_segment.ld
> > b/tests/zero_filesize_segment.ld
> > index 7f2fe12..813a92f 100644
> > --- a/tests/zero_filesize_segment.ld
> > +++ b/tests/zero_filesize_segment.ld
> > @@ -1,6 +1,6 @@
> >  SECTIONS
> >  {
> > -   .empty (0x20000000) : {
> > +   .empty (0x90000000) : {
> >             __empty_segment = .;
> >             . = . + 4;
> >     }
> > --
> > 1.9.3
> > 
> > 
> 

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to