All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mini-os: link to libgcc.a to fix build with gcc7
@ 2017-06-26 13:28 Olaf Hering
  2017-06-30 14:41 ` Wei Liu
  0 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2017-06-26 13:28 UTC (permalink / raw)
  To: xen-devel; +Cc: Olaf Hering

gcc7 generates a call to __udivmoddi4 ...

stubdom/mini-os-x86_32-grub/mini-os.o: In function `_strtoll_r':
stubdom/newlib-x86_32/i686-xen-elf/newlib/libc/stdlib/../../../../../newlib-1.16.0/newlib/libc/stdlib/strtoll_r.c:110: undefined reference to `__udivmoddi4'
make[2]: *** [Makefile:167: stubdom/mini-os-x86_32-grub/mini-os] Error 1

... which the linker only finds if libgcc.a is provided on the commandline.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ef8559b..b9c1336 100644
--- a/Makefile
+++ b/Makefile
@@ -162,7 +162,7 @@ $(OBJ_DIR)/arch/x86/minios-x86%.lds:  arch/x86/minios-x86.lds.S
 	$(CPP) $(ASFLAGS) -P $< -o $@
 
 $(OBJ_DIR)/$(TARGET): $(OBJS) $(APP_O) arch_lib $(OBJ_DIR)/$(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds
-	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
+	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) $$(gcc -print-libgcc-file-name $(CFLAGS)) -o $@.o
 	$(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o
 	$(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
 	gzip -f -9 -c $@ >$@.gz

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] mini-os: link to libgcc.a to fix build with gcc7
  2017-06-26 13:28 [PATCH] mini-os: link to libgcc.a to fix build with gcc7 Olaf Hering
@ 2017-06-30 14:41 ` Wei Liu
  2017-06-30 14:48   ` Roger Pau Monné
  0 siblings, 1 reply; 8+ messages in thread
From: Wei Liu @ 2017-06-30 14:41 UTC (permalink / raw)
  To: Olaf Hering; +Cc: Minios-devel, Samuel Thibault, Wei Liu, xen-devel

CC minios-devel

On Mon, Jun 26, 2017 at 03:28:35PM +0200, Olaf Hering wrote:
> gcc7 generates a call to __udivmoddi4 ...
> 
> stubdom/mini-os-x86_32-grub/mini-os.o: In function `_strtoll_r':
> stubdom/newlib-x86_32/i686-xen-elf/newlib/libc/stdlib/../../../../../newlib-1.16.0/newlib/libc/stdlib/strtoll_r.c:110: undefined reference to `__udivmoddi4'
> make[2]: *** [Makefile:167: stubdom/mini-os-x86_32-grub/mini-os] Error 1
> 
> ... which the linker only finds if libgcc.a is provided on the commandline.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index ef8559b..b9c1336 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -162,7 +162,7 @@ $(OBJ_DIR)/arch/x86/minios-x86%.lds:  arch/x86/minios-x86.lds.S
>  	$(CPP) $(ASFLAGS) -P $< -o $@
>  
>  $(OBJ_DIR)/$(TARGET): $(OBJS) $(APP_O) arch_lib $(OBJ_DIR)/$(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds
> -	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
> +	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) $$(gcc -print-libgcc-file-name $(CFLAGS)) -o $@.o

Append it to LDLIBS?

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mini-os: link to libgcc.a to fix build with gcc7
  2017-06-30 14:41 ` Wei Liu
@ 2017-06-30 14:48   ` Roger Pau Monné
  2017-06-30 14:50     ` Wei Liu
  0 siblings, 1 reply; 8+ messages in thread
From: Roger Pau Monné @ 2017-06-30 14:48 UTC (permalink / raw)
  To: Wei Liu; +Cc: Minios-devel, Samuel Thibault, Olaf Hering, xen-devel

On Fri, Jun 30, 2017 at 03:41:04PM +0100, Wei Liu wrote:
> CC minios-devel
> 
> On Mon, Jun 26, 2017 at 03:28:35PM +0200, Olaf Hering wrote:
> > gcc7 generates a call to __udivmoddi4 ...
> > 
> > stubdom/mini-os-x86_32-grub/mini-os.o: In function `_strtoll_r':
> > stubdom/newlib-x86_32/i686-xen-elf/newlib/libc/stdlib/../../../../../newlib-1.16.0/newlib/libc/stdlib/strtoll_r.c:110: undefined reference to `__udivmoddi4'
> > make[2]: *** [Makefile:167: stubdom/mini-os-x86_32-grub/mini-os] Error 1
> > 
> > ... which the linker only finds if libgcc.a is provided on the commandline.
> > 
> > Signed-off-by: Olaf Hering <olaf@aepfle.de>
> > ---
> >  Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index ef8559b..b9c1336 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -162,7 +162,7 @@ $(OBJ_DIR)/arch/x86/minios-x86%.lds:  arch/x86/minios-x86.lds.S
> >  	$(CPP) $(ASFLAGS) -P $< -o $@
> >  
> >  $(OBJ_DIR)/$(TARGET): $(OBJS) $(APP_O) arch_lib $(OBJ_DIR)/$(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds
> > -	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
> > +	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) $$(gcc -print-libgcc-file-name $(CFLAGS)) -o $@.o
> 
> Append it to LDLIBS?

This will break compilation with non-gcc.

Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mini-os: link to libgcc.a to fix build with gcc7
  2017-06-30 14:48   ` Roger Pau Monné
@ 2017-06-30 14:50     ` Wei Liu
  2017-06-30 14:56       ` Roger Pau Monné
  0 siblings, 1 reply; 8+ messages in thread
From: Wei Liu @ 2017-06-30 14:50 UTC (permalink / raw)
  To: Roger Pau Monné
  Cc: Minios-devel, Samuel Thibault, Olaf Hering, Wei Liu, xen-devel

On Fri, Jun 30, 2017 at 03:48:41PM +0100, Roger Pau Monné wrote:
> On Fri, Jun 30, 2017 at 03:41:04PM +0100, Wei Liu wrote:
> > CC minios-devel
> > 
> > On Mon, Jun 26, 2017 at 03:28:35PM +0200, Olaf Hering wrote:
> > > gcc7 generates a call to __udivmoddi4 ...
> > > 
> > > stubdom/mini-os-x86_32-grub/mini-os.o: In function `_strtoll_r':
> > > stubdom/newlib-x86_32/i686-xen-elf/newlib/libc/stdlib/../../../../../newlib-1.16.0/newlib/libc/stdlib/strtoll_r.c:110: undefined reference to `__udivmoddi4'
> > > make[2]: *** [Makefile:167: stubdom/mini-os-x86_32-grub/mini-os] Error 1
> > > 
> > > ... which the linker only finds if libgcc.a is provided on the commandline.
> > > 
> > > Signed-off-by: Olaf Hering <olaf@aepfle.de>
> > > ---
> > >  Makefile | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/Makefile b/Makefile
> > > index ef8559b..b9c1336 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -162,7 +162,7 @@ $(OBJ_DIR)/arch/x86/minios-x86%.lds:  arch/x86/minios-x86.lds.S
> > >  	$(CPP) $(ASFLAGS) -P $< -o $@
> > >  
> > >  $(OBJ_DIR)/$(TARGET): $(OBJS) $(APP_O) arch_lib $(OBJ_DIR)/$(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds
> > > -	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
> > > +	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) $$(gcc -print-libgcc-file-name $(CFLAGS)) -o $@.o
> > 
> > Append it to LDLIBS?
> 
> This will break compilation with non-gcc.
> 

I thought about that but mini-os is Linux only? I've tried to build it
on FreeBSD.

If I was wrong, then we should tell gcc to not generate code that relies
on libgcc. That seems impossible by reading the doc...

> Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mini-os: link to libgcc.a to fix build with gcc7
  2017-06-30 14:50     ` Wei Liu
@ 2017-06-30 14:56       ` Roger Pau Monné
  2017-06-30 15:13         ` Wei Liu
  0 siblings, 1 reply; 8+ messages in thread
From: Roger Pau Monné @ 2017-06-30 14:56 UTC (permalink / raw)
  To: Wei Liu; +Cc: Minios-devel, Samuel Thibault, Olaf Hering, xen-devel

On Fri, Jun 30, 2017 at 03:50:23PM +0100, Wei Liu wrote:
> On Fri, Jun 30, 2017 at 03:48:41PM +0100, Roger Pau Monné wrote:
> > On Fri, Jun 30, 2017 at 03:41:04PM +0100, Wei Liu wrote:
> > > CC minios-devel
> > > 
> > > On Mon, Jun 26, 2017 at 03:28:35PM +0200, Olaf Hering wrote:
> > > > gcc7 generates a call to __udivmoddi4 ...
> > > > 
> > > > stubdom/mini-os-x86_32-grub/mini-os.o: In function `_strtoll_r':
> > > > stubdom/newlib-x86_32/i686-xen-elf/newlib/libc/stdlib/../../../../../newlib-1.16.0/newlib/libc/stdlib/strtoll_r.c:110: undefined reference to `__udivmoddi4'
> > > > make[2]: *** [Makefile:167: stubdom/mini-os-x86_32-grub/mini-os] Error 1
> > > > 
> > > > ... which the linker only finds if libgcc.a is provided on the commandline.
> > > > 
> > > > Signed-off-by: Olaf Hering <olaf@aepfle.de>
> > > > ---
> > > >  Makefile | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/Makefile b/Makefile
> > > > index ef8559b..b9c1336 100644
> > > > --- a/Makefile
> > > > +++ b/Makefile
> > > > @@ -162,7 +162,7 @@ $(OBJ_DIR)/arch/x86/minios-x86%.lds:  arch/x86/minios-x86.lds.S
> > > >  	$(CPP) $(ASFLAGS) -P $< -o $@
> > > >  
> > > >  $(OBJ_DIR)/$(TARGET): $(OBJS) $(APP_O) arch_lib $(OBJ_DIR)/$(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds
> > > > -	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
> > > > +	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) $$(gcc -print-libgcc-file-name $(CFLAGS)) -o $@.o
> > > 
> > > Append it to LDLIBS?
> > 
> > This will break compilation with non-gcc.
> > 
> 
> I thought about that but mini-os is Linux only? I've tried to build it
> on FreeBSD.

It is Linux only, but you can also use clang on Linux? FWIW, I've
heard someone managed to compile this on NetBSD.

Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mini-os: link to libgcc.a to fix build with gcc7
  2017-06-30 14:56       ` Roger Pau Monné
@ 2017-06-30 15:13         ` Wei Liu
  2017-06-30 16:58           ` Olaf Hering
  0 siblings, 1 reply; 8+ messages in thread
From: Wei Liu @ 2017-06-30 15:13 UTC (permalink / raw)
  To: Roger Pau Monné
  Cc: Minios-devel, Samuel Thibault, Olaf Hering, Wei Liu, xen-devel

On Fri, Jun 30, 2017 at 03:56:24PM +0100, Roger Pau Monné wrote:
> On Fri, Jun 30, 2017 at 03:50:23PM +0100, Wei Liu wrote:
> > On Fri, Jun 30, 2017 at 03:48:41PM +0100, Roger Pau Monné wrote:
> > > On Fri, Jun 30, 2017 at 03:41:04PM +0100, Wei Liu wrote:
> > > > CC minios-devel
> > > > 
> > > > On Mon, Jun 26, 2017 at 03:28:35PM +0200, Olaf Hering wrote:
> > > > > gcc7 generates a call to __udivmoddi4 ...
> > > > > 
> > > > > stubdom/mini-os-x86_32-grub/mini-os.o: In function `_strtoll_r':
> > > > > stubdom/newlib-x86_32/i686-xen-elf/newlib/libc/stdlib/../../../../../newlib-1.16.0/newlib/libc/stdlib/strtoll_r.c:110: undefined reference to `__udivmoddi4'
> > > > > make[2]: *** [Makefile:167: stubdom/mini-os-x86_32-grub/mini-os] Error 1
> > > > > 
> > > > > ... which the linker only finds if libgcc.a is provided on the commandline.
> > > > > 
> > > > > Signed-off-by: Olaf Hering <olaf@aepfle.de>
> > > > > ---
> > > > >  Makefile | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/Makefile b/Makefile
> > > > > index ef8559b..b9c1336 100644
> > > > > --- a/Makefile
> > > > > +++ b/Makefile
> > > > > @@ -162,7 +162,7 @@ $(OBJ_DIR)/arch/x86/minios-x86%.lds:  arch/x86/minios-x86.lds.S
> > > > >  	$(CPP) $(ASFLAGS) -P $< -o $@
> > > > >  
> > > > >  $(OBJ_DIR)/$(TARGET): $(OBJS) $(APP_O) arch_lib $(OBJ_DIR)/$(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds
> > > > > -	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
> > > > > +	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) $$(gcc -print-libgcc-file-name $(CFLAGS)) -o $@.o
> > > > 
> > > > Append it to LDLIBS?
> > > 
> > > This will break compilation with non-gcc.
> > > 
> > 
> > I thought about that but mini-os is Linux only? I've tried to build it
> > on FreeBSD.
> 
> It is Linux only, but you can also use clang on Linux? FWIW, I've
> heard someone managed to compile this on NetBSD.

On second thought I don't think we want to make this worse. So the
change in this patch should be conditional on gcc.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mini-os: link to libgcc.a to fix build with gcc7
  2017-06-30 15:13         ` Wei Liu
@ 2017-06-30 16:58           ` Olaf Hering
  2017-06-30 17:01             ` Olaf Hering
  0 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2017-06-30 16:58 UTC (permalink / raw)
  To: Wei Liu; +Cc: Minios-devel, Samuel Thibault, xen-devel, Roger Pau Monné


[-- Attachment #1.1: Type: text/plain, Size: 326 bytes --]

On Fri, Jun 30, Wei Liu wrote:

> On second thought I don't think we want to make this worse. So the
> change in this patch should be conditional on gcc.

How whould I check for gcc in the Makefile?
In xen.git I see a conditional for clang. I dont have a clang at hand,
perhaps it knows about "-print-libgcc-file-name"?

Olaf

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mini-os: link to libgcc.a to fix build with gcc7
  2017-06-30 16:58           ` Olaf Hering
@ 2017-06-30 17:01             ` Olaf Hering
  0 siblings, 0 replies; 8+ messages in thread
From: Olaf Hering @ 2017-06-30 17:01 UTC (permalink / raw)
  To: Wei Liu; +Cc: Minios-devel, Samuel Thibault, xen-devel, Roger Pau Monné


[-- Attachment #1.1: Type: text/plain, Size: 583 bytes --]

On Fri, Jun 30, Olaf Hering wrote:

> On Fri, Jun 30, Wei Liu wrote:
> 
> > On second thought I don't think we want to make this worse. So the
> > change in this patch should be conditional on gcc.
> 
> How whould I check for gcc in the Makefile?
> In xen.git I see a conditional for clang. I dont have a clang at hand,
> perhaps it knows about "-print-libgcc-file-name"?

Mine works fine:

 $  gcc -print-libgcc-file-name
/usr/lib64/gcc/x86_64-suse-linux/7/libgcc.a
 $  clang-3.8 -print-libgcc-file-name
/usr/bin/../lib64/gcc/x86_64-suse-linux/7/libgcc.a


Olaf

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-06-30 17:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-26 13:28 [PATCH] mini-os: link to libgcc.a to fix build with gcc7 Olaf Hering
2017-06-30 14:41 ` Wei Liu
2017-06-30 14:48   ` Roger Pau Monné
2017-06-30 14:50     ` Wei Liu
2017-06-30 14:56       ` Roger Pau Monné
2017-06-30 15:13         ` Wei Liu
2017-06-30 16:58           ` Olaf Hering
2017-06-30 17:01             ` Olaf Hering

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.