gcc/libgcc/config/riscv
Nelson Chu 45116f3420 RISC-V: jal cannot refer to a default visibility symbol for shared object.
This is the original binutils bugzilla report,
https://sourceware.org/bugzilla/show_bug.cgi?id=28509

And this is the first version of the proposed binutils patch,
https://sourceware.org/pipermail/binutils/2021-November/118398.html

After applying the binutils patch, I get the the unexpected error when
building libgcc,

/scratch/nelsonc/riscv-gnu-toolchain/riscv-gcc/libgcc/config/riscv/div.S:42:
/scratch/nelsonc/build-upstream/rv64gc-linux/build-install/riscv64-unknown-linux-gnu/bin/ld: relocation R_RISCV_JAL against `__udivdi3' which may bind externally can not be used when making a shared object; recompile with -fPIC

Therefore, this patch add an extra hidden alias symbol for __udivdi3, and
then use HIDDEN_JUMPTARGET to target a non-preemptible symbol instead.
The solution is similar to glibc as follows,
https://sourceware.org/git/?p=glibc.git;a=commit;h=68389203832ab39dd0dbaabbc4059e7fff51c29b

libgcc/ChangeLog:

	* config/riscv/div.S: Add the hidden alias symbol for __udivdi3, and
	then use HIDDEN_JUMPTARGET to target it since it is non-preemptible.
	* config/riscv/riscv-asm.h: Added new macros HIDDEN_JUMPTARGET and
	HIDDEN_DEF.
2021-12-06 10:55:01 +08:00
..
atomic.c Update copyright years. 2021-01-04 10:26:59 +01:00
crti.S
crtn.S
div.S RISC-V: jal cannot refer to a default visibility symbol for shared object. 2021-12-06 10:55:01 +08:00
linux-unwind.h Update copyright years. 2021-01-04 10:26:59 +01:00
muldi3.S Update copyright years. 2021-01-04 10:26:59 +01:00
multi3.c Update copyright years. 2021-01-04 10:26:59 +01:00
riscv-asm.h RISC-V: jal cannot refer to a default visibility symbol for shared object. 2021-12-06 10:55:01 +08:00
save-restore.S Update copyright years. 2021-01-04 10:26:59 +01:00
sfp-machine.h RISC-V: Update soft-fp config for big-endian 2021-03-23 17:31:13 +08:00
t-elf RISC-V/libgcc: Use `-fasynchronous-unwind-tables' for LIB2_DIVMOD_FUNCS 2020-09-29 01:20:01 +01:00
t-elf32
t-elf64
t-softfp32 RISC-V: Build soft-float divide routines for -mno-fdiv. 2019-11-01 13:35:12 -07:00
t-softfp64