aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authormengqinggang <mengqinggang@loongson.cn>2023-06-13 16:07:12 +0800
committerliuzhensong <liuzhensong@loongson.cn>2023-06-16 17:32:02 +0800
commitd2fddb6d783320726328707d53aa74e3c48616ef (patch)
treef4bf27986a363d92aeafbf4cc586b8e0276a3157 /bfd
parent8203d5e72e3991afbb7adf8c44e6f80a59ca379d (diff)
downloadbinutils-d2fddb6d783320726328707d53aa74e3c48616ef.zip
binutils-d2fddb6d783320726328707d53aa74e3c48616ef.tar.gz
binutils-d2fddb6d783320726328707d53aa74e3c48616ef.tar.bz2
LoongArch: Fix ld "undefined reference" error with --enable-shared
Because _bfd_read_unsigned_leb128 is hidden visibility, so it can't be referenced out of shared object. The new function loongarch_get_uleb128_length just used to call _bfd_read_unsigned_leb128. bfd/ChangeLog: * elfxx-loongarch.c (loongarch_get_uleb128_length): New function. * elfxx-loongarch.h (loongarch_get_uleb128_length): New function. gas/ChangeLog: * config/tc-loongarch.c (md_apply_fix): Use loongarch_get_uleb128_length.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elfxx-loongarch.c7
-rw-r--r--bfd/elfxx-loongarch.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/bfd/elfxx-loongarch.c b/bfd/elfxx-loongarch.c
index ac644ff..cb312c4 100644
--- a/bfd/elfxx-loongarch.c
+++ b/bfd/elfxx-loongarch.c
@@ -1944,3 +1944,10 @@ loongarch_write_unsigned_leb128 (bfd_byte *p, unsigned int len, bfd_vma value)
while (len);
return p;
}
+
+int loongarch_get_uleb128_length (bfd_byte *buf)
+{
+ unsigned int len = 0;
+ _bfd_read_unsigned_leb128 (NULL, buf, &len);
+ return len;
+}
diff --git a/bfd/elfxx-loongarch.h b/bfd/elfxx-loongarch.h
index cb02af4..627c5db 100644
--- a/bfd/elfxx-loongarch.h
+++ b/bfd/elfxx-loongarch.h
@@ -44,6 +44,8 @@ bfd_elf64_loongarch_set_data_segment_info (struct bfd_link_info *, int *);
bfd_byte *
loongarch_write_unsigned_leb128 (bfd_byte *p, unsigned int len, bfd_vma value);
+int loongarch_get_uleb128_length (bfd_byte *buf);
+
/* TRUE if this is a PLT reference to a local IFUNC. */
#define PLT_LOCAL_IFUNC_P(INFO, H) \
((H)->dynindx == -1 \