public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][PR gdb/23985] Fix libinproctrace.so build
@ 2018-12-14 18:03 Szabolcs Nagy
  2019-01-09 14:51 ` Szabolcs Nagy
  2019-01-30 17:49 ` Pedro Alves
  0 siblings, 2 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2018-12-14 18:03 UTC (permalink / raw)
  To: gdb-patches; +Cc: nd, Pedro Alves

[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]

The IPA objects currently may use gnulib replacement apis, which is
wrong: gnulib is not linked into the produced dso and it cannot be
because it is not built with -fPIC -fvisibility=hidden.

The gnulib replacement detection is broken under cross compilation:
for targets other than *-gnu*, replacements are enabled that depend
on execution time detection. This causes unnecessary build failure
when the target has proper support for the replaced api.

This fix tries to undo the replacements, which is tricky because the
gnulib headers are still used for various compile time fixups and
there is no simple knob in gnulib to only turn the replacements off.

Without this workaround gdb fails to cross build to non-gnu targets:

  ld: tracepoint-ipa.o: in function `gdb_agent_helper_thread(void*)':
  gdb/gdbserver/tracepoint.c:7221: undefined reference to `rpl_strerror'
  ...
  Makefile:434: recipe for target 'libinproctrace.so' failed

gdb/gdbserver/ChangeLog:

2018-12-14  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	PR gdb/23985
	* Makefile.in (IPAGENT_CFLAGS): Add UNDO_GNULIB_CFLAGS.
	(UNDO_GNULIB_CFLAGS): Undo gnulib replacements.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rpl.diff --]
[-- Type: text/x-patch; name="rpl.diff", Size: 760 bytes --]

diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index dfefff9155..b4eb6ca0fb 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -544,9 +544,15 @@ regdat_sh = $(srcdir)/../regformats/regdat.sh
 
 UST_CFLAGS = $(ustinc) -DCONFIG_UST_GDB_INTEGRATION
 
+# Undo gnulib replacements for the IPA shared library build.
+# The gnulib headers are still needed, but gnulib is not linked
+# into the IPA lib so replacement apis don't work.
+UNDO_GNULIB_CFLAGS = -Drpl_strerror=strerror
+
 # Note, we only build the IPA if -fvisibility=hidden is supported in
 # the first place.
 IPAGENT_CFLAGS = $(INTERNAL_CFLAGS) $(UST_CFLAGS) \
+	$(UNDO_GNULIB_CFLAGS) \
 	-fPIC -DIN_PROCESS_AGENT \
 	-fvisibility=hidden
 

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

* Re: [PATCH][PR gdb/23985] Fix libinproctrace.so build
  2018-12-14 18:03 [PATCH][PR gdb/23985] Fix libinproctrace.so build Szabolcs Nagy
@ 2019-01-09 14:51 ` Szabolcs Nagy
  2019-01-30 11:00   ` Szabolcs Nagy
  2019-01-30 17:49 ` Pedro Alves
  1 sibling, 1 reply; 4+ messages in thread
From: Szabolcs Nagy @ 2019-01-09 14:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: nd, Pedro Alves

On 14/12/2018 18:03, Szabolcs Nagy wrote:
> The IPA objects currently may use gnulib replacement apis, which is
> wrong: gnulib is not linked into the produced dso and it cannot be
> because it is not built with -fPIC -fvisibility=hidden.
> 
> The gnulib replacement detection is broken under cross compilation:
> for targets other than *-gnu*, replacements are enabled that depend
> on execution time detection. This causes unnecessary build failure
> when the target has proper support for the replaced api.
> 
> This fix tries to undo the replacements, which is tricky because the
> gnulib headers are still used for various compile time fixups and
> there is no simple knob in gnulib to only turn the replacements off.
> 
> Without this workaround gdb fails to cross build to non-gnu targets:
> 
>   ld: tracepoint-ipa.o: in function `gdb_agent_helper_thread(void*)':
>   gdb/gdbserver/tracepoint.c:7221: undefined reference to `rpl_strerror'
>   ...
>   Makefile:434: recipe for target 'libinproctrace.so' failed
> 
> gdb/gdbserver/ChangeLog:
> 
> 2018-12-14  Szabolcs Nagy  <szabolcs.nagy@arm.com>
> 
> 	PR gdb/23985
> 	* Makefile.in (IPAGENT_CFLAGS): Add UNDO_GNULIB_CFLAGS.
> 	(UNDO_GNULIB_CFLAGS): Undo gnulib replacements.
> 

ping.

shall i try to remove strerror usage from the code instead?
(i think that's a more intrusive change, but less hackish)


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

* Re: [PATCH][PR gdb/23985] Fix libinproctrace.so build
  2019-01-09 14:51 ` Szabolcs Nagy
@ 2019-01-30 11:00   ` Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2019-01-30 11:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: nd, Pedro Alves

On 09/01/2019 14:51, Szabolcs Nagy wrote:
> On 14/12/2018 18:03, Szabolcs Nagy wrote:
>> The IPA objects currently may use gnulib replacement apis, which is
>> wrong: gnulib is not linked into the produced dso and it cannot be
>> because it is not built with -fPIC -fvisibility=hidden.
>>
>> The gnulib replacement detection is broken under cross compilation:
>> for targets other than *-gnu*, replacements are enabled that depend
>> on execution time detection. This causes unnecessary build failure
>> when the target has proper support for the replaced api.
>>
>> This fix tries to undo the replacements, which is tricky because the
>> gnulib headers are still used for various compile time fixups and
>> there is no simple knob in gnulib to only turn the replacements off.
>>
>> Without this workaround gdb fails to cross build to non-gnu targets:
>>
>>   ld: tracepoint-ipa.o: in function `gdb_agent_helper_thread(void*)':
>>   gdb/gdbserver/tracepoint.c:7221: undefined reference to `rpl_strerror'
>>   ...
>>   Makefile:434: recipe for target 'libinproctrace.so' failed
>>
>> gdb/gdbserver/ChangeLog:
>>
>> 2018-12-14  Szabolcs Nagy  <szabolcs.nagy@arm.com>
>>
>> 	PR gdb/23985
>> 	* Makefile.in (IPAGENT_CFLAGS): Add UNDO_GNULIB_CFLAGS.
>> 	(UNDO_GNULIB_CFLAGS): Undo gnulib replacements.
>>
> 
> ping.
> 
> shall i try to remove strerror usage from the code instead?
> (i think that's a more intrusive change, but less hackish)
> 

ping2.

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

* Re: [PATCH][PR gdb/23985] Fix libinproctrace.so build
  2018-12-14 18:03 [PATCH][PR gdb/23985] Fix libinproctrace.so build Szabolcs Nagy
  2019-01-09 14:51 ` Szabolcs Nagy
@ 2019-01-30 17:49 ` Pedro Alves
  1 sibling, 0 replies; 4+ messages in thread
From: Pedro Alves @ 2019-01-30 17:49 UTC (permalink / raw)
  To: Szabolcs Nagy, gdb-patches; +Cc: nd

OK.

Thanks,
Pedro Alves
On 12/14/2018 06:03 PM, Szabolcs Nagy wrote:
> The IPA objects currently may use gnulib replacement apis, which is
> wrong: gnulib is not linked into the produced dso and it cannot be
> because it is not built with -fPIC -fvisibility=hidden.
> 
> The gnulib replacement detection is broken under cross compilation:
> for targets other than *-gnu*, replacements are enabled that depend
> on execution time detection. This causes unnecessary build failure
> when the target has proper support for the replaced api.
> 
> This fix tries to undo the replacements, which is tricky because the
> gnulib headers are still used for various compile time fixups and
> there is no simple knob in gnulib to only turn the replacements off.
> 
> Without this workaround gdb fails to cross build to non-gnu targets:
> 
>   ld: tracepoint-ipa.o: in function `gdb_agent_helper_thread(void*)':
>   gdb/gdbserver/tracepoint.c:7221: undefined reference to `rpl_strerror'
>   ...
>   Makefile:434: recipe for target 'libinproctrace.so' failed
> 
> gdb/gdbserver/ChangeLog:
> 
> 2018-12-14  Szabolcs Nagy  <szabolcs.nagy@arm.com>
> 
> 	PR gdb/23985
> 	* Makefile.in (IPAGENT_CFLAGS): Add UNDO_GNULIB_CFLAGS.
> 	(UNDO_GNULIB_CFLAGS): Undo gnulib replacements.
> 

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

end of thread, other threads:[~2019-01-30 17:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-14 18:03 [PATCH][PR gdb/23985] Fix libinproctrace.so build Szabolcs Nagy
2019-01-09 14:51 ` Szabolcs Nagy
2019-01-30 11:00   ` Szabolcs Nagy
2019-01-30 17:49 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).