Skip to contentSkip to conversation

commit 4dd1837d7589f468ed109556513f476e7a7f9121 breaks build

DISCUSSION Tobias Jakobi 5 participants 10 messages Nov 20, 2016 – Nov 22, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

this is a resend of my initial mail, see below, to Al Viro (which sadly was ignored).

It's rc5 now, and this issue still remains. Putting some more lists on the Cc now.

Reverting the commit still works for me.

With best wishes,
Tobias

----------------

Hello Al,

compiled a kernel on armv7 with torvalds/master today and getting some errors during the modpost phase.

Quoted 8 lines

ERROR: "_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/core/seq/snd-seq.ko] undefined!

<snip>

It seems like the commit 'arm: move exports to definitions' introduces this issue.

I quickly went over the commit and I noticed that while it removes the EXPORT_SYMBOL()s for the bitops from armksyms.c, it doesn't move them anywhere.

Maybe you can take a look at this?

With best wishes,
Tobias

#1 lore raw

None of the autobuilders are finding this problem, and they build a wide range of configurations. Maybe it's something specific to how you're building the kernel - can you give step by step instructions how to reproduce this please?

Quoted 48 lines · Tobias Jakobi

Hello,

this is a resend of my initial mail, see below, to Al Viro (which sadly was ignored).

It's rc5 now, and this issue still remains. Putting some more lists on the Cc now.

Reverting the commit still works for me.

With best wishes,
Tobias

----------------

Hello Al,

compiled a kernel on armv7 with torvalds/master today and getting some errors during the modpost phase.

Quoted 8 lines

ERROR: "_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/core/seq/snd-seq.ko] undefined!

<snip>

It seems like the commit 'arm: move exports to definitions' introduces this issue.

I quickly went over the commit and I noticed that while it removes the EXPORT_SYMBOL()s for the bitops from armksyms.c, it doesn't move them anywhere.

Maybe you can take a look at this?

With best wishes,
Tobias

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#2 lore raw

Hello Russell,

Quoted 4 lines · Russell King - ARM Linux

None of the autobuilders are finding this problem, and they build a wide range of configurations. Maybe it's something specific to how you're building the kernel - can you give step by step instructions how to reproduce this please?

Just using plain make here, no cross-compiler or anything involved. gcc is version 4.9.4.

Build platform is a Exynos4412 based ODROID-X2.

The complete log from the 'build modules' step:

Quoted 58 lines

Building modules, stage 2.
Kernel: arch/arm/boot/Image is ready
MODPOST 52 modules
XZKERN arch/arm/boot/compressed/piggy_data
SHIPPED arch/arm/boot/compressed/lib1funcs.S
SHIPPED arch/arm/boot/compressed/ashldi3.S
SHIPPED arch/arm/boot/compressed/bswapsdi2.S

  AS      arch/arm/boot/compressed/lib1funcs.o
  AS      arch/arm/boot/compressed/ashldi3.o
  AS      arch/arm/boot/compressed/bswapsdi2.o

ERROR: "_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/core/seq/snd-seq.ko] undefined!
ERROR: "_test_and_set_bit" [sound/core/seq/snd-seq.ko] undefined!
ERROR: "_set_bit" [net/bridge/bridge.ko] undefined!
ERROR: "_clear_bit" [net/bridge/bridge.ko] undefined!
ERROR: "_test_and_clear_bit" [net/bluetooth/hidp/hidp.ko] undefined!
ERROR: "_set_bit" [net/bluetooth/hidp/hidp.ko] undefined!
ERROR: "_clear_bit" [net/bluetooth/hidp/hidp.ko] undefined!
ERROR: "_set_bit" [net/bluetooth/bnep/bnep.ko] undefined!
ERROR: "_test_and_set_bit" [net/bluetooth/bnep/bnep.ko] undefined!
ERROR: "_clear_bit" [net/bluetooth/bnep/bnep.ko] undefined!
ERROR: "_test_and_clear_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_set_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_test_and_set_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_clear_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_test_and_clear_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_set_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_test_and_set_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_clear_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_test_and_clear_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_set_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_test_and_set_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_clear_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/usb/storage/usb-storage.ko] undefined!
ERROR: "_set_bit" [drivers/usb/storage/usb-storage.ko] undefined!
ERROR: "_clear_bit" [drivers/usb/storage/usb-storage.ko] undefined!
ERROR: "_set_bit" [drivers/usb/gadget/libcomposite.ko] undefined!
ERROR: "_set_bit" [drivers/usb/gadget/function/usb_f_rndis.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_test_and_set_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_clear_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_set_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_set_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_test_and_set_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_clear_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_clear_bit" [drivers/md/dm-crypt.ko] undefined!
ERROR: "_set_bit" [drivers/md/dm-crypt.ko] undefined!
ERROR: "_set_bit" [drivers/gpu/arm/mali/maligpu.ko] undefined!
ERROR: "_clear_bit" [drivers/gpu/arm/mali/maligpu.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_test_and_set_bit" [drivers/bluetooth/btusb.ko] undefined!

Quoted 8 lines

ERROR: "_set_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_clear_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_set_bit" [drivers/bluetooth/btintel.ko] undefined!
ERROR: "_set_bit" [drivers/bluetooth/btbcm.ko] undefined! scripts/Makefile.modpost:91: recipe for target '__modpost' failed make[1]: *** [__modpost] Error 1
Makefile:1191: recipe for target 'modules' failed
make: *** [modules] Error 2

This is the config I'm using for the build:
https://github.com/tobiasjakobi/odroid-environment/blob/master/sourcecode/system/vanilla-4.9-debug.conf

Let me know which additional information you need.

With best wishes,
Tobias

Quoted 50 lines · Tobias Jakobi
Quoted 48 lines

Hello,

this is a resend of my initial mail, see below, to Al Viro (which sadly was ignored).

It's rc5 now, and this issue still remains. Putting some more lists on the Cc now.

Reverting the commit still works for me.

With best wishes,
Tobias

----------------

Hello Al,

compiled a kernel on armv7 with torvalds/master today and getting some errors during the modpost phase.

Quoted 8 lines

ERROR: "_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/core/seq/snd-seq.ko] undefined!

<snip>

It seems like the commit 'arm: move exports to definitions' introduces this issue.

I quickly went over the commit and I noticed that while it removes the EXPORT_SYMBOL()s for the bitops from armksyms.c, it doesn't move them anywhere.

Maybe you can take a look at this?

With best wishes,
Tobias

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
Quoted 9 lines · Tobias Jakobi

Hello Russell,

Quoted 4 lines · Russell King - ARM Linux

None of the autobuilders are finding this problem, and they build a wide range of configurations. Maybe it's something specific to how you're building the kernel - can you give step by step instructions how to reproduce this please?

Just using plain make here, no cross-compiler or anything involved. gcc is version 4.9.4.

Hmm. The commit you mention was merged during the merge window, so anyone building 4.9-rc1 or later should be seeing this problem, but they aren't. I've built many kernels post -rc1, and I'm not seeing the problem with my 4.7.4 cross compiler.

Quoted 72 lines

Build platform is a Exynos4412 based ODROID-X2.

The complete log from the 'build modules' step:

Quoted 58 lines

Building modules, stage 2.
Kernel: arch/arm/boot/Image is ready
MODPOST 52 modules
XZKERN arch/arm/boot/compressed/piggy_data
SHIPPED arch/arm/boot/compressed/lib1funcs.S
SHIPPED arch/arm/boot/compressed/ashldi3.S
SHIPPED arch/arm/boot/compressed/bswapsdi2.S

  AS      arch/arm/boot/compressed/lib1funcs.o
  AS      arch/arm/boot/compressed/ashldi3.o
  AS      arch/arm/boot/compressed/bswapsdi2.o

ERROR: "_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/core/seq/snd-seq.ko] undefined!
ERROR: "_test_and_set_bit" [sound/core/seq/snd-seq.ko] undefined!
ERROR: "_set_bit" [net/bridge/bridge.ko] undefined!
ERROR: "_clear_bit" [net/bridge/bridge.ko] undefined!
ERROR: "_test_and_clear_bit" [net/bluetooth/hidp/hidp.ko] undefined!
ERROR: "_set_bit" [net/bluetooth/hidp/hidp.ko] undefined!
ERROR: "_clear_bit" [net/bluetooth/hidp/hidp.ko] undefined!
ERROR: "_set_bit" [net/bluetooth/bnep/bnep.ko] undefined!
ERROR: "_test_and_set_bit" [net/bluetooth/bnep/bnep.ko] undefined!
ERROR: "_clear_bit" [net/bluetooth/bnep/bnep.ko] undefined!
ERROR: "_test_and_clear_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_set_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_test_and_set_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_clear_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_test_and_clear_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_set_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_test_and_set_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_clear_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_test_and_clear_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_set_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_test_and_set_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_clear_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/usb/storage/usb-storage.ko] undefined!
ERROR: "_set_bit" [drivers/usb/storage/usb-storage.ko] undefined!
ERROR: "_clear_bit" [drivers/usb/storage/usb-storage.ko] undefined!
ERROR: "_set_bit" [drivers/usb/gadget/libcomposite.ko] undefined!
ERROR: "_set_bit" [drivers/usb/gadget/function/usb_f_rndis.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_test_and_set_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_clear_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_set_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_set_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_test_and_set_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_clear_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_clear_bit" [drivers/md/dm-crypt.ko] undefined!
ERROR: "_set_bit" [drivers/md/dm-crypt.ko] undefined!
ERROR: "_set_bit" [drivers/gpu/arm/mali/maligpu.ko] undefined!
ERROR: "_clear_bit" [drivers/gpu/arm/mali/maligpu.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_test_and_set_bit" [drivers/bluetooth/btusb.ko] undefined!

Quoted 8 lines

ERROR: "_set_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_clear_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_set_bit" [drivers/bluetooth/btintel.ko] undefined!
ERROR: "_set_bit" [drivers/bluetooth/btbcm.ko] undefined! scripts/Makefile.modpost:91: recipe for target '__modpost' failed make[1]: *** [__modpost] Error 1
Makefile:1191: recipe for target 'modules' failed
make: *** [modules] Error 2

Quoted 2 lines

This is the config I'm using for the build:
https://github.com/tobiasjakobi/odroid-environment/blob/master/sourcecode/system/vanilla-4.9-debug.conf

You have CONFIG_TRIM_UNUSED_KSYMS enabled - I wonder if that's the issue. I've just enabled that here, and building I see:

EXPORTS lib/lib-ksyms.o

  LD      lib/built-in.o
  CHK     include/generated/autoksyms.h
  KSYMS   symbols: before=0, after=2413, changed=2413
  UPD     include/generated/autoksyms.h

and then the build seems to restart from the very beginning, which seems rather fishy - it doubles the build time of the kernel. The second build doesn't even hit any ccache entries from the first build. Then we get through the rebuild, and I get:

EXPORTS lib/lib-ksyms.o

  LD      lib/built-in.o
  CHK     include/generated/autoksyms.h
  LD      vmlinux.o
...
  LD      vmlinux
  SORTEX  vmlinux
  SYSMAP  System.map

Building modules, stage 2.
OBJCOPY arch/arm/boot/Image
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/head.o
LZO arch/arm/boot/compressed/piggy_data
MODPOST 465 modules
ERROR: CC arch/arm/boot/compressed/misc.o
"_clear_bit" [net/sched/sch_teql.ko] undefined!
ERROR: "_set_bit" [net/sched/sch_teql.ko] undefined!
ERROR: "_set_bit" [net/sched/cls_u32.ko] undefined!
ERROR: "_test_and_set_bit" [net/netfilter/nfnetlink_acct.ko] undefined!
ERROR: "_clear_bit" [net/netfilter/nfnetlink_acct.ko] undefined!
ERROR: "_test_and_clear_bit" [net/mac80211/mac80211.ko] undefined!
ERROR: "_set_bit" [net/mac80211/mac80211.ko] undefined!
ERROR: "_test_and_set_bit" [net/mac80211/mac80211.ko] undefined!
ERROR: "_clear_bit" [net/mac80211/mac80211.ko] undefined!

So yes, it's caused by this ksyms trimming.

Now, the thing is that include/generated/autoksyms.h contains:

#define __KSYM__change_bit 1
#define __KSYM__clear_bit 1
#define __KSYM__set_bit 1
#define __KSYM__test_and_change_bit 1
#define __KSYM__test_and_clear_bit 1
#define __KSYM__test_and_set_bit 1

amongst many other stuff - presumably this is a list of ksyms which should be included, rather than a list of what should be excluded.

I'm afraid that I never saw the patches which changed the way the ksyms stuff worked for the assembly files, and these patches have caused several problems for ARM. I'm not aware of what the changes were, or how the damn exports now work, so I'm currently at a loss what to suggest at the moment, other than to disable CONFIG_TRIM_UNUSED_KSYMS in your configuration until someone can work out wtf is going on.

I guess I'm going to have to work out how this stuff now works - don't expect a solution quickly, especially as building with this option enabled is soo time consuming (like, half an hour per build.)

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#4 lore raw

Hey Russell,

thanks for the quick reply and looking into this!

Added Nicolas Pitre to Cc since the ksym trim stuff came from him.

Quoted 88 lines · Russell King - ARM Linux
Quoted 9 lines · Tobias Jakobi

Hello Russell,

Quoted 4 lines · Russell King - ARM Linux

None of the autobuilders are finding this problem, and they build a wide range of configurations. Maybe it's something specific to how you're building the kernel - can you give step by step instructions how to reproduce this please?

Just using plain make here, no cross-compiler or anything involved. gcc is version 4.9.4.

Hmm. The commit you mention was merged during the merge window, so anyone building 4.9-rc1 or later should be seeing this problem, but they aren't. I've built many kernels post -rc1, and I'm not seeing the problem with my 4.7.4 cross compiler.

Quoted 72 lines

Build platform is a Exynos4412 based ODROID-X2.

The complete log from the 'build modules' step:

Quoted 66 lines

Building modules, stage 2.
Kernel: arch/arm/boot/Image is ready
MODPOST 52 modules
XZKERN arch/arm/boot/compressed/piggy_data
SHIPPED arch/arm/boot/compressed/lib1funcs.S
SHIPPED arch/arm/boot/compressed/ashldi3.S
SHIPPED arch/arm/boot/compressed/bswapsdi2.S

  AS      arch/arm/boot/compressed/lib1funcs.o
  AS      arch/arm/boot/compressed/ashldi3.o
  AS      arch/arm/boot/compressed/bswapsdi2.o

ERROR: "_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/core/seq/snd-seq.ko] undefined!
ERROR: "_test_and_set_bit" [sound/core/seq/snd-seq.ko] undefined!
ERROR: "_set_bit" [net/bridge/bridge.ko] undefined!
ERROR: "_clear_bit" [net/bridge/bridge.ko] undefined!
ERROR: "_test_and_clear_bit" [net/bluetooth/hidp/hidp.ko] undefined!
ERROR: "_set_bit" [net/bluetooth/hidp/hidp.ko] undefined!
ERROR: "_clear_bit" [net/bluetooth/hidp/hidp.ko] undefined!
ERROR: "_set_bit" [net/bluetooth/bnep/bnep.ko] undefined!
ERROR: "_test_and_set_bit" [net/bluetooth/bnep/bnep.ko] undefined!
ERROR: "_clear_bit" [net/bluetooth/bnep/bnep.ko] undefined!
ERROR: "_test_and_clear_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_set_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_test_and_set_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_clear_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_test_and_clear_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_set_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_test_and_set_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_clear_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_test_and_clear_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_set_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_test_and_set_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_clear_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/usb/storage/usb-storage.ko] undefined!
ERROR: "_set_bit" [drivers/usb/storage/usb-storage.ko] undefined!
ERROR: "_clear_bit" [drivers/usb/storage/usb-storage.ko] undefined!
ERROR: "_set_bit" [drivers/usb/gadget/libcomposite.ko] undefined!
ERROR: "_set_bit" [drivers/usb/gadget/function/usb_f_rndis.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_test_and_set_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_clear_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_set_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_set_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_test_and_set_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_clear_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_clear_bit" [drivers/md/dm-crypt.ko] undefined!
ERROR: "_set_bit" [drivers/md/dm-crypt.ko] undefined!
ERROR: "_set_bit" [drivers/gpu/arm/mali/maligpu.ko] undefined!
ERROR: "_clear_bit" [drivers/gpu/arm/mali/maligpu.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_test_and_set_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_set_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_clear_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_set_bit" [drivers/bluetooth/btintel.ko] undefined!
ERROR: "_set_bit" [drivers/bluetooth/btbcm.ko] undefined! scripts/Makefile.modpost:91: recipe for target '__modpost' failed make[1]: *** [__modpost] Error 1
Makefile:1191: recipe for target 'modules' failed
make: *** [modules] Error 2

Quoted 5 lines
Quoted 2 lines

This is the config I'm using for the build:
https://github.com/tobiasjakobi/odroid-environment/blob/master/sourcecode/system/vanilla-4.9-debug.conf

You have CONFIG_TRIM_UNUSED_KSYMS enabled - I wonder if that's the issue. I've just enabled that here, and building I see:

Thanks, I had this enabled on purpose since I don't need any out-of-tree drivers for this board.

I'll check if disabling TRIM_UNUSED_KSYMS also does the trick for me.

With best wishes,
Tobias

Quoted 61 lines

EXPORTS lib/lib-ksyms.o

  LD      lib/built-in.o
  CHK     include/generated/autoksyms.h
  KSYMS   symbols: before=0, after=2413, changed=2413
  UPD     include/generated/autoksyms.h

and then the build seems to restart from the very beginning, which seems rather fishy - it doubles the build time of the kernel. The second build doesn't even hit any ccache entries from the first build. Then we get through the rebuild, and I get:

EXPORTS lib/lib-ksyms.o

  LD      lib/built-in.o
  CHK     include/generated/autoksyms.h
  LD      vmlinux.o
...
  LD      vmlinux
  SORTEX  vmlinux
  SYSMAP  System.map

Building modules, stage 2.
OBJCOPY arch/arm/boot/Image
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/head.o
LZO arch/arm/boot/compressed/piggy_data
MODPOST 465 modules
ERROR: CC arch/arm/boot/compressed/misc.o
"_clear_bit" [net/sched/sch_teql.ko] undefined!
ERROR: "_set_bit" [net/sched/sch_teql.ko] undefined!
ERROR: "_set_bit" [net/sched/cls_u32.ko] undefined!
ERROR: "_test_and_set_bit" [net/netfilter/nfnetlink_acct.ko] undefined!
ERROR: "_clear_bit" [net/netfilter/nfnetlink_acct.ko] undefined!
ERROR: "_test_and_clear_bit" [net/mac80211/mac80211.ko] undefined!
ERROR: "_set_bit" [net/mac80211/mac80211.ko] undefined!
ERROR: "_test_and_set_bit" [net/mac80211/mac80211.ko] undefined!
ERROR: "_clear_bit" [net/mac80211/mac80211.ko] undefined!

So yes, it's caused by this ksyms trimming.

Now, the thing is that include/generated/autoksyms.h contains:

#define __KSYM__change_bit 1
#define __KSYM__clear_bit 1
#define __KSYM__set_bit 1
#define __KSYM__test_and_change_bit 1
#define __KSYM__test_and_clear_bit 1
#define __KSYM__test_and_set_bit 1

amongst many other stuff - presumably this is a list of ksyms which should be included, rather than a list of what should be excluded.

I'm afraid that I never saw the patches which changed the way the ksyms stuff worked for the assembly files, and these patches have caused several problems for ARM. I'm not aware of what the changes were, or how the damn exports now work, so I'm currently at a loss what to suggest at the moment, other than to disable CONFIG_TRIM_UNUSED_KSYMS in your configuration until someone can work out wtf is going on.

I guess I'm going to have to work out how this stuff now works - don't expect a solution quickly, especially as building with this option enabled is soo time consuming (like, half an hour per build.)

#9 lore raw
In reply to Russell King - ARM Linux
Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Tobias Jakobi

Hello Russell,

Quoted 4 lines · Russell King - ARM Linux

None of the autobuilders are finding this problem, and they build a wide range of configurations. Maybe it's something specific to how you're building the kernel - can you give step by step instructions how to reproduce this please?

Quoted 8 lines
Quoted 2 lines

Just using plain make here, no cross-compiler or anything involved. gcc is version 4.9.4.

Hmm. The commit you mention was merged during the merge window, so anyone building 4.9-rc1 or later should be seeing this problem, but they aren't. I've built many kernels post -rc1, and I'm not seeing the problem with my 4.7.4 cross compiler.

I have the same issue here on all my Allwinner ARM device.
I have not reported this issue since I believed to see some report of it.

I cross compile with armv7a-hardfloat-linux-gnueabi-4.9.3.

With CONFIG_UNUSED_SYMBOLS set, the issue disapear

Regards

#5 lore raw
In reply to Tobias Jakobi
Quoted 5 lines · Tobias Jakobi

Hey Russell,

thanks for the quick reply and looking into this!

Added Nicolas Pitre to Cc since the ksym trim stuff came from him.

Arnd's patch "kbuild: provide include/asm/asm-prototypes.h for ARM" fixes it, but I think it's a mixture of fixes, and partially dependent on some other patches. I don't know what the status of his patch is, but my feeling is that it consists of more than a single fix, and needs splitting. Certainly the asm-prototypes.h is not relevant to this problem, but the rest of it seems to be.

Quoted 166 lines
Quoted 88 lines · Russell King - ARM Linux
Quoted 9 lines · Tobias Jakobi

Hello Russell,

Quoted 4 lines · Russell King - ARM Linux

None of the autobuilders are finding this problem, and they build a wide range of configurations. Maybe it's something specific to how you're building the kernel - can you give step by step instructions how to reproduce this please?

Just using plain make here, no cross-compiler or anything involved. gcc is version 4.9.4.

Hmm. The commit you mention was merged during the merge window, so anyone building 4.9-rc1 or later should be seeing this problem, but they aren't. I've built many kernels post -rc1, and I'm not seeing the problem with my 4.7.4 cross compiler.

Quoted 72 lines

Build platform is a Exynos4412 based ODROID-X2.

The complete log from the 'build modules' step:

Quoted 66 lines

Building modules, stage 2.
Kernel: arch/arm/boot/Image is ready
MODPOST 52 modules
XZKERN arch/arm/boot/compressed/piggy_data
SHIPPED arch/arm/boot/compressed/lib1funcs.S
SHIPPED arch/arm/boot/compressed/ashldi3.S
SHIPPED arch/arm/boot/compressed/bswapsdi2.S

  AS      arch/arm/boot/compressed/lib1funcs.o
  AS      arch/arm/boot/compressed/ashldi3.o
  AS      arch/arm/boot/compressed/bswapsdi2.o

ERROR: "_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usbmidi-lib.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_set_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_clear_bit" [sound/usb/snd-usb-audio.ko] undefined!
ERROR: "_test_and_clear_bit" [sound/core/seq/snd-seq.ko] undefined!
ERROR: "_test_and_set_bit" [sound/core/seq/snd-seq.ko] undefined!
ERROR: "_set_bit" [net/bridge/bridge.ko] undefined!
ERROR: "_clear_bit" [net/bridge/bridge.ko] undefined!
ERROR: "_test_and_clear_bit" [net/bluetooth/hidp/hidp.ko] undefined!
ERROR: "_set_bit" [net/bluetooth/hidp/hidp.ko] undefined!
ERROR: "_clear_bit" [net/bluetooth/hidp/hidp.ko] undefined!
ERROR: "_set_bit" [net/bluetooth/bnep/bnep.ko] undefined!
ERROR: "_test_and_set_bit" [net/bluetooth/bnep/bnep.ko] undefined!
ERROR: "_clear_bit" [net/bluetooth/bnep/bnep.ko] undefined!
ERROR: "_test_and_clear_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_set_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_test_and_set_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_clear_bit" [fs/fuse/fuse.ko] undefined!
ERROR: "_test_and_clear_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_set_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_test_and_set_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_clear_bit" [fs/cifs/cifs.ko] undefined!
ERROR: "_test_and_clear_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_set_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_test_and_set_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_clear_bit" [fs/btrfs/btrfs.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/usb/storage/usb-storage.ko] undefined!
ERROR: "_set_bit" [drivers/usb/storage/usb-storage.ko] undefined!
ERROR: "_clear_bit" [drivers/usb/storage/usb-storage.ko] undefined!
ERROR: "_set_bit" [drivers/usb/gadget/libcomposite.ko] undefined!
ERROR: "_set_bit" [drivers/usb/gadget/function/usb_f_rndis.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_test_and_set_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_clear_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_set_bit" [drivers/usb/gadget/function/u_ether.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_set_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_test_and_set_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_clear_bit" [drivers/media/platform/s5p-mfc/s5p-mfc.ko] undefined!
ERROR: "_clear_bit" [drivers/md/dm-crypt.ko] undefined!
ERROR: "_set_bit" [drivers/md/dm-crypt.ko] undefined!
ERROR: "_set_bit" [drivers/gpu/arm/mali/maligpu.ko] undefined!
ERROR: "_clear_bit" [drivers/gpu/arm/mali/maligpu.ko] undefined!
ERROR: "_test_and_clear_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_test_and_set_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_set_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_clear_bit" [drivers/bluetooth/btusb.ko] undefined!
ERROR: "_set_bit" [drivers/bluetooth/btintel.ko] undefined!
ERROR: "_set_bit" [drivers/bluetooth/btbcm.ko] undefined! scripts/Makefile.modpost:91: recipe for target '__modpost' failed make[1]: *** [__modpost] Error 1
Makefile:1191: recipe for target 'modules' failed
make: *** [modules] Error 2

Quoted 5 lines
Quoted 2 lines

This is the config I'm using for the build:
https://github.com/tobiasjakobi/odroid-environment/blob/master/sourcecode/system/vanilla-4.9-debug.conf

You have CONFIG_TRIM_UNUSED_KSYMS enabled - I wonder if that's the issue. I've just enabled that here, and building I see:

Thanks, I had this enabled on purpose since I don't need any out-of-tree drivers for this board.

I'll check if disabling TRIM_UNUSED_KSYMS also does the trick for me.

With best wishes,
Tobias

Quoted 61 lines

EXPORTS lib/lib-ksyms.o

  LD      lib/built-in.o
  CHK     include/generated/autoksyms.h
  KSYMS   symbols: before=0, after=2413, changed=2413
  UPD     include/generated/autoksyms.h

and then the build seems to restart from the very beginning, which seems rather fishy - it doubles the build time of the kernel. The second build doesn't even hit any ccache entries from the first build. Then we get through the rebuild, and I get:

EXPORTS lib/lib-ksyms.o

  LD      lib/built-in.o
  CHK     include/generated/autoksyms.h
  LD      vmlinux.o
...
  LD      vmlinux
  SORTEX  vmlinux
  SYSMAP  System.map

Building modules, stage 2.
OBJCOPY arch/arm/boot/Image
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/head.o
LZO arch/arm/boot/compressed/piggy_data
MODPOST 465 modules
ERROR: CC arch/arm/boot/compressed/misc.o
"_clear_bit" [net/sched/sch_teql.ko] undefined!
ERROR: "_set_bit" [net/sched/sch_teql.ko] undefined!
ERROR: "_set_bit" [net/sched/cls_u32.ko] undefined!
ERROR: "_test_and_set_bit" [net/netfilter/nfnetlink_acct.ko] undefined!
ERROR: "_clear_bit" [net/netfilter/nfnetlink_acct.ko] undefined!
ERROR: "_test_and_clear_bit" [net/mac80211/mac80211.ko] undefined!
ERROR: "_set_bit" [net/mac80211/mac80211.ko] undefined!
ERROR: "_test_and_set_bit" [net/mac80211/mac80211.ko] undefined!
ERROR: "_clear_bit" [net/mac80211/mac80211.ko] undefined!

So yes, it's caused by this ksyms trimming.

Now, the thing is that include/generated/autoksyms.h contains:

#define __KSYM__change_bit 1
#define __KSYM__clear_bit 1
#define __KSYM__set_bit 1
#define __KSYM__test_and_change_bit 1
#define __KSYM__test_and_clear_bit 1
#define __KSYM__test_and_set_bit 1

amongst many other stuff - presumably this is a list of ksyms which should be included, rather than a list of what should be excluded.

I'm afraid that I never saw the patches which changed the way the ksyms stuff worked for the assembly files, and these patches have caused several problems for ARM. I'm not aware of what the changes were, or how the damn exports now work, so I'm currently at a loss what to suggest at the moment, other than to disable CONFIG_TRIM_UNUSED_KSYMS in your configuration until someone can work out wtf is going on.

I guess I'm going to have to work out how this stuff now works - don't expect a solution quickly, especially as building with this option enabled is soo time consuming (like, half an hour per build.)

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#6 lore raw
Quoted 5 lines · Russell King - ARM Linux
Quoted 4 lines · Tobias Jakobi

Hey Russell,

thanks for the quick reply and looking into this!

Quoted 8 lines
Quoted 1 line

Added Nicolas Pitre to Cc since the ksym trim stuff came from him.

Arnd's patch "kbuild: provide include/asm/asm-prototypes.h for ARM" fixes it, but I think it's a mixture of fixes, and partially dependent on some other patches. I don't know what the status of his patch is, but my feeling is that it consists of more than a single fix, and needs splitting. Certainly the asm-prototypes.h is not relevant to this problem, but the rest of it seems to be.

Well... the problem for the current breakage was identified a while ago:

https://lkml.org/lkml/2016/2/10/686

I'm surprised that Al didn't fold my patch into his. Now that this has hit mainline, CONFIG_TRIM_UNUSED_KSYMS is now broken on ARM.

And I don't see how the asm-prototypes.h is going to fix it either (if anything, at the moment it looks like it might be another source of breakage).

So I think the folowing patch should go into mainline:

----- >8

Quoted 1 line

From 3225f625c116a350c54f361df491bf3e1c6d32b3 Mon Sep 17 00:00:00 2001

From: Nicolas Pitre <[email protected]>
Date: Wed, 10 Feb 2016 17:40:04 -0500
Subject: [PATCH] ARM: don't use assembler macro arguments with EXPORT_SYMBOL()

Committ 4dd1837d75 ("arm: move exports to definitions") added EXPORT_SYMBOL(\name) to bitops.h. Here \name is an assembler macro argument which is not subject to preprocessor substitutions. And the assembler doesn't handle preprocessor macros either. That has the effect of breaking CONFIG_TRIM_UNUSED_KSYMS=y.

arch/arm/lib/bitops.h +0 -5
index df06638b32..7d807cfd8e 100644
@@ -1,6 +1,5 @@
 #include <asm/assembler.h>
 #include <asm/unwind.h>
-#include <asm/export.h>
 
 #if __LINUX_ARM_ARCH__ >= 6
 	.macro	bitop, name, instr
@@ -26,7 +25,6 @@ UNWIND(	.fnstart	)
 	bx	lr
 UNWIND(	.fnend		)
 ENDPROC(\name		)
-EXPORT_SYMBOL(\name	)
 	.endm
 
 	.macro	testop, name, instr, store
@@ -57,7 +55,6 @@ UNWIND(	.fnstart	)
 2:	bx	lr
 UNWIND(	.fnend		)
 ENDPROC(\name		)
-EXPORT_SYMBOL(\name	)
 	.endm
 #else
 	.macro	bitop, name, instr
@@ -77,7 +74,6 @@ UNWIND(	.fnstart	)
 	ret	lr
 UNWIND(	.fnend		)
 ENDPROC(\name		)
-EXPORT_SYMBOL(\name	)
 	.endm
 
 /**
@@ -106,6 +102,5 @@ UNWIND(	.fnstart	)
 	ret	lr
 UNWIND(	.fnend		)
 ENDPROC(\name		)
-EXPORT_SYMBOL(\name	)
 	.endm
 #endif
arch/arm/lib/changebit.S +3 -0
index f402786217..1cfdb138d2 100644
@@ -9,7 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/export.h>
 #include "bitops.h"
                 .text
 
 bitop	_change_bit, eor
+
+EXPORT_SYMBOL(_change_bit)
arch/arm/lib/clearbit.S +3 -0
index f6b75fb64d..e901ca5af0 100644
@@ -9,7 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/export.h>
 #include "bitops.h"
                 .text
 
 bitop	_clear_bit, bic
+
+EXPORT_SYMBOL(_clear_bit)
arch/arm/lib/setbit.S +3 -0
index 618fedae4b..3c8b11240f 100644
@@ -9,7 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/export.h>
 #include "bitops.h"
 		.text
 
 bitop	_set_bit, orr
+
+EXPORT_SYMBOL(_set_bit)
arch/arm/lib/testchangebit.S +3 -0
index 4becdc3a59..e3d19b87fb 100644
@@ -9,7 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/export.h>
 #include "bitops.h"
                 .text
 
 testop	_test_and_change_bit, eor, str
+
+EXPORT_SYMBOL(_test_and_change_bit)
arch/arm/lib/testclearbit.S +3 -0
index 918841dcce..d247e6f70f 100644
@@ -9,7 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/export.h>
 #include "bitops.h"
                 .text
 
 testop	_test_and_clear_bit, bicne, strne
+
+EXPORT_SYMBOL(_test_and_clear_bit)
arch/arm/lib/testsetbit.S +3 -0
index 8d1b2fe9e4..76800ff601 100644
@@ -9,7 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/export.h>
 #include "bitops.h"
                 .text
 
 testop	_test_and_set_bit, orreq, streq
+
+EXPORT_SYMBOL(_test_and_set_bit)
#7 lore raw
Quoted 20 lines · Nicolas Pitre
Quoted 5 lines · Russell King - ARM Linux
Quoted 4 lines · Tobias Jakobi

Hey Russell,

thanks for the quick reply and looking into this!

Quoted 8 lines
Quoted 1 line

Added Nicolas Pitre to Cc since the ksym trim stuff came from him.

Arnd's patch "kbuild: provide include/asm/asm-prototypes.h for ARM" fixes it, but I think it's a mixture of fixes, and partially dependent on some other patches. I don't know what the status of his patch is, but my feeling is that it consists of more than a single fix, and needs splitting. Certainly the asm-prototypes.h is not relevant to this problem, but the rest of it seems to be.

Well... the problem for the current breakage was identified a while ago:

https://lkml.org/lkml/2016/2/10/686

Quoted 8 lines

I'm surprised that Al didn't fold my patch into his. Now that this has hit mainline, CONFIG_TRIM_UNUSED_KSYMS is now broken on ARM.

And I don't see how the asm-prototypes.h is going to fix it either (if anything, at the moment it looks like it might be another source of breakage).

So I think the folowing patch should go into mainline:

... which looks the same as Arnd's patch with the following changes:

- no asm-prototypes.h
- adding asm/export.h to each file using EXPORT_SYMBOL() instead of bitops.h
- not touching:
arch/arm/lib/csumpartialcopy.S arch/arm/lib/csumpartialcopygeneric.S arch/arm/lib/csumpartialcopyuser.S

other than that, it's doing the same thing.

I think Arnd's changes to the csumpartial code are unnecessary, and yours is, although larger, puts the asm/export.h include in the right place. So please drop yours into the patch system so we can move forward fixing some of the problems created during the last merge window.

Quoted 146 lines

----- >8

Quoted 1 line

From 3225f625c116a350c54f361df491bf3e1c6d32b3 Mon Sep 17 00:00:00 2001

From: Nicolas Pitre <[email protected]>
Date: Wed, 10 Feb 2016 17:40:04 -0500
Subject: [PATCH] ARM: don't use assembler macro arguments with EXPORT_SYMBOL()

Committ 4dd1837d75 ("arm: move exports to definitions") added EXPORT_SYMBOL(\name) to bitops.h. Here \name is an assembler macro argument which is not subject to preprocessor substitutions. And the assembler doesn't handle preprocessor macros either. That has the effect of breaking CONFIG_TRIM_UNUSED_KSYMS=y.

arch/arm/lib/bitops.h +0 -5
index df06638b32..7d807cfd8e 100644
@@ -1,6 +1,5 @@
 #include <asm/assembler.h>
 #include <asm/unwind.h>
-#include <asm/export.h>
 
 #if __LINUX_ARM_ARCH__ >= 6
 	.macro	bitop, name, instr
@@ -26,7 +25,6 @@ UNWIND(	.fnstart	)
 	bx	lr
 UNWIND(	.fnend		)
 ENDPROC(\name		)
-EXPORT_SYMBOL(\name	)
 	.endm
 
 	.macro	testop, name, instr, store
@@ -57,7 +55,6 @@ UNWIND(	.fnstart	)
 2:	bx	lr
 UNWIND(	.fnend		)
 ENDPROC(\name		)
-EXPORT_SYMBOL(\name	)
 	.endm
 #else
 	.macro	bitop, name, instr
@@ -77,7 +74,6 @@ UNWIND(	.fnstart	)
 	ret	lr
 UNWIND(	.fnend		)
 ENDPROC(\name		)
-EXPORT_SYMBOL(\name	)
 	.endm
 
 /**
@@ -106,6 +102,5 @@ UNWIND(	.fnstart	)
 	ret	lr
 UNWIND(	.fnend		)
 ENDPROC(\name		)
-EXPORT_SYMBOL(\name	)
 	.endm
 #endif
arch/arm/lib/changebit.S +3 -0
index f402786217..1cfdb138d2 100644
@@ -9,7 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/export.h>
 #include "bitops.h"
                 .text
 
 bitop	_change_bit, eor
+
+EXPORT_SYMBOL(_change_bit)
arch/arm/lib/clearbit.S +3 -0
index f6b75fb64d..e901ca5af0 100644
@@ -9,7 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/export.h>
 #include "bitops.h"
                 .text
 
 bitop	_clear_bit, bic
+
+EXPORT_SYMBOL(_clear_bit)
arch/arm/lib/setbit.S +3 -0
index 618fedae4b..3c8b11240f 100644
@@ -9,7 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/export.h>
 #include "bitops.h"
 		.text
 
 bitop	_set_bit, orr
+
+EXPORT_SYMBOL(_set_bit)
arch/arm/lib/testchangebit.S +3 -0
index 4becdc3a59..e3d19b87fb 100644
@@ -9,7 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/export.h>
 #include "bitops.h"
                 .text
 
 testop	_test_and_change_bit, eor, str
+
+EXPORT_SYMBOL(_test_and_change_bit)
arch/arm/lib/testclearbit.S +3 -0
index 918841dcce..d247e6f70f 100644
@@ -9,7 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/export.h>
 #include "bitops.h"
                 .text
 
 testop	_test_and_clear_bit, bicne, strne
+
+EXPORT_SYMBOL(_test_and_clear_bit)
arch/arm/lib/testsetbit.S +3 -0
index 8d1b2fe9e4..76800ff601 100644
@@ -9,7 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/export.h>
 #include "bitops.h"
                 .text
 
 testop	_test_and_set_bit, orreq, streq
+
+EXPORT_SYMBOL(_test_and_set_bit)
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#8 lore raw
Quoted 5 lines · CET Russell King - ARM Linux

- not touching:
arch/arm/lib/csumpartialcopy.S
arch/arm/lib/csumpartialcopygeneric.S
arch/arm/lib/csumpartialcopyuser.S

Quoted 7 lines

other than that, it's doing the same thing.

I think Arnd's changes to the csumpartial code are unnecessary, and yours is, although larger, puts the asm/export.h include in the right place. So please drop yours into the patch system so we can move forward fixing some of the problems created during the last merge window.

Right, the csumpartialcopy*.S changes are no longer needed after commit cc6acc11cad1 ("kbuild: be more careful about matching preprocessed asm ___EXPORT_SYMBOL") solves the problem more generally.

I've submitted a new version of my patch, now just adding the one header file that is needed to get MODVERSIONS back working, plus the second patch for mmiocpy/mmioset to partially revert Al's original change.

Arnd