Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 917583 - media-libs/x264-0.0.20231114[abi_x86_32] with clang: x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pw_4'; recompile with -fPIC
Summary: media-libs/x264-0.0.20231114[abi_x86_32] with clang: x86_64-pc-linux-gnu-ld: ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
Depends on: 920462
Blocks:
  Show dependency tree
 
Reported: 2023-11-19 07:17 UTC by Alfred Wingate
Modified: 2023-12-21 09:59 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
media-libs/x264-0.0.20220222 build.log (gzip compressed) (x264-0.0.20220222:20231119-070314.log.gz,4.98 KB, application/gzip)
2023-11-19 07:17 UTC, Alfred Wingate
Details
emerge --info (emerge--info.txt,7.71 KB, text/plain)
2023-11-19 07:18 UTC, Alfred Wingate
Details
media-libs/x264-0.0.20231114 build.log (xz compressed) (x264-0.0.20231114.log.xz,3.06 KB, application/x-xz)
2023-11-25 13:12 UTC, Alfred Wingate
Details
Build failure without USE=pic (build.log.gz,3.97 KB, application/x-gzip)
2023-12-21 06:51 UTC, Matthew Marchese
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alfred Wingate 2023-11-19 07:17:40 UTC
Created attachment 875166 [details]
media-libs/x264-0.0.20220222 build.log (gzip compressed)

Compiling ABI_X86=32 media-libs/x264 with clang leads to relocation errors due to text relocations in x86 asm.

This can be worked around with "-z notext" in LDFLAGS. It doesn't make a difference if GNU ld or lld is used.

clang -m32 -mfpmath=sse -o libx264.so.164 common/osdep.o common/base.o common/cpu.o common/tables.o encoder/api.o common/mc-8.o common/predict-8.o common/pixel-8.o common/macroblock-8.o common/frame-8.o common/dct-8.o common/cabac-8.o common/common-8.o common/rectangle-8.o common/set-8.o common/quant-8.o common/deblock-8.o common/vlc-8.o common/mvpred-8.o common/bitstream-8.o encoder/analyse-8.o encoder/me-8.o encoder/ratecontrol-8.o encoder/set-8.o encoder/macroblock-8.o encoder/cabac-8.o encoder/cavlc-8.o encoder/encoder-8.o encoder/lookahead-8.o common/threadpool-8.o common/x86/mc-c-8.o common/x86/predict-c-8.o  common/mc-10.o common/predict-10.o common/pixel-10.o common/macroblock-10.o common/frame-10.o common/dct-10.o common/cabac-10.o common/common-10.o common/rectangle-10.o common/set-10.o common/quant-10.o common/deblock-10.o common/vlc-10.o common/mvpred-10.o common/bitstream-10.o encoder/analyse-10.o encoder/me-10.o encoder/ratecontrol-10.o encoder/set-10.o encoder/macroblock-10.o encoder/cabac-10.o encoder/cavlc-10.o encoder/encoder-10.o encoder/lookahead-10.o common/threadpool-10.o common/x86/mc-c-10.o common/x86/predict-c-10.o common/x86/cpu-a.o common/x86/dct-32-8.o common/x86/pixel-32-8.o common/x86/bitstream-a-8.o common/x86/const-a-8.o common/x86/cabac-a-8.o common/x86/dct-a-8.o common/x86/deblock-a-8.o common/x86/mc-a-8.o common/x86/mc-a2-8.o common/x86/pixel-a-8.o common/x86/predict-a-8.o common/x86/quant-a-8.o common/x86/sad-a-8.o common/x86/dct-32-10.o common/x86/pixel-32-10.o common/x86/bitstream-a-10.o common/x86/const-a-10.o common/x86/cabac-a-10.o common/x86/dct-a-10.o common/x86/deblock-a-10.o common/x86/mc-a-10.o common/x86/mc-a2-10.o common/x86/pixel-a-10.o common/x86/predict-a-10.o common/x86/quant-a-10.o common/x86/sad16-a-10.o  -shared -Wl,-soname,libx264.so.164  -Wl,-Bsymbolic -m32 -Wl,-O1 -Wl,--as-needed -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -lm -lpthread 
x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pw_4'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/deblock-a.asm
>>>               common/x86/deblock-a-10.o:(.text+0x175)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pd_32'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/dct-32.asm
>>>               common/x86/dct-32-10.o:(.text+0xF20)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pd_32'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/mc-a.asm
>>>               common/x86/mc-a-10.o:(.text+0x1A)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pw_pixel_max'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/mc-a.asm
>>>               common/x86/mc-a-10.o:(.text+0x40)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_8_pw_8'; recompile with -fPIC
>>> defined in common/x86/const-a-8.o
>>> referenced by ../x264-master/common/x86/sad-a.asm
>>>               common/x86/sad-a-8.o:(.text+0x1456)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_8_pb_01'; recompile with -fPIC
>>> defined in common/x86/const-a-8.o
>>> referenced by ../x264-master/common/x86/quant-a.asm
>>>               common/x86/quant-a-8.o:(.text+0xBE4)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pw_pixel_max'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/mc-a2.asm
>>>               common/x86/mc-a2-10.o:(.text+0x2B)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_8_pd_1'; recompile with -fPIC
>>> defined in common/x86/const-a-8.o
>>> referenced by ../x264-master/common/x86/quant-a.asm
>>>               common/x86/quant-a-8.o:(.text+0x1000)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_8_pb_1'; recompile with -fPIC
>>> defined in common/x86/const-a-8.o
>>> referenced by ../x264-master/common/x86/predict-a.asm
>>>               common/x86/predict-a-8.o:(.text+0x28)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in common/x86/quant-a-8.o
>>> referenced by ../x264-master/common/x86/quant-a.asm
>>>               common/x86/quant-a-8.o:(.text+0x1096)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_8_pd_1'; recompile with -fPIC
>>> defined in common/x86/const-a-8.o
>>> referenced by ../x264-master/common/x86/quant-a.asm
>>>               common/x86/quant-a-8.o:(.text+0x1140)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pd_1'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/quant-a.asm
>>>               common/x86/quant-a-10.o:(.text+0x2735)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_8_pw_32'; recompile with -fPIC
>>> defined in common/x86/const-a-8.o
>>> referenced by ../x264-master/common/x86/mc-a2.asm
>>>               common/x86/mc-a2-8.o:(.text+0x16)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pd_32'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/dct-32.asm
>>>               common/x86/dct-32-10.o:(.text+0xF70)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pd_1'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/quant-a.asm
>>>               common/x86/quant-a-10.o:(.text+0x283C)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pw_pixel_max'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/dct-32.asm
>>>               common/x86/dct-32-10.o:(.text+0x135F)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pd_1'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/quant-a.asm
>>>               common/x86/quant-a-10.o:(.text+0x2945)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pw_1'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/sad16-a.asm
>>>               common/x86/sad16-a-10.o:(.text+0x104)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pd_32'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/mc-a.asm
>>>               common/x86/mc-a-10.o:(.text+0xEA)

x86_64-pc-linux-gnu-ld: error: relocation R_386_32 cannot be used against symbol 'x264_10_pw_pixel_max'; recompile with -fPIC
>>> defined in common/x86/const-a-10.o
>>> referenced by ../x264-master/common/x86/mc-a.asm
>>>               common/x86/mc-a-10.o:(.text+0x110)

x86_64-pc-linux-gnu-ld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:251: libx264.so.164] Error 1
Comment 1 Alfred Wingate 2023-11-19 07:18:37 UTC
Created attachment 875167 [details]
emerge --info
Comment 2 Alfred Wingate 2023-11-19 07:21:20 UTC
To avoid confusion, GNU ld is used in the build.log is due a unrelated and separate issue which should be addressed by https://github.com/gentoo/gentoo/pull/33893 .

Feeding -fuse-ld=lld explicitly or with updated clang-common uses lld as expected and will fail just the same.
Comment 3 Larry the Git Cow gentoo-dev 2023-11-25 06:47:42 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c10c5092169e066869733e79104be2f3b07334e7

commit c10c5092169e066869733e79104be2f3b07334e7
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-11-25 06:42:21 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-11-25 06:46:38 +0000

    media-libs/x264: add 0.0.20231114
    
    Closes: https://bugs.gentoo.org/917583
    Closes: https://bugs.gentoo.org/918105
    Signed-off-by: Sam James <sam@gentoo.org>

 media-libs/x264/Manifest                 |  1 +
 media-libs/x264/x264-0.0.20231114.ebuild | 74 ++++++++++++++++++++++++++++++++
 media-libs/x264/x264-9999.ebuild         | 22 +++++-----
 3 files changed, 87 insertions(+), 10 deletions(-)
Comment 4 Alfred Wingate 2023-11-25 13:12:10 UTC
Created attachment 875618 [details]
media-libs/x264-0.0.20231114 build.log (xz compressed)

Still occurs
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-13 21:46:15 UTC
I think I asked you this before, but does USE=pic help?
Comment 6 Bartosz Stebel 2023-12-16 14:32:00 UTC
It does fix it for me. I am *not* on the hardened profile.
Comment 7 Alfred Wingate 2023-12-20 03:15:08 UTC
After testing I see that USE="pic" addresses it. Best to enable it unconditionally?
Comment 8 Matthew Marchese Gentoo Infrastructure gentoo-dev 2023-12-21 06:48:39 UTC
A similar thing occurs for my system with media-libs/x264-0.0.20231114 using GNU ld. Setting USE=pic for media-libs/x264 via /etc/portage/package.use/x264 fixed the issue.
Comment 9 Matthew Marchese Gentoo Infrastructure gentoo-dev 2023-12-21 06:51:04 UTC
Created attachment 880107 [details]
Build failure without USE=pic
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-21 06:52:16 UTC
(In reply to Alfred Wingate from comment #7)
> After testing I see that USE="pic" addresses it. Best to enable it
> unconditionally?

Let's do it.
Comment 11 Larry the Git Cow gentoo-dev 2023-12-21 09:57:16 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c5afef162837b40b0c2099eb5d3f8cb68d3d8ed

commit 1c5afef162837b40b0c2099eb5d3f8cb68d3d8ed
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-12-21 08:06:11 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-12-21 09:56:23 +0000

    media-libs/x264: always build as PIC
    
    Linkers are getting stricter. The SSE part wasn't really used anyway,
    just as a hack wrt the incompatibility with pic/asm/sse for x86.
    
    Closes: https://bugs.gentoo.org/917583
    Closes: https://bugs.gentoo.org/918105
    Signed-off-by: Sam James <sam@gentoo.org>

 media-libs/x264/x264-0.0.20231114-r1.ebuild | 74 +++++++++++++++++++++++++++++
 media-libs/x264/x264-9999.ebuild            |  4 +-
 2 files changed, 76 insertions(+), 2 deletions(-)