All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/libevent: add -fPIC to CFLAGS when BR2_PIC_PIE is set
@ 2021-09-28 21:36 Ankur Tyagi
  2021-12-28 21:45 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Ankur Tyagi @ 2021-09-28 21:36 UTC (permalink / raw)
  To: buildroot; +Cc: Pierre-Jean Texier, Ankur Tyagi

Otherwise build fails with following error:
Toolchain wrapper executing: '/tools/aarch64-linux-gnu/bin//aarch64-linux-gnu-gcc' '--sysroot' '/home/user/work/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot' '-mabi=lp64' '-fstack-protector-strong' '-fstack-clash-protection' '-mcpu=cortex-a35' '-fPIE' '-Wl,-z,now' '-Wl,-z,relro' '-shared' '.libs/buffer.o' '.libs/bufferevent.o' '.libs/bufferevent_filter.o' '.libs/bufferevent_pair.o' '.libs/bufferevent_ratelim.o' '.libs/bufferevent_sock.o' '.libs/event.o' '.libs/evmap.o' '.libs/evthread.o' '.libs/evutil.o' '.libs/evutil_rand.o' '.libs/evutil_time.o' '.libs/listener.o' '.libs/log.o' '.libs/strlcpy.o' '.libs/select.o' '.libs/poll.o' '.libs/epoll.o' '.libs/signal.o' '-Os' '-g2' '-pthread' '-pthread' '-Wl,-soname' '-Wl,libevent_core-2.1.so.7' '-o' '.libs/libevent_core-2.1.so.7.0.1'
/tools/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/bin/ld: .libs/evmap.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `event_changelist_add_' which may bind externally can not be used when making a shared object; recompile with -fPIC
.libs/evmap.o: in function `evmap_check_integrity_':
/home/user/work/cxos-buildroot/output/build/libevent-2.1.12/evmap.c:1007:(.text+0x13ac): dangerous relocation: unsupported relocation
collect2: error: ld returned 1 exit status
Makefile:1516: recipe for target 'libevent_core.la' failed
make[3]: *** [libevent_core.la] Error 1

Signed-off-by: Ankur Tyagi <ankur.tyagi@gallagher.com>
---
 package/libevent/libevent.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/package/libevent/libevent.mk b/package/libevent/libevent.mk
index 93ba88ca88..dac3b589c0 100644
--- a/package/libevent/libevent.mk
+++ b/package/libevent/libevent.mk
@@ -36,5 +36,10 @@ else
 LIBEVENT_CONF_OPTS += --disable-openssl
 endif
 
+ifeq ($(BR2_PIC_PIE),y)
+LIBEVENT_CFLAGS += -fPIC
+LIBEVENT_CONF_OPTS += CFLAGS="$(LIBEVENT_CFLAGS)"
+endif
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
-- 
2.25.1

###########################################################################
This email is confidential and may contain information subject to legal 
privilege.  If you are not the intended recipient please advise us of our
error by return e-mail then delete this email and any attached files.  
You may not copy, disclose or use the contents in any way.  

The views expressed in this email may not be those of Gallagher Group 
Ltd or subsidiary companies thereof.
###########################################################################
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/libevent: add -fPIC to CFLAGS when BR2_PIC_PIE is set
  2021-09-28 21:36 [Buildroot] [PATCH 1/1] package/libevent: add -fPIC to CFLAGS when BR2_PIC_PIE is set Ankur Tyagi
@ 2021-12-28 21:45 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2021-12-28 21:45 UTC (permalink / raw)
  To: Ankur Tyagi; +Cc: Pierre-Jean Texier, Yann E. MORIN, buildroot

Hello Ankur,

On Wed, 29 Sep 2021 10:36:50 +1300
Ankur Tyagi <ankur.tyagi@gallagher.com> wrote:

> Otherwise build fails with following error:
> Toolchain wrapper executing: '/tools/aarch64-linux-gnu/bin//aarch64-linux-gnu-gcc' '--sysroot' '/home/user/work/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot' '-mabi=lp64' '-fstack-protector-strong' '-fstack-clash-protection' '-mcpu=cortex-a35' '-fPIE' '-Wl,-z,now' '-Wl,-z,relro' '-shared' '.libs/buffer.o' '.libs/bufferevent.o' '.libs/bufferevent_filter.o' '.libs/bufferevent_pair.o' '.libs/bufferevent_ratelim.o' '.libs/bufferevent_sock.o' '.libs/event.o' '.libs/evmap.o' '.libs/evthread.o' '.libs/evutil.o' '.libs/evutil_rand.o' '.libs/evutil_time.o' '.libs/listener.o' '.libs/log.o' '.libs/strlcpy.o' '.libs/select.o' '.libs/poll.o' '.libs/epoll.o' '.libs/signal.o' '-Os' '-g2' '-pthread' '-pthread' '-Wl,-soname' '-Wl,libevent_core-2.1.so.7' '-o' '.libs/libevent_core-2.1.so.7.0.1'
> /tools/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/bin/ld: .libs/evmap.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `event_changelist_add_' which may bind externally can not be used when making a shared object; recompile with -fPIC
> .libs/evmap.o: in function `evmap_check_integrity_':
> /home/user/work/cxos-buildroot/output/build/libevent-2.1.12/evmap.c:1007:(.text+0x13ac): dangerous relocation: unsupported relocation
> collect2: error: ld returned 1 exit status
> Makefile:1516: recipe for target 'libevent_core.la' failed
> make[3]: *** [libevent_core.la] Error 1
> 
> Signed-off-by: Ankur Tyagi <ankur.tyagi@gallagher.com>
> ---
>  package/libevent/libevent.mk | 5 +++++
>  1 file changed, 5 insertions(+)

I have looked at all the patches you have sent to add -fPIC flags in
various packages. However, I don't understand why this would be needed.
I've just tried building libevent on aarch64, and it builds fine, with
BR2_PIC_PIE=y. Also, our autobuilders have not detected anything.

So I'm afraid, you will have to provide more details: which toolchain
is used, which Buildroot configuration, so that we can reproduce the
problem.

I'm for now marking the patches as "Rejected" in our patch tracking
system, but please provide more details so that we can see how to
address it.

Thanks a lot,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2021-12-28 21:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 21:36 [Buildroot] [PATCH 1/1] package/libevent: add -fPIC to CFLAGS when BR2_PIC_PIE is set Ankur Tyagi
2021-12-28 21:45 ` Thomas Petazzoni

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.