Skip to content

Bug: QNX toolchain missing pic feature — -fPIC not applied, shared libs fail to link #107

Description

@nradakovic

Description

The QNX toolchain config declares supports_pic (so Bazel produces .pic.o objects) but never defines the pic feature that injects -fPIC. Objects for shared libraries are therefore compiled without -fPIC.

Affected configs

  • aarch64-qnx — build failure
  • x86_64-qnx — latent (missing -fPIC masked by permissive linker)

Analysis results

Actual result

aarch64-unknown-nto-qnx8.0.0-ld: pic_test_lib.pic.o: relocation R_AARCH64_ADR_PREL_PG_HI21
against symbol `_ZTV13PICAwareClass' which may bind externally can not be used when making a
shared object; recompile with -fPIC
ERROR: Build did NOT complete successfully

Expected result

Shared-library objects are compiled with -fPIC and link successfully on both x86_64-qnx and aarch64-qnx.

Root cause

templates/qnx/cc_toolchain_config.bzl.template defined supports_pic_feature but was missing the pic feature present in the Linux template, which adds -fPIC via flag_group(flags = ["-fPIC"], expand_if_available = "pic").

Solution

Add the pic feature (mirroring the Linux config) and register it after supports_pic_feature.

Error Occurrence Rate

Reproducible

How to reproduce

bazel test --config aarch64-qnx //:all_tests (must be run on QQVP)

Supporting Information

No response

Classification

Major

First Affected Release

not released (main)

Last Affected Release

not released (main)

Expected Fixed Release

before release (main)

Category

  • Safety Relevant
  • Security Relevant

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Fields

No fields configured for Bug.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions