Re: [PATCH] RISC-V: Allow constraint "S" even if the symbol does not bind locally

2024-01-31 Thread Fangrui Song
On Tue, Jan 30, 2024 at 11:26 PM Kito Cheng wrote: > > I realized there is 's' constraint which is defined in GCC generic > infra[1], and that's kinda what same as the new semantic of 'S' here, > > (define_constraint "s" > "Matches a symbolic integer constant." > (and (match_test "CONSTANT_P (op

Re: [PATCH] RISC-V: Allow constraint "S" even if the symbol does not bind locally

2024-01-30 Thread Kito Cheng
I realized there is 's' constraint which is defined in GCC generic infra[1], and that's kinda what same as the new semantic of 'S' here, (define_constraint "s" "Matches a symbolic integer constant." (and (match_test "CONSTANT_P (op)") (match_test "!CONST_SCALAR_INT_P (op)") (match_te

[PATCH] RISC-V: Allow constraint "S" even if the symbol does not bind locally

2024-01-30 Thread Fangrui Song
The constraint "S" can only be used with a symbol that binds locally, so the following does not work for -fpie/-fpic (GOT access is used). ``` namespace ns { extern int var, a[4]; } void foo() { asm(".pushsection .xxx,\"aw\"; .dc.a %0; .popsection" :: "S"(&ns::var)); asm(".reloc ., BFD_RELOC_NO