sdowning@fame.com (Stuart F. Downing) writes: > invocation: > objcopy --keep-global-symbols=list_of_globals foo.o > > I debugged this in gdb and see that the problem is the foo.o contains a > R_SHORT_PCREL_MODE relocation. som.c has code that is conditionally > included ... > #ifndef NO_PCREL_MODES > > which is defined in som.c ... > > #ifndef R_SHORT_PCREL_MODE > > which is defined in /usr/include/reloc.h ... > > #ifdef PA_2_0 > > I don't think that PA_2_0 was defined when som.c was compiled (it's > not in config.h)... > > > /bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I/opt/src/binutils-2.1 > 3.1/bfd -I. -D_GNU_SOURCE -DHOST_HPPAHPUX -DHPUX_CORE -I. -I/opt/src/binutils- > 2.13.1/bfd -I/opt/src/binutils-2.13.1/bfd/../include -I/opt/src/binutils-2.13.1 > /bfd/../intl -I../intl -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O > 2 -c /opt/src/binutils-2.13.1/bfd/som.c > gcc -DHAVE_CONFIG_H -I. -I/opt/src/binutils-2.13.1/bfd -I. -D_GNU_SOURCE -DHOST_ > HPPAHPUX -DHPUX_CORE -I. -I/opt/src/binutils-2.13.1/bfd -I/opt/src/binutils-2.13 > .1/bfd/../include -I/opt/src/binutils-2.13.1/bfd/../intl -I../intl -W -Wall -Wst > rict-prototypes -Wmissing-prototypes -g -O2 -c /opt/src/binutils-2.13.1/bfd/som. > c -o som.o > /opt/src/binutils-2.13.1/bfd/som.c: In function `hppa_som_gen_reloc_type': > /opt/src/binutils-2.13.1/bfd/som.c:1567: warning: enumeration value `e_ltpsel' n > ot handled in switch > /opt/src/binutils-2.13.1/bfd/som.c:1567: warning: enumeration value `e_rtpsel' n > ot handled in switch > /opt/src/binutils-2.13.1/bfd/som.c: In function `som_object_setup': > /opt/src/binutils-2.13.1/bfd/som.c:1801: warning: comparison between signed and > unsigned > /opt/src/binutils-2.13.1/bfd/som.c:1801: warning: comparison between signed and > unsigned > /opt/src/binutils-2.13.1/bfd/som.c: In function `setup_sections': > /opt/src/binutils-2.13.1/bfd/som.c:1946: warning: comparison between signed and > unsigned > /opt/src/binutils-2.13.1/bfd/som.c: In function `bfd_section_from_som_symbol': > /opt/src/binutils-2.13.1/bfd/som.c:4279: warning: comparison between signed and > unsigned > > > The file trunction error occurs here... > > switch (bfd_reloc->howto->type) > { > ... > #ifndef NO_PCREL_MODES > case R_SHORT_PCREL_MODE: > case R_LONG_PCREL_MODE: > #endif > reloc_offset = bfd_reloc->address; > break; > > default: > reloc_offset = bfd_reloc->address + 4; > break; > } > > because NO_PCREL_MODES is defined, so the default path is taken, then > in the next loop iteration, when it calculates skip > > skip = bfd_reloc->address - reloc_offset; > > This is an unsigned computation where bfd_reloc->address < > reloc_offset which results in a very large number. > > > I think the solution is for PA_2_0 to be defined when som.c is > compiled, but I'm not sure what is the "right" way to accomplish this. > > Should configure detect this situation and define PA_2_0 in config.h? > > -- > Stuart Downing I solved this with the attached patch. Not sure if configure.host is the right place for this, but it worked for me... -- Stuart Downing