Closed Bug 1516830 Opened 6 years ago Closed 5 years ago

LLD may require -fPIC for -fstack-protector-strong -Wl,-z,nocopyreloc

Categories

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

Unspecified
FreeBSD
defect

Tracking

(firefox-esr60 unaffected, firefox64 unaffected, firefox65 fix-optional, firefox66 fix-optional)

RESOLVED DUPLICATE of bug 1513605
Tracking Status
firefox-esr60 --- unaffected
firefox64 --- unaffected
firefox65 --- fix-optional
firefox66 --- fix-optional

People

(Reporter: jbeich, Unassigned)

References

Details

(Keywords: regression)

$ c++ -v
FreeBSD clang version 7.0.1 (tags/RELEASE_701/final 349250) (based on LLVM 7.0.1)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin

$ c++ -Wl,--version
LLD 7.0.1 (FreeBSD 349250-1300001) (compatible with GNU linkers)

$ ./mach bootstrap
$ ./mach build
[...]
checking for clock_gettime(CLOCK_MONOTONIC)... no
[...]
mozbuild.frontend.reader.BuildReaderError:
==============================
FATAL ERROR PROCESSING MOZBUILD FILE
==============================
The error occurred while processing the following file:
    mozglue/misc/moz.build
A moz.build file called the error() function.
The error it encountered is:
    No TimeStamp implementation on this platform.  Build will not succeed
Correct the error condition and try again.

$ cat >a.cc
#include <time.h>

int main() {
  struct timespec ts;
  clock_gettime(CLOCK_MONOTONIC, &ts);
  return 0;
}

$ c++ -fstack-protector-strong -Wl,-z,nocopyreloc a.cc
ld: error: unresolvable relocation R_X86_64_PC32 against symbol '__stack_chk_guard'; recompile with -fPIC or remove '-z nocopyreloc'
>>> defined in /lib/libc.so.7
>>> referenced by a.cc
>>>               /tmp/a-850f56.o:(main)
c++: error: linker command failed with exit code 1 (use -v to see invocation)
The error message is telling you that `a.o` was created with the expectation that __stack_chk_guard would be statically linked in, and that __stack_chk_guard is actually available in some shared library.  I don't think this is a linker problem: it's either a problem somewhere in the compiler and/or assembler, or the system setup that should have provided __stack_chk_guard in a statically-linkable library somewhere for the non-PIC case (?).

I can't reproduce anymore.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.