Opened 2 years ago

Closed 2 years ago

#10977 closed bug (fixed)

Arm: Undeclared indentifier when compiling rts/Linker.c

Reported by: erikd Owned by: erikd
Priority: normal Milestone: 8.0.1
Component: Compiler Version: 7.11
Keywords: rts linker Cc:
Operating System: Unknown/Multiple Architecture: arm
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D1330
Wiki Page:

Description (last modified by erikd)

I have a Jenkins job which builds GHC on armhf and just got this:

rts/Linker.c:6209:21: error:
     error: ‘target_shndx’ undeclared (first use in this function)
        if (oc->sections[target_shndx].kind == SECTIONKIND_OTHER) {
                         ^

rts/Linker.c:6209:21: error:
     note: each undeclared identifier is reported only once for each
     function it appears in
     `gcc' failed in phase `C Compiler'. (Exit code: 1)

Seems this is a result of 04e8366608 and the fix is pretty obvious.

Change History (5)

comment:1 Changed 2 years ago by erikd

This problem is really easy to fix by pulling:

    int target_shndx = shdr[shnum].sh_info;

out of the #ifdef, but that just fixes the most obvious and immediate problem. The real problem is the heavy usage of #ifdef in this file.

For instance, I cannot figure out why in this line

#if defined(DEBUG) || defined(sparc_HOST_ARCH) || defined(ia64_HOST_ARCH) || \
        defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH)

Sparc, Ia64, PowerPC and x86_64 are all included, but i386, Arm and PowerPC64 are not. Furthermore, when someone is working on a new architecture like AArch64, how are they supposed to know whether it should be part of this magical set or not?

comment:2 Changed 2 years ago by erikd

Description: modified (diff)
Summary: Arm: Undeclared indentifier when build un-registerisedArm: Undeclared indentifier when compiling rts/Linker.c

comment:3 Changed 2 years ago by erikd

Differential Rev(s): Phab:D1330

comment:4 Changed 2 years ago by Erik de Castro Lopo <erikd@…>

In 4d6844a/ghc:

rts/Linker.c : Fix armhf build (#10977)

Test Plan: Validate on x86_64, PowerPC and Arm

Reviewers: simonmar, austin, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1330

GHC Trac Issues: #10977

comment:5 Changed 2 years ago by erikd

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.