Bug 219168 - -Bsymbolic-functions breaks psx_load_syscalls override
Summary: -Bsymbolic-functions breaks psx_load_syscalls override
Status: RESOLVED CODE_FIX
Alias: None
Product: Tools
Classification: Unclassified
Component: libcap (show other bugs)
Hardware: All Linux
: P3 normal
Assignee: Andrew G. Morgan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-16 08:07 UTC by Stas Sergeev
Modified: 2024-08-17 22:28 UTC (History)
1 user (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Stas Sergeev 2024-08-16 08:07:28 UTC
Many build systems (well, ubuntu's one for sure)
add -Wl,-Bsymbolic-functions to LDFLAGS. After that,
libpsx doesn't work as it can't override psx_load_syscalls.

I propose this small hack as a fix:

diff --git a/libcap/Makefile b/libcap/Makefile
index f5dde3e..b23a925 100644
--- a/libcap/Makefile
+++ b/libcap/Makefile
@@ -21,6 +21,10 @@ PSXMAGICOBJ=psx_magic.o
 # Always build libcap sources this way:
 CFLAGS += -fPIC
 
+# Many build systems add -Bsymbolic-functions - remove
+CMA = ,
+LDFLAGS := $(filter-out -Wl$(CMA)-Bsymbolic-functions,$(LDFLAGS))
+
 # The linker magic needed to build a dynamic library as independently
 # executable
 MAGIC=-Wl,-e,__so_start
Comment 1 Andrew G. Morgan 2024-08-17 14:30:40 UTC
What does "$(CMA)" achieve here?
Comment 2 Andrew G. Morgan 2024-08-17 14:32:12 UTC
Oh, never mind. filter-out takes two arguments. I see.
Comment 3 Andrew G. Morgan 2024-08-17 14:44:20 UTC
This was a new one on me:

  https://stackoverflow.com/a/71559422
Comment 5 Stas Sergeev 2024-08-17 22:28:55 UTC
Good, so I filled up this ticket now:
https://bugs.launchpad.net/ubuntu/+source/libcap2/+bug/2077246

Note You need to log in before you can comment on or make changes to this bug.