[Bug 221107] -r322109 and -r322210 (so clang 5) TARGET_ARCH=powerpc agp.kld or agp.kld gets: R_PPC_PLTREL24 reloc against local symbol; could not read symbols: Bad value

2020-03-07 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221107

Mark Millard  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|New |Closed

--- Comment #9 from Mark Millard  ---
With head's switching to system clang 9 even for 32-bit powerpc,
this is not a problem. No official FreeBSD variation based on
clang is a problem. The effort to get to that point fixed things.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 221107] -r322109 and -r322210 (so clang 5) TARGET_ARCH=powerpc agp.kld or agp.kld gets: R_PPC_PLTREL24 reloc against local symbol; could not read symbols: Bad value

2017-08-10 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221107

--- Comment #8 from Mark Millard  ---
clang 5 and gcc 4.2.1 do not match for what
goes in aha*.o and agp*.o files for the
problem symbols:

gcc 4.2.1 ( R_PPC_ADDR16_HA / R_PPC_ADDR16_LO ):

# readelf -at
/usr/obj/powerpcvtsc_gcc421/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/aha/aha*.o
| grep aha_alloc
50: 0514   112 FUNCGLOBAL DEFAULT1 aha_alloc
0032 3206 R_PPC_ADDR16_HA  aha_alloc + 0
003e 3204 R_PPC_ADDR16_LO  aha_alloc + 0
052a 3206 R_PPC_ADDR16_HA  aha_alloc + 0
052e 3204 R_PPC_ADDR16_LO  aha_alloc + 0
50:  0 NOTYPE  GLOBAL DEFAULT  UND aha_alloc

# readelf -at
/usr/obj/powerpcvtsc_gcc421/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/agp/agp*.o
| grep caps
204a 3a06 R_PPC_ADDR16_HA 0434 agp_find_caps + 0
204e 3a04 R_PPC_ADDR16_LO 0434 agp_find_caps + 0
2312 3a06 R_PPC_ADDR16_HA 0434 agp_find_caps + 0
231a 3a04 R_PPC_ADDR16_LO 0434 agp_find_caps + 0
 3a01 R_PPC_ADDR320434 agp_find_caps + 0
58: 0434   192 FUNCGLOBAL DEFAULT1 agp_find_caps
02be 3906 R_PPC_ADDR16_HA  agp_find_caps + 0
02c6 3904 R_PPC_ADDR16_LO  agp_find_caps + 0
57:  0 NOTYPE  GLOBAL DEFAULT  UND agp_find_caps


clang 5 ( R_PPC_PLTREL24 ):

# readelf -at
/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/aha/aha*.o
| grep aha_alloc
44: 96 FUNCGLOBAL DEFAULT2 aha_alloc
00f0 2e12 R_PPC_PLTREL24   aha_alloc + 0
070c 2e12 R_PPC_PLTREL24   aha_alloc + 0
46:  0 NOTYPE  GLOBAL DEFAULT  UND aha_alloc

# readelf -at
/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/agp/agp*.o
| grep caps
58:    172 FUNCGLOBAL DEFAULT2 agp_find_caps
0138 3512 R_PPC_PLTREL24   agp_find_caps + 0
53:  0 NOTYPE  GLOBAL DEFAULT  UND agp_find_caps

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 221107] -r322109 and -r322210 (so clang 5) TARGET_ARCH=powerpc agp.kld or agp.kld gets: R_PPC_PLTREL24 reloc against local symbol; could not read symbols: Bad value

2017-08-10 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221107

--- Comment #7 from Mark Millard  ---
For reference for how aha.kld and agp.kld are
produced:

# Meta data file
/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/aha/aha.kld.meta
CMD ld -m elf32ppc_fbsd -d -warn-common -r -d -o aha.kld aha.o aha_isa.o
CMD ctfmerge -L VERSION -g -o aha.kld aha.o aha_isa.o
CMD :> export_syms
CMD awk -f /usr/src/sys/conf/kmod_syms.awk aha.kld  export_syms | xargs -J%
objcopy % aha.kld
CWD
/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/aha
TARGET aha.kld

# Meta data file
/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/agp/agp.kld.meta
CMD ld -m elf32ppc_fbsd -d -warn-common -r -d -o agp.kld agp.o agp_if.o
agp_apple.o
CMD ctfmerge -L VERSION -g -o agp.kld agp.o agp_if.o agp_apple.o
CMD echo agp_find_device agp_state   agp_acquire   
 agp_release agp_enable  agp_alloc_memory  
 agp_free_memory agp_bin
d_memory agp_unbind_memory   agp_memory_info > export_syms
CMD awk -f /usr/src/sys/conf/kmod_syms.awk agp.kld  export_syms | xargs -J%
objcopy % agp.kld
CWD
/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/agp
TARGET agp.kld

It looks like (via kmod_syms.awk) objcopy is
explicitly turning various R_PPC_PLTREL24
examples into LOCAL symbols.

May be before clang 5 these were not
R_PPC_PLTREL24 ?

They are now and the conversion to LOCAL while
keeping R_PPC_PLTREL24 is rejected by:

ppc_elf_check_relocs

which in turn stops ld from producing the
matching .full files. And that in turn stops
the buildkernel .

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 221107] -r322109 and -r322210 (so clang 5) TARGET_ARCH=powerpc agp.kld or agp.kld gets: R_PPC_PLTREL24 reloc against local symbol; could not read symbols: Bad value

2017-08-10 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221107

--- Comment #6 from Mark Millard  ---
Using the agp example:

Section Headers:
  [Nr] Name
   TypeAddr OffSize   ES   Lk Inf Al
   Flags
. . .
  [35] .symtab
   SYMTAB   025418 000b40 10  36 108  4
   []: 

is related to:

  r_symndx = ELF32_R_SYM (rel->r_info);
  if (r_symndx < symtab_hdr->sh_info)
h = NULL;
  else  

where for the agp example: r_symndx == 0x49
(73 decimal) for agp_find_caps. So
r_symndx < 108 (if 108 is the sh_info field
value).

Note that in agp.o :

58:    172 FUNCGLOBAL DEFAULT2 agp_find_caps

but in agp.kld :

73:    172 FUNCLOCAL  DEFAULT1 agp_find_caps



For the aha example:

  [34] .symtab
   SYMTAB   020a54 000930 10  35  70  4
   []: 

So 0x3e == 62 for aha_alloc and 62 < 70.

Note that in aha.o :

44: 96 FUNCGLOBAL DEFAULT2 aha_alloc

but in aha.kld :

62: 96 FUNCLOCAL  DEFAULT1 aha_alloc

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 221107] -r322109 and -r322210 (so clang 5) TARGET_ARCH=powerpc agp.kld or agp.kld gets: R_PPC_PLTREL24 reloc against local symbol; could not read symbols: Bad value

2017-08-10 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221107

--- Comment #5 from Mark Millard  ---
There is something consistent between the two example
failures. Even across builds of different versions
that have moved the .text offset of one of the routines
the same routines fail.

(I inserted some lines not matched by the shown grep.)

# readelf -a
/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/aha/aha.kld
| grep aha_alloc
2b8c 3e12 R_PPC_PLTREL24   aha_alloc + 0
31a8 3e12 R_PPC_PLTREL24   aha_alloc + 0
Symbol table (.symtab) contains 180 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
62: 96 FUNCLOCAL  DEFAULT1 aha_alloc

(2b8c is different than reported before: newer head version used)

# readelf -a
/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/agp/agp.kld
| grep agp_find_caps
2e08 4912 R_PPC_PLTREL24   agp_find_caps + 0
Symbol table (.symtab) contains 180 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
73:    172 FUNCLOCAL  DEFAULT1 agp_find_caps

The "Value" is zero for "FUNC LOCCAL DEFAULT" in the failing references.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 221107] -r322109 and -r322210 (so clang 5) TARGET_ARCH=powerpc agp.kld or agp.kld gets: R_PPC_PLTREL24 reloc against local symbol; could not read symbols: Bad value

2017-08-10 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221107

--- Comment #4 from Mark Millard  ---
The "reloc against local symbol" text
is omitted by code from:

/usr/src/contrib/binutils/bfd/elf32-ppc.c

in its routine:

/* Look through the relocs for a section during the first phase, and
   allocate space in the global offset table or procedure linkage
   table.  */

static bfd_boolean
ppc_elf_check_relocs (bfd *abfd,
  struct bfd_link_info *info,
  asection *sec,
  const Elf_Internal_Rela *relocs)

via:

  tls_type = 0;
  r_type = ELF32_R_TYPE (rel->r_info);
. . .  
  switch (r_type)
{
. . .
case R_PPC_PLT32:
case R_PPC_PLTREL24:
case R_PPC_PLTREL32:
case R_PPC_PLT16_LO:
case R_PPC_PLT16_HI:
case R_PPC_PLT16_HA:
#ifdef DEBUG
  fprintf (stderr, "Reloc requires a PLT entry\n");
#endif
  /* This symbol requires a procedure linkage table entry.  We
 actually build the entry in finish_dynamic_symbol,
 because this might be a case of linking PIC code without
 linking in any dynamic objects, in which case we don't
 need to generate a procedure linkage table after all.  */

  if (h == NULL)
{
  /* It does not make sense to have a procedure linkage
 table entry for a local symbol.  */
  (*_bfd_error_handler) (_("%B(%A+0x%lx): %s reloc against "
   "local symbol"),
 abfd,
 sec,
 (long) rel->r_offset,
 ppc_elf_howto_table[r_type]->name);
  bfd_set_error (bfd_error_bad_value);
  return FALSE;
}
  else
{
  bfd_vma addend = 0;

  if (r_type == R_PPC_PLTREL24)
{
  ppc_elf_tdata (abfd)->makes_plt_call = 1;
  addend = rel->r_addend;
}
  h->needs_plt = 1;
  if (!update_plt_info (abfd, h, got2, addend))
return FALSE;
}
  break;

where the earlier code for finding the h value is:

  r_symndx = ELF32_R_SYM (rel->r_info);
  if (r_symndx < symtab_hdr->sh_info)
h = NULL;
  else  
{
  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
  while (h->root.type == bfd_link_hash_indirect
 || h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 221107] -r322109 and -r322210 (so clang 5) TARGET_ARCH=powerpc agp.kld or agp.kld gets: R_PPC_PLTREL24 reloc against local symbol; could not read symbols: Bad value

2017-08-08 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221107

Mark Millard  changed:

   What|Removed |Added

Summary|-r322109 (so clang 5)   |-r322109 and -r322210 (so
   |TARGET_ARCH=powerpc agp.kld |clang 5)
   |gets: R_PPC_PLTREL24 reloc  |TARGET_ARCH=powerpc agp.kld
   |against local symbol; could |or agp.kld gets:
   |not read symbols: Bad value |R_PPC_PLTREL24 reloc
   ||against local symbol; could
   ||not read symbols: Bad value

--- Comment #3 from Mark Millard  ---
(In reply to Mark Millard from comment #2)

Building under/for -r322210 got the R_PPC_PLTREL24 report
for aha.kld instead of agp.aha :

--- aha.ko.full ---
ld: aha.kld(.text+0x2b8c): R_PPC_PLTREL24 reloc against local symbol
aha.kld: could not read symbols: Bad value
--- all_subdir_agp ---
Building
/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/agp/agp.ko.full
--- all_subdir_aha ---
*** [aha.ko.full] Error code 1

Looks like a race as two which occurs first but both
fail.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"