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: > https

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 0

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 -mcmodel=medan

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 wi

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