LoongArch: Define HAVE_AS_TLS to 0 if it's undefined

Message ID 20231030114329.64025-1-xry111@xry111.site
State Unresolved
Headers
Series LoongArch: Define HAVE_AS_TLS to 0 if it's undefined |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Xi Ruoyao Oct. 30, 2023, 11:42 a.m. UTC
  Now loongarch.md uses HAVE_AS_TLS, we need this to fix the failure
building a cross compiler if the cross assembler is not installed yet.

gcc/ChangeLog:

	* config/loongarch/loongarch-opts.h (HAVE_AS_TLS): Define to 0
	if not defined yet.
---

Ok for trunk?

 gcc/config/loongarch/loongarch-opts.h | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

chenglulu Oct. 30, 2023, 11:50 a.m. UTC | #1
在 2023/10/30 下午7:42, Xi Ruoyao 写道:
> Now loongarch.md uses HAVE_AS_TLS, we need this to fix the failure
> building a cross compiler if the cross assembler is not installed yet.
>
> gcc/ChangeLog:
>
> 	* config/loongarch/loongarch-opts.h (HAVE_AS_TLS): Define to 0
> 	if not defined yet.
> ---
>
> Ok for trunk?
I have no problem with this submission, but I don't understand the 
circumstances surrounding the error.
>
>   gcc/config/loongarch/loongarch-opts.h | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/gcc/config/loongarch/loongarch-opts.h b/gcc/config/loongarch/loongarch-opts.h
> index 2756939b05d..f204828015e 100644
> --- a/gcc/config/loongarch/loongarch-opts.h
> +++ b/gcc/config/loongarch/loongarch-opts.h
> @@ -101,4 +101,8 @@ loongarch_update_gcc_opt_status (struct loongarch_target *target,
>   #define HAVE_AS_MRELAX_OPTION 0
>   #endif
>   
> +#ifndef HAVE_AS_TLS
> +#define HAVE_AS_TLS 0
> +#endif
> +
>   #endif /* LOONGARCH_OPTS_H */
  
Xi Ruoyao Oct. 30, 2023, 12:26 p.m. UTC | #2
On Mon, 2023-10-30 at 19:50 +0800, chenglulu wrote:
> 在 2023/10/30 下午7:42, Xi Ruoyao 写道:
> > Now loongarch.md uses HAVE_AS_TLS, we need this to fix the failure
> > building a cross compiler if the cross assembler is not installed yet.
> > 
> > gcc/ChangeLog:
> > 
> >  	* config/loongarch/loongarch-opts.h (HAVE_AS_TLS): Define to 0
> >  	if not defined yet.
> > ---
> > 
> > Ok for trunk?
> I have no problem with this submission, but I don't understand the 
> circumstances surrounding the error.

When the developers hack GCC they sometimes build a cross compiler with
no cross assembler, then HAVE_AS_TLS will just be undefined.  And in the
future we may have an assmebler w/o TLS support (for example a tiny
assembler for bare-metal target), then HAVE_AS_TLS will be undefined
too.

The error message is:

g++ -c   -g -O2   -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -I. -Ibuild -I../../gcc/gcc -I../../gcc/gcc/build -I../../gcc/gcc/../include  -I../../gcc/gcc/../libcpp/include  \
	-o build/gencondmd.o build/gencondmd.cc
../../gcc/gcc/config/loongarch/loongarch.md:3655:2: error: 'HAVE_AS_TLS' was not declared in this scope
 3655 |   "HAVE_AS_TLS"
      |  ^~~~~~~~~~~
../../gcc/gcc/config/loongarch/loongarch.md:3655:2: error: 'HAVE_AS_TLS' was not declared in this scope
 3655 |   "HAVE_AS_TLS"
      |  ^~~~~~~~~~~
../../gcc/gcc/config/loongarch/loongarch.md:3655:2: error: 'HAVE_AS_TLS' was not declared in this scope
 3655 |   "HAVE_AS_TLS"
      |  ^~~~~~~~~~~
../../gcc/gcc/config/loongarch/loongarch.md:3655:2: error: 'HAVE_AS_TLS' was not declared in this scope
 3655 |   "HAVE_AS_TLS"
      |  ^~~~~~~~~~~
make[1]: *** [Makefile:2962: build/gencondmd.o] Error 1
  
chenglulu Oct. 30, 2023, 12:44 p.m. UTC | #3
在 2023/10/30 下午8:26, Xi Ruoyao 写道:
> On Mon, 2023-10-30 at 19:50 +0800, chenglulu wrote:
>> 在 2023/10/30 下午7:42, Xi Ruoyao 写道:
>>> Now loongarch.md uses HAVE_AS_TLS, we need this to fix the failure
>>> building a cross compiler if the cross assembler is not installed yet.
>>>
>>> gcc/ChangeLog:
>>>
>>>   	* config/loongarch/loongarch-opts.h (HAVE_AS_TLS): Define to 0
>>>   	if not defined yet.
>>> ---
>>>
>>> Ok for trunk?
>> I have no problem with this submission, but I don't understand the
>> circumstances surrounding the error.
> When the developers hack GCC they sometimes build a cross compiler with
> no cross assembler, then HAVE_AS_TLS will just be undefined.  And in the
> future we may have an assmebler w/o TLS support (for example a tiny
> assembler for bare-metal target), then HAVE_AS_TLS will be undefined
> too.

Ok!

Thanks!

>
> The error message is:
>
> g++ -c   -g -O2   -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -I. -Ibuild -I../../gcc/gcc -I../../gcc/gcc/build -I../../gcc/gcc/../include  -I../../gcc/gcc/../libcpp/include  \
> 	-o build/gencondmd.o build/gencondmd.cc
> ../../gcc/gcc/config/loongarch/loongarch.md:3655:2: error: 'HAVE_AS_TLS' was not declared in this scope
>   3655 |   "HAVE_AS_TLS"
>        |  ^~~~~~~~~~~
> ../../gcc/gcc/config/loongarch/loongarch.md:3655:2: error: 'HAVE_AS_TLS' was not declared in this scope
>   3655 |   "HAVE_AS_TLS"
>        |  ^~~~~~~~~~~
> ../../gcc/gcc/config/loongarch/loongarch.md:3655:2: error: 'HAVE_AS_TLS' was not declared in this scope
>   3655 |   "HAVE_AS_TLS"
>        |  ^~~~~~~~~~~
> ../../gcc/gcc/config/loongarch/loongarch.md:3655:2: error: 'HAVE_AS_TLS' was not declared in this scope
>   3655 |   "HAVE_AS_TLS"
>        |  ^~~~~~~~~~~
> make[1]: *** [Makefile:2962: build/gencondmd.o] Error 1
>
  
Xi Ruoyao Oct. 31, 2023, 6:48 a.m. UTC | #4
Pushed r14-5030.  The subject and ChangeLog are updated to include the
PR number.  The code change is same as v1.

On Mon, 2023-10-30 at 20:44 +0800, chenglulu wrote:
> 
> 在 2023/10/30 下午8:26, Xi Ruoyao 写道:
> > On Mon, 2023-10-30 at 19:50 +0800, chenglulu wrote:
> > > 在 2023/10/30 下午7:42, Xi Ruoyao 写道:
> > > > Now loongarch.md uses HAVE_AS_TLS, we need this to fix the failure
> > > > building a cross compiler if the cross assembler is not installed yet.
> > > > 
> > > > gcc/ChangeLog:
> > > > 
> > > >   	* config/loongarch/loongarch-opts.h (HAVE_AS_TLS): Define to 0
> > > >   	if not defined yet.
> > > > ---
> > > > 
> > > > Ok for trunk?
> > > I have no problem with this submission, but I don't understand the
> > > circumstances surrounding the error.
> > When the developers hack GCC they sometimes build a cross compiler with
> > no cross assembler, then HAVE_AS_TLS will just be undefined.  And in the
> > future we may have an assmebler w/o TLS support (for example a tiny
> > assembler for bare-metal target), then HAVE_AS_TLS will be undefined
> > too.
> 
> Ok!
> 
> Thanks!
> 
> > 
> > The error message is:
> > 
> > g++ -c   -g -O2   -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -I. -Ibuild -I../../gcc/gcc -I../../gcc/gcc/build -I../../gcc/gcc/../include  -I../../gcc/gcc/../libcpp/include  \
> > 	-o build/gencondmd.o build/gencondmd.cc
> > ../../gcc/gcc/config/loongarch/loongarch.md:3655:2: error: 'HAVE_AS_TLS' was not declared in this scope
> >   3655 |   "HAVE_AS_TLS"
> >        |  ^~~~~~~~~~~
> > ../../gcc/gcc/config/loongarch/loongarch.md:3655:2: error: 'HAVE_AS_TLS' was not declared in this scope
> >   3655 |   "HAVE_AS_TLS"
> >        |  ^~~~~~~~~~~
> > ../../gcc/gcc/config/loongarch/loongarch.md:3655:2: error: 'HAVE_AS_TLS' was not declared in this scope
> >   3655 |   "HAVE_AS_TLS"
> >        |  ^~~~~~~~~~~
> > ../../gcc/gcc/config/loongarch/loongarch.md:3655:2: error: 'HAVE_AS_TLS' was not declared in this scope
> >   3655 |   "HAVE_AS_TLS"
> >        |  ^~~~~~~~~~~
> > make[1]: *** [Makefile:2962: build/gencondmd.o] Error 1
> > 
>
  

Patch

diff --git a/gcc/config/loongarch/loongarch-opts.h b/gcc/config/loongarch/loongarch-opts.h
index 2756939b05d..f204828015e 100644
--- a/gcc/config/loongarch/loongarch-opts.h
+++ b/gcc/config/loongarch/loongarch-opts.h
@@ -101,4 +101,8 @@  loongarch_update_gcc_opt_status (struct loongarch_target *target,
 #define HAVE_AS_MRELAX_OPTION 0
 #endif
 
+#ifndef HAVE_AS_TLS
+#define HAVE_AS_TLS 0
+#endif
+
 #endif /* LOONGARCH_OPTS_H */