From: Nick Clifton <nickc@redhat.com>
To: Stephen Casner <casner@acm.org>
Cc: binutils@sourceware.org
Subject: Re: Proposed changes for pdp11 --*magic options
Date: Tue, 7 Apr 2020 11:06:57 +0100 [thread overview]
Message-ID: <92659b6c-bc7b-6c60-4865-b60b39e934b0@redhat.com> (raw)
In-Reply-To: <alpine.OSX.2.21.9999.2004060932430.44737@auge.attlocal.net>
Hi Stephen,
> You detected that my patch for PR 25677 exposed an additional
> testsuite failure beyond those that were seen previously. Is the set
> of expected failures recorded somewhere, or is that just a comparison
> that you make locally with before-and-after builds?
Sorry - it is just a local comparison.
> Shouldn't those
> tests be marked with xfail: pdp11-*-* instead? Or perhaps you've left
> them as unexpected errors as a TODO to resolve why they occur?
Exactly. I am fairly confident that most of them can be XFAILed,
but I prefer to add a comment explaining why the XFAIL is there,
and for that I need to understand the reason for the failure.
(Actually, since I am not a PDP11 expert, I am hoping that somebody
else will do this for me...)
> ERROR: /Users/casner/epos/binutils/binutils-gdb/ld/testsuite/ld-misc/start.s: assembly failed
> The assembler error is "Can not represent BFD_RELOC_32 relocation in
> this object file format". That occurs on the source line:
>
> .long foo
>
> where foo is an address label that needs to be relocated. This error
> can be easily avoided and allow the test to pass by replacing .long
> with .word or .dc.a so the relocation fits the 16-bit address for
> pdp11. Would that cause a problem for any other targets?
Using .dc.a should work for all targets, so that is what I would recommend.
> FAIL: ld-scripts/default-script1
> FAIL: ld-scripts/default-script2
> FAIL: ld-scripts/default-script3
> FAIL: ld-scripts/default-script4
>
> These can easily be fixed by changing the test symbol values from
> 0x8000000 and 0x9000000 to 0x8000 and 0x9000 so they fit as 16-bit
> symbol values. From what I see, the choice of values is arbitrary.
Agreed.
> FAIL: ld-scripts/empty-address-1
> FAIL: ld-scripts/empty-address-2a
> FAIL: ld-scripts/empty-address-2b
>
> These tests need 0x2000000 changed to 0x2000 and .long changed to
> .word as mentioned for other tests, but here there may be a real bug
> that needs to be fixed. The tests are checking whether symbols are
> defined various ways in a linker script have the correct value. In
> the pdp11 target, the symbols are undefined which suggests some
> problem with inserting symbols from a linker script into the output
> symbol table. I don't know the code well enough to have an idea where
> that problem might be.
OK, then these should be left as FAIL results for now.
> FAIL: ld-scripts/pr18963
>
> This one is more complicated. Starting with data.o consisting on only
> a header and zero-length text, data and bss the linker script creates
> sections that are each 0x10000 long with symbols corresponding to the
> section addresses just to test whether addition is commutative using
> those symbols. The output generated by that linker script is much
> larger than indicated by the a.out header (and several times larger
> than the 16-bit address space) making the format invalid, so nm gives
> an error. Unless the test could be implemented with sections created
> in the object file and just have the symbols defined in the linker
> script based on those sections, this test is not supported for
> pdp11-aout.
This sounds like a reasonable case for an xfail, with a comment along
the lines of "this test creates a binary that is too big for 16-bit architectures".
> 2) Symbol values with the 0x8000 bit set get sign-extended to 64 bits
> in the output of nm, so again they don't match the expected output.
> This sign extension is caused by the following statement in
> bfd/pdp11.c function NAME (aout, translate_symbol_table):
>
> in->symbol.value = GET_SWORD (abfd, ext->e_value);
>
> That line is as written when the PDP11 target was added in 2001.
> Since addresses are inherently unsigned, why is sign-extension
> appropriate? There may be offsets that require the result to wrap
> around, but all arithmetic on addresses should be masked to the
> number of address bits after the arithmetic operation.
I would be inclined to say that this is a bug and change the
macro to GET_WORD. There are symbols whose value are not addresses
but their signed-ness is not known to the linker, so an unsigned
fetch should be safe.
> Both of these causes could be avoided simply by reducing the numbers
> in the test so that the results are all less than 0x8000, but I belive
> the sign extension is a separate bug.
I would be happy to review a patch containing the changes you have suggested above...
Cheers
Nick
next prev parent reply other threads:[~2020-04-07 10:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 0:14 Stephen Casner
2020-04-03 10:43 ` Nick Clifton
2020-04-03 23:40 ` Stephen Casner
2020-04-04 1:02 ` Stephen Casner
2020-04-07 1:56 ` Stephen Casner
2020-04-07 10:06 ` Nick Clifton [this message]
2020-04-09 23:47 ` Paul Koning
2020-04-10 2:53 ` Stephen Casner
2020-04-14 14:41 ` Nick Clifton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=92659b6c-bc7b-6c60-4865-b60b39e934b0@redhat.com \
--to=nickc@redhat.com \
--cc=binutils@sourceware.org \
--cc=casner@acm.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).