[PATCH 1/4] libibery/hashtab: add new functions

Alan Modra amodra@gmail.com
Mon Aug 17 14:37:20 GMT 2020


On Mon, Aug 17, 2020 at 04:21:38PM +0200, Martin Liška wrote:
> On 8/17/20 4:19 PM, Alan Modra wrote:
> > On Mon, Aug 17, 2020 at 04:01:44PM +0200, Martin Liška wrote:
> > > On 8/17/20 3:55 PM, Alan Modra wrote:
> > > > On Sat, Aug 15, 2020 at 07:46:33PM +0200, Martin Liska wrote:
> > > > > 
> > > > > include/ChangeLog:
> > > > > 
> > > > > 	* hashtab.h (htab_insert): New function.
> > > > > 	(htab_print_statistics): Likewise.
> > > > > 
> > > > > libiberty/ChangeLog:
> > > > > 
> > > > > 	* hashtab.c (htab_insert): New function.
> > > > > 	(htab_print_statistics): Likewise.
> > > > 
> > > > This one needs approval from the owning project, gcc.
> > > 
> > > I know, I'm going to send it to the owning project.
> > > 
> > > > The other
> > > > patches in the series looked reasonable enough to me, so I applied
> > > > them locally and ran a regression test.  First off, there's a compile
> > > > error:
> > > > gas/macro.c: In function ‘expand_irp’:
> > > > gas/macro.c:1402:10: error: ‘err’ may be used uninitialised in this function
> > > 
> > > Hmmm, I can't see it:
> > > 
> > > gcc -DHAVE_CONFIG_H -I. -I../../gas  -I. -I../../gas -I../bfd -I../../gas/config -I../../gas/../include -I../../gas/.. -I../../gas/../bfd -DLOCALEDIR="\"/home/marxin/bin/binutils/share/locale\""  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I../../gas/../zlib -g -O2 -MT macro.o -MD -MP -MF $depbase.Tpo -c -o macro.o ../../gas/macro.c &&\
> > > mv -f $depbase.Tpo $depbase.Po
> > > /bin/sh ./libtool  --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I../../gas/../zlib -g -O2   -o as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o symbols.o write.o config/tc-i386.o config/obj-elf.o config/atof-ieee.o  ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a   -ldl
> > > libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I../../gas/../zlib -g -O2 -o as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o symbols.o write.o config/tc-i386.o config/obj-elf.o config/atof-ieee.o  ../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a -L/home/marxin/Programming/binutils/objdir/zlib -lz ../libiberty/libiberty.a -ldl
> > > 
> > > > 
> > > > Fixing that then showed
> > > 
> > > Have you fixed it with setting err = NULL?
> > 
> > Yes.
> > 
> > diff --git a/gas/macro.c b/gas/macro.c
> > index 4a042d0fbe..817af11141 100644
> > --- a/gas/macro.c
> > +++ b/gas/macro.c
> > @@ -1358,6 +1358,7 @@ expand_irp (int irpc, size_t idx, sb *in, sb *out, size_t (*get_line) (sb *))
> >   	  ++idx;
> >   	}
> > +      err = NULL;
> >         while (idx < in->len)
> >   	{
> >   	  if (!irpc)
> > 
> > > 
> > > > m68hc11-elf  +FAIL: Motorola Assembly Language Input Standard
> > > > m68hc11-elf  +FAIL: 68HC12 specific addressing modes (opers12)
> > > > m68hc11-elf  +FAIL: Dwarf2 test on opers12.s
> > > > m68hc11-elf  +FAIL: 68HC12 branchs
> > > > m68hc11-elf  +FAIL: MRI label
> > > > m68hc11-elf  +FAIL: MRI EQU
> > > > m68hc11-elf  +FAIL: MRI floating point constants
> > > > m68hc11-elf  +FAIL: MRI character constants
> > > > m68hc11-elf  +FAIL: MRI expressions
> > > > m68hc11-elf  +FAIL: MRI common sections
> > > > m68hc11-elf  +FAIL: MRI comments
> > > > m68hc11-elf  +FAIL: MRI empty macro
> > > > m68hc11-elf  +FAIL: MRI semi
> > > > m68hc11-elf  +FAIL: ld-m68hc11/xgate1
> > > > m68hc12-elf  +FAIL: Motorola Assembly Language Input Standard
> > > > m68hc12-elf  +FAIL: 68HC12 specific addressing modes (opers12)
> > > > m68hc12-elf  +FAIL: Dwarf2 test on opers12.s
> > > > m68hc12-elf  +FAIL: 68HC12 branchs
> > > > m68hc12-elf  +FAIL: MRI label
> > > > m68hc12-elf  +FAIL: MRI EQU
> > > > m68hc12-elf  +FAIL: MRI floating point constants
> > > > m68hc12-elf  +FAIL: MRI character constants
> > > > m68hc12-elf  +FAIL: MRI expressions
> > > > m68hc12-elf  +FAIL: MRI common sections
> > > > m68hc12-elf  +FAIL: MRI comments
> > > > m68hc12-elf  +FAIL: MRI empty macro
> > > > m68hc12-elf  +FAIL: MRI semi
> > > > m68hc12-elf  +FAIL: ld-m68hc11/xgate1
> > > > m68k-elf  +FAIL: MRI floating point constants
> > > > m68k-elf  +FAIL: MRI character constants
> > > > m68k-elf  +FAIL: MRI common sections
> > > > m68k-elf  +FAIL: MRI comments
> > > > m68k-elf  +FAIL: MRI empty macro
> > > > m68k-elf  +FAIL: MRI semi
> > > > m68k-elf  +FAIL: MRI constants
> > > > m68k-elf  +FAIL: MRI immediate constants
> > > > m68k-elf  +FAIL: MRI structured for
> > > > m68k-elf  +FAIL: MRI structured if
> > > > m68k-elf  +FAIL: MRI structured repeat
> > > > m68k-elf  +FAIL: MRI structured while
> > > > m68k-elf  +FAIL: MRI moveml
> > > > m68k-linux  +FAIL: MRI floating point constants
> > > > m68k-linux  +FAIL: MRI character constants
> > > > m68k-linux  +FAIL: MRI common sections
> > > > m68k-linux  +FAIL: MRI comments
> > > > m68k-linux  +FAIL: MRI empty macro
> > > > m68k-linux  +FAIL: MRI semi
> > > > m68k-linux  +FAIL: MRI constants
> > > > m68k-linux  +FAIL: MRI immediate constants
> > > > m68k-linux  +FAIL: MRI structured for
> > > > m68k-linux  +FAIL: MRI structured if
> > > > m68k-linux  +FAIL: MRI structured repeat
> > > > m68k-linux  +FAIL: MRI structured while
> > > > m68k-linux  +FAIL: MRI moveml
> > > > s12z-elf  +FAIL: Test of disassembler behaviour with invalid bit manipulation instructions
> > > > s12z-elf  +FAIL: Handle truncated instruction gracefully.
> > > > s12z-elf  +FAIL: Expressions in OPR direct submode
> > > > spu-elf  +FAIL: .eqv support
> > > > spu-elf  +FAIL: forward references
> > > > spu-elf  +FAIL: .equ redefinitions
> > > > spu-elf  +FAIL: .equ redefinitions (2)
> > > > spu-elf  +FAIL: .equ redefinitions (3)
> > > > spu-elf  +FAIL: .equ redefinitions (ELF)
> > > > spu-elf  +FAIL: elf equate relocs
> > > > spu-elf  +FAIL: .set with expression
> > > > spu-elf  +FAIL: .set with IFUNC
> > > > spu-elf  +FAIL: Multibyte symbol names
> > > > spu-elf  +FAIL: gas/elf/common5a
> > > > spu-elf  +FAIL: gas/elf/common5b
> > > > spu-elf  +FAIL: gas/elf/common5c
> > > > spu-elf  +FAIL: gas/elf/common5d
> > > > spu-elf  +FAIL: ld-elf/pr17550a
> > > > spu-elf  +FAIL: ld-elf/pr17550b
> > > > spu-elf  +FAIL: ld-elf/pr17550c
> > > > spu-elf  +FAIL: ld-elf/pr17550d
> > > > z80-coff  +FAIL: index instructions with label as offset
> > > > z80-coff  +FAIL: data definition
> > > > z80-coff  +FAIL: eZ80 use unsupported registers as labels
> > > > z80-coff  +FAIL: quotes
> > > > z80-coff  +FAIL: SDCC compatibility mode
> > > > z80-coff  +FAIL: .set redefinitions
> > > > z80-coff  +FAIL: strings test
> > > > z80-elf  +FAIL: .equ redefinitions (ELF)
> > > > z80-elf  +FAIL: elf equate relocs
> > > > z80-elf  +FAIL: .set with expression
> > > > z80-elf  +FAIL: .set with IFUNC
> > > > z80-elf  +FAIL: Multibyte symbol names
> > > > z80-elf  +FAIL: gas/elf/common5a
> > > > z80-elf  +FAIL: gas/elf/common5b
> > > > z80-elf  +FAIL: gas/elf/common5c
> > > > z80-elf  +FAIL: gas/elf/common5d
> > > > z80-elf  +FAIL: index instructions with label as offset
> > > > z80-elf  +FAIL: data definition
> > > > z80-elf  +FAIL: eZ80 use unsupported registers as labels
> > > > z80-elf  +FAIL: quotes
> > > > z80-elf  +FAIL: SDCC compatibility mode
> > > > z80-elf  +FAIL: .set redefinitions
> > > > z80-elf  +FAIL: strings test
> > > > z80-elf  +FAIL: ld-elf/pr17550a
> > > > z80-elf  +FAIL: ld-elf/pr17550b
> > > > z80-elf  +FAIL: ld-elf/pr17550c
> > > > z80-elf  +FAIL: ld-elf/pr17550d
> > > > 
> > > 
> > > How do you run tests please? Do you build cross binutils?
> > 
> > Yes, I build whole lot of targets
> > 
> > ~/src/binutils-gdb/configure --build=x86_64-linux \
> > --disable-nls \
> > --disable-gdb --disable-gdbserver --disable-sim --disable-readline \
> > --disable-libdecnumber --enable-obsolete --target=$target
> 
> I see. What's value of $target please?

For this particular problem, any one of the targets I showed above,
spu-elf for instance.  Full target list attached.

Bug is here, BTW:

@@ -1069,8 +1116,7 @@ read_a_source_file (const char *name)
 		    {
 		      /* The MRI assembler uses pseudo-ops without
 			 a period.  */
-		      pop = (pseudo_typeS *) hash_find (po_hash, s);
-		      if (pop != NULL && pop->poc_handler == NULL)
+		      if (po_entry_find (po_hash, s) == NULL)
 			pop = NULL;
 		    }

That needs to be 
		      pop = po_entry_find (po_hash, s);
		      if (pop != NULL && pop->poc_handler == NULL)
			pop = NULL;
(and make pop const so you can lose the casts).

> 
> Thanks,
> Martin
> 
> > make
> > make -k check
> > 
> > 

-- 
Alan Modra
Australia Development Lab, IBM
-------------- next part --------------
aarch64-elf
aarch64-linux
aarch64_be-linux-gnu_ilp32
alpha-dec-vms
alpha-linux
alpha-linuxecoff
alpha-netbsd
alpha-unknown-freebsd4.7
am33_2.0-linux
arc-elf
arc-linux-uclibc
arm-elf
arm-linuxeabi
arm-nacl
arm-netbsdelf
arm-nto
arm-pe
arm-symbianelf
arm-vxworks
arm-wince-pe
armeb-linuxeabi
avr-elf
bfin-elf
bfin-linux-uclibc
bpf-none
cr16-elf
cris-elf
cris-linux
crisv32-linux
crx-elf
csky-elf
csky-linux
d10v-elf
d30v-elf
dlx-elf
epiphany-elf
fr30-elf
frv-elf
frv-linux
ft32-elf
h8300-elf
h8300-linux
hppa-hp-hpux10
hppa-linux
hppa64-hp-hpux11.23
hppa64-linux
i386-bsd
i386-darwin
i386-lynxos
i386-msdos
i586-linux
i686-nto
i686-pc-beos
i686-pc-elf
i686-pe
i686-vxworks
ia64-elf
ia64-freebsd5
ia64-hpux
ia64-linux
ia64-netbsd
ia64-vms
ip2k-elf
iq2000-elf
lm32-elf
lm32-linux
m32c-elf
m32r-elf
m32r-linux
m68hc11-elf
m68hc12-elf
m68k-elf
m68k-linux
mcore-elf
mcore-pe
mep-elf
metag-linux
microblaze-elf
microblaze-linux
mips-linux
mips-sgi-irix6
mips-vxworks
mips64-linux
mips64-openbsd
mips64el-openbsd
mipsel-linux-gnu
mipsisa32el-linux
mipstx39-elf
mmix
mn10200-elf
mn10300-elf
moxie-elf
msp430-elf
mt-elf
nds32be-elf
nds32le-linux
nios2-linux
ns32k-netbsd
ns32k-pc532-mach
or1k-elf
or1k-linux
pdp11-dec-aout
pj-elf
powerpc-aix5.1
powerpc-aix5.2
powerpc-eabisim
powerpc-eabivle
powerpc-freebsd
powerpc-linux
powerpc-nto
powerpc-wrs-vxworks
powerpc64-freebsd
powerpc64-linux
powerpc64le-linux
powerpcle-elf
pru-elf
riscv32-elf
riscv64-linux
rl78-elf
rs6000-aix4.3.3
rs6000-aix5.1
rs6000-aix5.2
rx-elf
s12z-elf
s390-linux
s390x-linux
score-elf
sh-linux
sh-nto
sh-pe
sh-rtems
sh-vxworks
shle-unknown-netbsdelf
sparc-elf
sparc-linux
sparc-sun-solaris2
sparc-vxworks
sparc64-linux
spu-elf
tic30-unknown-coff
tic4x-coff
tic54x-coff
tic6x-elf
tilegx-linux
tilepro-linux
v850-elf
vax-netbsdelf
visium-elf
wasm32
x86_64-cloudabi
x86_64-linux
x86_64-pc-linux-gnux32
x86_64-rdos
x86_64-w64-mingw32
xgate-elf
xstormy16-elf
xtensa-elf
z80-coff
z80-elf
z8k-coff


More information about the Binutils mailing list