This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: 3 gold testcases...
- From: Ian Lance Taylor <iant at google dot com>
- To: David Miller <davem at davemloft dot net>
- Cc: binutils at sourceware dot org
- Date: Tue, 08 Apr 2008 16:03:54 -0700
- Subject: Re: 3 gold testcases...
- References: <20080408.154121.35448674.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
> I've analyzed each one, and they really aren't sparc target
> bugs per-se, but rather testcases that need some tweaks of
> some sort:
Cool.
Yes, the linker script tests are definitely touchy.
> 1) justsyms puts a string at 0x10000 hoping that will be
> out of the way and not in some mapped region of the
> executable image so that it will generate a segfault.
>
> This happens to be where the .text gets mapped so the
> segfault doesn't happen and the testcase fails.
Ouch, bad luck. Really, though, the address can be anywhere. What if
we change it to 0x100?
> 2) script_test_2 fails because of the assertion:
>
> assert(reinterpret_cast<uintptr_t>(start_test_area_1 + 48 + 7 + 4)
> == reinterpret_cast<uintptr_t>(start_data));
>
> It assumes that the string will only consume 7 bytes, but on
> Sparc strings are emitted by the compiler with an ".align 8"
> directive, and thus the size consumed by the string is rounded
> up to 8 bytes.
Would it work if we make both strings 8 characters long and adjust
accordingly?
> 3) script_test_3 fails because the PT_LOAD segments created overlap
> within a page, and the kernel thus refuses to load the binary.
I'm not sure I understand this one. It's normally OK for PT_LOAD
segments to overlap within a page in the file. The segments here do
not overlap in virtual address space, unless your pages are very
large.
>
> Actually, if I run the program as:
>
> bash$ /lib/ld-linux.so.2 ./script_test_3
>
> it works, so I suppose the PT_LOAD mapping rules of the dynamic
> linker are more relaxed than that of the kernel.
>
> Section Headers:
> [Nr] Name Type Addr Off Size ES Flg Lk Inf Al
> [ 0] NULL 00000000 000000 000000 00 0 0 0
> [ 1] .interp PROGBITS 10000000 010000 000013 00 A 0 0 1
> ...
> [14] .text PROGBITS 100004e0 0104e0 000b48 00 AX 0 0 32
> [15] .text PROGBITS 10001028 011028 0002a8 00 AX 0 0 4
>
> Program Headers:
> Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
> INTERP 0x010000 0x10000000 0x10000000 0x004c8 0x004c8 R 0x8
> [Requesting program interpreter: /lib/ld-linux.so.2]
> LOAD 0x000000 0x0fff0000 0x0fff0000 0x11398 0x11398 R E 0x2000
> LOAD 0x011400 0x10101400 0x10101400 0x001e0 0x001e0 RWE 0x2000
> LOAD 0x011600 0x10201600 0x10201600 0x00000 0x00088 RW 0x2000
> DYNAMIC 0x011400 0x10101400 0x10101400 0x000d0 0x000d0 R 0x4