Re: RISC-V problem with weak function references and -mcmodel=medany

2018-05-29 Thread Jim Wilson
On Tue, May 29, 2018 at 11:43 AM, Sebastian Huber wrote: > would you mind trying this with -Ttext=0x9000? This gives me for the weak call 9014: 7097 auipc ra,0x7 9018: fec080e7 jalr -20(ra) # 0 <__global_pointer$+0x6fffe7d4> > Please have a look at: >

Re: RISC-V problem with weak function references and -mcmodel=medany

2018-05-29 Thread Sebastian Huber
Hello Jim, - Am 29. Mai 2018 um 20:27 schrieb Jim Wilson j...@sifive.com: > On 05/28/2018 06:32 AM, Sebastian Huber wrote: >> I guess, that the resolution of the weak reference to the undefined >> symbol __deregister_frame_info somehow sets __deregister_frame_info to >> the absolute address

Re: RISC-V problem with weak function references and -mcmodel=medany

2018-05-29 Thread Jim Wilson
On 05/29/2018 04:19 AM, Sebastian Huber wrote: Changing the code to something like this void f(void) __attribute__((__weak__)); void _start(void) {     void (*g)(void) = f;     if (g != 0) {     (*g)();     } } This testcase works for me also, using

Re: RISC-V problem with weak function references and -mcmodel=medany

2018-05-29 Thread Jim Wilson
On 05/28/2018 06:32 AM, Sebastian Huber wrote: I guess, that the resolution of the weak reference to the undefined symbol __deregister_frame_info somehow sets __deregister_frame_info to the absolute address 0 which is illegal in the following "call __deregister_frame_info"? Is this construct

Re: RISC-V problem with weak function references and -mcmodel=medany

2018-05-29 Thread Sebastian Huber
Changing the code to something like this void f(void) __attribute__((__weak__)); void _start(void) {     void (*g)(void) = f;     if (g != 0) {     (*g)();     } } doesn't work either, since this is optimized to     .option nopic     .text     .align  1    

RISC-V problem with weak function references and -mcmodel=medany

2018-05-28 Thread Sebastian Huber
Hello, I try to build a 64-bit RISC-V tool chain for RTEMS. RTEMS doesn't use virtual memory. The reference chips for 64-bit RISC-V such as FU540-C000 locate the RAM at 0x8000_. This forces me to use -mcmodel=medany in 64-bit mode. The ctrbegin.o contains this code (via crtstuff.c):