Skip to contentSkip to conversation

vbox: fix link error with 'gcc -Og'

PATCH In review Arnd Bergmann 2 participants 2 messages Nov 2, 2018 Virtual box guest device driver

lore
Share & tools
lore

Arnd Bergmann

author maintainer
#0 lore raw

PATCH 1/1 vbox: fix link error with 'gcc -Og'

With the new CONFIG_CC_OPTIMIZE_FOR_DEBUGGING option, we get a link error in the vboxguest driver, when that fails to optimize out the call to the compat handler:

drivers/virt/vboxguest/vboxguest_core.o: In function `vbg_ioctl_hgcm_call':
vboxguest_core.c:(.text+0x1f6e): undefined reference to `vbg_hgcm_call32'

Another compile-time check documents better what we want and avoids the error.

---
 drivers/virt/vboxguest/vboxguest_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virt/vboxguest/vboxguest_core.c +1 -1
index 3093655c7b92..1475ed5ffcde 100644
@@ -1312,7 +1312,7 @@ static int vbg_ioctl_hgcm_call(struct vbg_dev *gdev,
 		return -EINVAL;
 	}
 
-	if (f32bit)
+	if (IS_ENABLED(CONFIG_COMPAT) && f32bit)
 		ret = vbg_hgcm_call32(gdev, client_id,
 				      call->function, call->timeout_ms,
 				      VBG_IOCTL_HGCM_CALL_PARMS32(call),
Signature · 1 line
2.18.0
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 7 lines · Arnd Bergmann

With the new CONFIG_CC_OPTIMIZE_FOR_DEBUGGING option, we get a link error in the vboxguest driver, when that fails to optimize out the call to the compat handler:

drivers/virt/vboxguest/vboxguest_core.o: In function `vbg_ioctl_hgcm_call':
vboxguest_core.c:(.text+0x1f6e): undefined reference to `vbg_hgcm_call32'

Quoted 6 lines

Another compile-time check documents better what we want and avoids the error.

Thank you, looks good to me:

Regards,

Hans

Quoted 18 lines
---
  drivers/virt/vboxguest/vboxguest_core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virt/vboxguest/vboxguest_core.c +1 -1
index 3093655c7b92..1475ed5ffcde 100644
@@ -1312,7 +1312,7 @@ static int vbg_ioctl_hgcm_call(struct vbg_dev *gdev,
  		return -EINVAL;
  	}
 
-	if (f32bit)
+	if (IS_ENABLED(CONFIG_COMPAT) && f32bit)
  		ret = vbg_hgcm_call32(gdev, client_id,
  				      call->function, call->timeout_ms,
  				      VBG_IOCTL_HGCM_CALL_PARMS32(call),