Closed Bug 1533760 Opened 6 years ago Closed 4 years ago

Solaris: Text relocation remains against symbol ff_cos_512 referenced in in file x86/fft.o

Categories

(Firefox Build System :: General: Unsupported Platforms, defect, P5)

defect

Tracking

(firefox65 wontfix, firefox85 fixed)

RESOLVED FIXED
85 Branch
Tracking Status
firefox65 --- wontfix
firefox85 --- fixed

People

(Reporter: petr.sumbera, Assigned: petr.sumbera)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0

Steps to reproduce:

/usr/bin/gcc -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-aliasing -ffunction-sections -fdata-sections -fno-math-errno -pthread -pipe -g -O -fno-omit-frame-pointer -funwind-tables -Wall -Wempty-body -Wignored-qualifiers -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wduplicated-cond -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wformat -Wformat-overflow=2 -fPIC -shared -Wl,-h,libmozavcodec.so -o libmozavcodec.so @/builds/psumbera/FIREFOX-TRUNK/obj-x86_64-pc-solaris2.11/media/ffvpx/libavcodec/libmozavcodec_so.list -lpthread -Wl,-z,text -L/builds/psumbera/FIREFOX-TRUNK/obj-x86_64-pc-solaris2.11/dist/bin ../libavutil/libmozavutil.so -lsocket -lm
Text relocation remains referenced
against symbol offset in file
ff_cos_512 0xcb7 x86/fft.o
ff_cos_512 0x1037 x86/fft.o
ff_cos_512 0x13e7 x86/fft.o
ff_cos_512 0x1797 x86/fft.o
ff_cos_256 0xc77 x86/fft.o
ff_cos_256 0xff7 x86/fft.o
ff_cos_256 0x13a7 x86/fft.o
ff_cos_256 0x1757 x86/fft.o
ff_cos_65536 0xe77 x86/fft.o
..

In upstream I see that they use '-mimpure-text' for Solaris (though -fPIC would be probably better but it doesn't work).

And I can do linking with '-mimpure-text' but it cannot be used together with '-Wl,-z,text' which comes probably from old-configure.in.

I can add '-mimpure-text' into media/ffvpx/ffvpxcommon.mozbuild for Solaris. But is there a way to remove '-Wl,-z,text' from LDFLAGS just for ffvpx? Thank you!

Flags: needinfo?(mh+mozilla)

And when I manually remove '-Wl,-z,text' after configure from obj-x86_64-pc-solaris2.11/media/ffvpx/libavcodec/backend.mk after configure part I get following:

22:02.85 media/ffvpx/libavcodec/libmozavcodec.so
22:06.20 TEST-UNEXPECTED-FAIL | check_textrel | libmozavcodec.so | We do not want text relocations in libraries and programs
22:06.22 gmake[4]: *** [/builds/psumbera/FIREFOX-TRUNK/config/rules.mk:670: libmozavcodec.so] Error 1
22:06.22 gmake[4]: *** Deleting file 'libmozavcodec.so'
22:06.22 gmake[3]: *** [/builds/psumbera/FIREFOX-TRUNK/config/recurse.mk:74: media/ffvpx/libavcodec/target] Error 2

There is also possibility not to enable libav_fft on Solaris at all:

--- a/toolkit/moz.configure Tue Mar 05 23:26:52 2019 -0800
+++ b/toolkit/moz.configure Mon Mar 11 06:25:02 2019 -0700
@@ -1494,7 +1494,7 @@
flags = None
if target.kernel == 'WINNT' and target.cpu == 'x86':
flags = ['-DPIC', '-DWIN32']

  •    elif target.cpu == 'x86_64':
    
  •    elif target.cpu == 'x86_64' and target.kernel != 'SunOS':
           if target.kernel == 'Darwin':
               flags = ['-D__x86_64__', '-DPIC', '-DMACHO']
           elif target.kernel == 'WINNT':
    
Component: Untriaged → General: Unsupported Platforms
Product: Firefox → Firefox Build System

That seems reasonable, although I'd add the condition on the else inside the x86_64 branch. But... why isn't the code PIC on solaris?

Flags: needinfo?(mh+mozilla)
Priority: -- → P5

(In reply to Mike Hommey [:glandium] from comment #4)

But... why isn't the code PIC on solaris?

I think it's related to assembler code:

/usr/bin/yasm -o cpuid.o -f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF -Pconfig_unix64.asm -Pdefaults_disabled.asm -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/ -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavcodec/x86/ -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavutil/x86/   /builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavutil/x86/cpuid.asm
media/ffvpx/libavutil/x86/emms.o
/usr/bin/yasm -o emms.o -f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF -Pconfig_unix64.asm -Pdefaults_disabled.asm -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/ -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavcodec/x86/ -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavutil/x86/   /builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavutil/x86/emms.asm
media/ffvpx/libavutil/x86/fixed_dsp.o
/usr/bin/yasm -o fixed_dsp.o -f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF -Pconfig_unix64.asm -Pdefaults_disabled.asm -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/ -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavcodec/x86/ -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavutil/x86/   /builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavutil/x86/fixed_dsp.asm
media/ffvpx/libavutil/x86/float_dsp.o
/usr/bin/yasm -o float_dsp.o -f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF -Pconfig_unix64.asm -Pdefaults_disabled.asm -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/ -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavcodec/x86/ -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavutil/x86/   /builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavutil/x86/float_dsp.asm
media/ffvpx/libavutil/x86/imgutils.o
/usr/bin/yasm -o imgutils.o -f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF -Pconfig_unix64.asm -Pdefaults_disabled.asm -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/ -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavcodec/x86/ -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavutil/x86/   /builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavutil/x86/imgutils.asm
media/ffvpx/libavutil/x86/lls.o
/usr/bin/yasm -o lls.o -f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF -Pconfig_unix64.asm -Pdefaults_disabled.asm -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/ -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavcodec/x86/ -I/builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavutil/x86/   /builds/psumbera/userland-ff-78.2.0/components/desktop/firefox/firefox-78.2.0/media/ffvpx/libavutil/x86/lls.asm

But I don't see anything obvious there... -DPIC seems to be defined there...

Well, all these seems to be: "ELF 64-bit LSB relocatable AMD64 Version 1"...

When looking at ffmpeg upstream I see that Solaris uses linker map file (which was dynamically created using compat/solaris/make_sunver.pl). I'm now able to build it correctly using such map file:

diff -r d104246a039f -r c5024d76cf9b media/ffvpx/libavcodec/moz.build
--- a/media/ffvpx/libavcodec/moz.build  Mon Oct 12 14:27:51 2020 +0200
+++ b/media/ffvpx/libavcodec/moz.build  Thu Nov 05 12:35:09 2020 +0100
@@ -112,4 +112,7 @@
 if CONFIG['OS_TARGET'] != 'WINNT':
     OS_LIBS += ['m']

+if CONFIG['OS_ARCH'] == 'SunOS' and CONFIG['CPU_ARCH'] == 'x86_64':
+    LDFLAGS += ['-Wl,-M,/builds/libavcodec.ver']
+
 include("../ffvpxcommon.mozbuild")

I can propose similar change with statically generated map file.

But now I'm looking at media/ffvpx/libavcodec/moz.build I see:

 SYMBOLS_FILE = 'avcodec.symbols'

What it's media/ffvpx/libavcodec/avcodec.symbols? Isn't this also such map file? How it's supposed to work? Thanks!

Flags: needinfo?(mh+mozilla)

avcodec.symbols is processed by python/mozbuild/mozbuild/action/generate_symbols_file.py into an appropriate file that can be used by the linker (a .def file on Windows, a GNU ld linker script with BFD/gold/lld, a list of symbols for ld64. There is currently nothing for Solaris's linker.

Flags: needinfo?(mh+mozilla)
Assignee: nobody → petr.sumbera
Pushed by mh@glandium.org: https://hg.mozilla.org/integration/autoland/rev/6de0b9494ed9 Solaris should use linker symbols file too r=glandium
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: