* [PATCH 1/2] Fix PRU LD for --enable-targets=all config option
@ 2017-01-02 16:20 Dimitar Dimitrov
2017-01-02 16:20 ` [PATCH 2/2] Fix PRU GAS for 32bit hosts Dimitar Dimitrov
2017-01-03 7:13 ` [PATCH 1/2] Fix PRU LD for --enable-targets=all config option Alan Modra
0 siblings, 2 replies; 4+ messages in thread
From: Dimitar Dimitrov @ 2017-01-02 16:20 UTC (permalink / raw)
To: binutils; +Cc: Dimitar Dimitrov
I noticed that PRU LD is broken when BFD is configured
with --enable-targets=all. This patch fixes it, and takes the
opportunity to clean the epruelf.c dependencies.
2016-12-31 Dimitar Dimitrov <dimitar@dinux.eu>
ld/
* Makefile.in: Regenerate
* Makefile.am (ALL_EMULATION_SOURCES): Add epruelf.c.
* Makefile.am (epruelf.c): Remove unneeded dependencies.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
---
ld/Makefile.am | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 524be3e097..895c86c7ed 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -391,6 +391,7 @@ ALL_EMULATION_SOURCES = \
eppcmacos.c \
eppcnw.c \
eppcpe.c \
+ epruelf.c \
eriscix.c \
escore3_elf.c \
escore7_elf.c \
@@ -1715,10 +1716,8 @@ eppcpe.c: $(srcdir)/emulparams/ppcpe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/ppcpe.sc ${GEN_DEPENDS}
epruelf.c: $(srcdir)/emulparams/pruelf.sh \
- $(srcdir)/emultempl/elf32.em \
$(ELF_DEPS) $(srcdir)/scripttempl/pru.sc \
$(srcdir)/emultempl/pruelf.em ${GEN_DEPENDS}
- ${GENSCRIPTS} pruelf "$(tdir_pruelf)"
eriscix.c: $(srcdir)/emulparams/riscix.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
--
2.11.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] Fix PRU GAS for 32bit hosts
2017-01-02 16:20 [PATCH 1/2] Fix PRU LD for --enable-targets=all config option Dimitar Dimitrov
@ 2017-01-02 16:20 ` Dimitar Dimitrov
2017-01-03 7:13 ` Alan Modra
2017-01-03 7:13 ` [PATCH 1/2] Fix PRU LD for --enable-targets=all config option Alan Modra
1 sibling, 1 reply; 4+ messages in thread
From: Dimitar Dimitrov @ 2017-01-02 16:20 UTC (permalink / raw)
To: binutils; +Cc: Dimitar Dimitrov
The PRU GAS port I originally submitted does not build on 32bit hosts.
This patch fixes it by aligning md_number_to_chars's definition with
the global declaration in tc.h.
Here is the original bug report I got:
https://github.com/rcn-ee/repos/pull/23#issuecomment-269915175
2017-01-02 Dimitar Dimitrov <dimitar@dinux.eu>
gas/
* config/tc-pru.c (md_number_to_chars): Fix parameter to be
valueT, as declared in tc.h
* config/tc-pru.c (md_apply_fix): Fix to work on 32-bit hosts.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
---
gas/config/tc-pru.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/gas/config/tc-pru.c b/gas/config/tc-pru.c
index 63aca6e442..da0131aa6c 100644
--- a/gas/config/tc-pru.c
+++ b/gas/config/tc-pru.c
@@ -175,7 +175,7 @@ md_chars_to_number (char *buf, int n)
into the series of bytes that represent the number
on the target machine. */
void
-md_number_to_chars (char *buf, uint64_t val, int n)
+md_number_to_chars (char *buf, valueT val, int n)
{
gas_assert (n == 1 || n == 2 || n == 4 || n == 8);
number_to_chars_littleendian (buf, val, n);
@@ -808,20 +808,25 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
/* Fix up the instruction. Non-contiguous bitfields need
special handling. */
- if (fixP->fx_r_type == BFD_RELOC_PRU_S10_PCREL)
- SET_BROFF_URAW (insn, fixup);
- else if (fixP->fx_r_type == BFD_RELOC_PRU_LDI32)
+ if (fixP->fx_r_type == BFD_RELOC_PRU_LDI32)
{
/* As the only 64-bit "insn", LDI32 needs special handling. */
uint32_t insn1 = insn & 0xffffffff;
uint32_t insn2 = insn >> 32;
SET_INSN_FIELD (IMM16, insn1, fixup & 0xffff);
SET_INSN_FIELD (IMM16, insn2, fixup >> 16);
- insn = insn1 | ((uint64_t)insn2 << 32);
+
+ md_number_to_chars (buf, insn1, 4);
+ md_number_to_chars (buf + 4, insn2, 4);
}
else
- insn = (insn & ~howto->dst_mask) | (fixup << howto->bitpos);
- md_number_to_chars (buf, insn, fixP->fx_size);
+ {
+ if (fixP->fx_r_type == BFD_RELOC_PRU_S10_PCREL)
+ SET_BROFF_URAW (insn, fixup);
+ else
+ insn = (insn & ~howto->dst_mask) | (fixup << howto->bitpos);
+ md_number_to_chars (buf, insn, fixP->fx_size);
+ }
}
fixP->fx_done = 1;
--
2.11.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] Fix PRU GAS for 32bit hosts
2017-01-02 16:20 ` [PATCH 2/2] Fix PRU GAS for 32bit hosts Dimitar Dimitrov
@ 2017-01-03 7:13 ` Alan Modra
0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2017-01-03 7:13 UTC (permalink / raw)
To: Dimitar Dimitrov; +Cc: binutils
On Mon, Jan 02, 2017 at 06:20:21PM +0200, Dimitar Dimitrov wrote:
> * config/tc-pru.c (md_number_to_chars): Fix parameter to be
> valueT, as declared in tc.h
> * config/tc-pru.c (md_apply_fix): Fix to work on 32-bit hosts.
Applied.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] Fix PRU LD for --enable-targets=all config option
2017-01-02 16:20 [PATCH 1/2] Fix PRU LD for --enable-targets=all config option Dimitar Dimitrov
2017-01-02 16:20 ` [PATCH 2/2] Fix PRU GAS for 32bit hosts Dimitar Dimitrov
@ 2017-01-03 7:13 ` Alan Modra
1 sibling, 0 replies; 4+ messages in thread
From: Alan Modra @ 2017-01-03 7:13 UTC (permalink / raw)
To: Dimitar Dimitrov; +Cc: binutils
On Mon, Jan 02, 2017 at 06:20:20PM +0200, Dimitar Dimitrov wrote:
> * Makefile.in: Regenerate
> * Makefile.am (ALL_EMULATION_SOURCES): Add epruelf.c.
> * Makefile.am (epruelf.c): Remove unneeded dependencies.
Applied.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-03 7:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-02 16:20 [PATCH 1/2] Fix PRU LD for --enable-targets=all config option Dimitar Dimitrov
2017-01-02 16:20 ` [PATCH 2/2] Fix PRU GAS for 32bit hosts Dimitar Dimitrov
2017-01-03 7:13 ` Alan Modra
2017-01-03 7:13 ` [PATCH 1/2] Fix PRU LD for --enable-targets=all config option Alan Modra
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).