tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [LLVM LD comparison] String offset errors on evbarm 8.99 [PR 54159]



On Wed, Aug 07, 2019 at 08:36:04PM +0200, tlaronde%polynum.com@localhost wrote:
> Forgotten script attached.
> 

I had the curiosity, since LLVM ld can work as a drop in replacement
for the system linker and since both amd64 (host) and arm >= 6 is
supported, to test with LLVM ld instead of GNU ld (the modules are still
compiled with the gnu cross-compiler)

(In the script given, it suffices to set:

for LLVM ld:

	AR_DSHARED="ld.lld -shared"
	LDFLAGS="-retain-symbols-file ./exported_lst
		-soname libbanc.so.0"

and to replace for GNU ld the arguments in line ("Wl,...") by:

	LDFLAGS="--sysroot=$DESTDIR
		-Wl,-retain-symbols-file -Wl,./exported_lst
		-Wl,-soname -Wl,libbanc.so.0"
)

LLVM ld has no problem and give the strings (one can see that GNU ld
complains about missing strings, but not all of them; with LLVM ld,
'a' and 'd' symbols are present in the .strtab):

Note: this is still GNU ld that is invoked to see if it complains; not
LLVM ld in the case this latter is used to build the shared lib.

Conclusion: on earmv7, as a fallback, the LLVM linker could be used.

---BEGIN GNU ld

========== BEGIN EXPORTED LIST
a
b
c
d
========== END EXPORTED LIST

========== BEGIN GNU LD COMPLAINTS
/data/m/tmp/olimex/tooldir.NetBSD-8.0-amd64/armv7--netbsdelf-eabihf/bin/ld: libbanc.so: invalid string offset 87 >= 11 for section `.strtab'
/data/m/tmp/olimex/tooldir.NetBSD-8.0-amd64/armv7--netbsdelf-eabihf/bin/ld: libbanc.so: invalid string offset 71 >= 11 for section `.strtab'
/data/m/tmp/olimex/tooldir.NetBSD-8.0-amd64/armv7--netbsdelf-eabihf/bin/ld: libbanc.so: invalid string offset 62 >= 11 for section `.strtab'
/data/m/tmp/olimex/tooldir.NetBSD-8.0-amd64/armv7--netbsdelf-eabihf/bin/ld: libbanc.so: invalid string offset 69 >= 11 for section `.strtab'
========== END GNU LD COMPLAINTS

========== BEGIN .strtab CONTENTS

String dump of section '.strtab':
  [     1]  $a
  [     4]  $d
  [     7]  c
  [     9]  b

========== END .strtab CONTENTS
-- END GNU ld

-- BEGIN LLVM ld

========== BEGIN EXPORTED LIST
a
b
c
d
========== END EXPORTED LIST

========== BEGIN GNU LD COMPLAINTS
========== END GNU LD COMPLAINTS

========== BEGIN .strtab CONTENTS

String dump of section '.strtab':
  [     1]  a.c
  [     5]  $a
  [     8]  $d
  [     b]  b.c
  [     f]  c.c
  [    13]  d.c
  [    17]  a
  [    19]  puts
  [    1e]  b
  [    20]  c
  [    22]  d
  [    24]  _DYNAMIC

========== END .strtab CONTENTS

-- END LLVM ld

-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                       http://www.sbfa.fr/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index