Skip to content

Commit

Permalink
pinctrl/gpiolib: Mark gpiochips as "used" for LTO
Browse files Browse the repository at this point in the history
GCC's Link Time Optimisation feature can cause the link-to-register
feature of gpiolib to fail - without an explicit reference to the data
it is assumed to be unused, and dropped. Add the "used" attribute to
prevent this.

See: #75

Signed-off-by: Phil Elwell <[email protected]>
  • Loading branch information
pelwell committed Apr 1, 2024
1 parent cf46fe8 commit 17fdfeb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pinctrl/gpiochip.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "gpiolib.h"

#define DECLARE_GPIO_CHIP(name, compatible, iface, size, data) \
GPIO_CHIP_T name ## _chip __attribute__ ((section ("gpiochips"))) = \
GPIO_CHIP_T name ## _chip __attribute__ ((section ("gpiochips"))) __attribute__ ((used)) = \
{ #name, compatible, iface, size, data }

typedef struct GPIO_CHIP_INTERFACE_ GPIO_CHIP_INTERFACE_T;
Expand Down

0 comments on commit 17fdfeb

Please sign in to comment.