Skip to contentSkip to conversation

squashfs: fix build with gcc 7

PATCH New Baruch Siach 3 participants 4 messages Jul 25, 2017 – Sep 4, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 squashfs: fix build with gcc 7

gcc 7 with -Os (optimize for size) takes the liberty to remove the code of inline function entirely. This leads to undefined function references at link time. Restore gcc original inline behaviour to fix this issue.

Fixes:
http://autobuild.buildroot.net/results/3c5/3c5b1d799dce3ba361d618330c242bf4eba76019/
http://autobuild.buildroot.net/results/09f/09f350b62e2486404b78222dce211400bb233000/
http://autobuild.buildroot.net/results/693/693960ed7c01622c756dcc929e83b3b713c16ccc/

Cc Thomas Petazzoni <[email protected]>

---
The gcc doc[1] doesn't mention that feature of C99. A gcc bug, maybe?

[1] https://gcc.gnu.org/onlinedocs/gcc/Inline.html

---
 package/squashfs/squashfs.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/squashfs/squashfs.mk +1 -1
index db3f27648eb6..9599d892b261 100644
@@ -59,7 +59,7 @@ HOST_SQUASHFS_MAKE_ARGS = \
 define SQUASHFS_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) \
 		CC="$(TARGET_CC)" \
-		EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
+		EXTRA_CFLAGS="$(TARGET_CFLAGS) -fgnu89-inline" \
 		EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
 		$(SQUASHFS_MAKE_ARGS) \
 		-C $(@D)/squashfs-tools/
Signature · 1 line
2.13.2
#1 lore raw

PATCH 1/1 squashfs: fix build with gcc 7

Hello,

Quoted 9 lines · Baruch Siach

gcc 7 with -Os (optimize for size) takes the liberty to remove the code of inline function entirely. This leads to undefined function references at link time. Restore gcc original inline behaviour to fix this issue.

Fixes:
http://autobuild.buildroot.net/results/3c5/3c5b1d799dce3ba361d618330c242bf4eba76019/
http://autobuild.buildroot.net/results/09f/09f350b62e2486404b78222dce211400bb233000/
http://autobuild.buildroot.net/results/693/693960ed7c01622c756dcc929e83b3b713c16ccc/

Quoted 4 lines
Cc Thomas Petazzoni <[email protected]>

---
The gcc doc[1] doesn't mention that feature of C99. A gcc bug, maybe?

Applied to master, thanks. To be honest, I hesitated between your proposal and patching the mksquashfs.c code, but OK, I went with your solution.

Can you send a patch upstream that removes the "inline" or switches them to "static inline" ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 squashfs: fix build with gcc 7

Hi Thomas,

Quoted 15 lines · Thomas Petazzoni
Quoted 9 lines · Baruch Siach

gcc 7 with -Os (optimize for size) takes the liberty to remove the code of inline function entirely. This leads to undefined function references at link time. Restore gcc original inline behaviour to fix this issue.

Fixes:
http://autobuild.buildroot.net/results/3c5/3c5b1d799dce3ba361d618330c242bf4eba76019/
http://autobuild.buildroot.net/results/09f/09f350b62e2486404b78222dce211400bb233000/
http://autobuild.buildroot.net/results/693/693960ed7c01622c756dcc929e83b3b713c16ccc/

Quoted 4 lines
Cc Thomas Petazzoni <[email protected]>

---
The gcc doc[1] doesn't mention that feature of C99. A gcc bug, maybe?

Quoted 8 lines

Applied to master, thanks. To be honest, I hesitated between your proposal and patching the mksquashfs.c code, but OK, I went with your solution.

Can you send a patch upstream that removes the "inline" or switches them to "static inline" ?

Thanks!

Done.

https://sourceforge.net/p/squashfs/mailman/message/35982546/

I'm still not sure what is the root cause if this issue, and whether this is GCC/C99 expected behaviour.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#3 lore raw

PATCH 1/1 squashfs: fix build with gcc 7

In reply to Baruch Siach
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Baruch" == Baruch Siach <[email protected]> writes:

gcc 7 with -Os (optimize for size) takes the liberty to remove the code of inline function entirely. This leads to undefined function references at link time. Restore gcc original inline behaviour to fix this issue.

Fixes:
http://autobuild.buildroot.net/results/3c5/3c5b1d799dce3ba361d618330c242bf4eba76019/
http://autobuild.buildroot.net/results/09f/09f350b62e2486404b78222dce211400bb233000/
http://autobuild.buildroot.net/results/693/693960ed7c01622c756dcc929e83b3b713c16ccc/

Quoted 6 lines
Cc Thomas Petazzoni <[email protected]>

---
The gcc doc[1] doesn't mention that feature of C99. A gcc bug, maybe?

[1] https://gcc.gnu.org/onlinedocs/gcc/Inline.html

Committed to 2017.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard