Bug 1659239 - Default configuration does not compile with ASAN out of the box powerpc64le
Summary: Default configuration does not compile with ASAN out of the box powerpc64le
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: compiler-rt
Version: 29
Hardware: ppc64le
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Tom Stellard
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PPCTracker
TreeView+ depends on / blocked
 
Reported: 2018-12-13 21:09 UTC by dn49i7+hdm8u5shsmcg
Modified: 2019-11-27 20:24 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-27 20:24:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description dn49i7+hdm8u5shsmcg 2018-12-13 21:09:41 UTC
Description of problem:
When compiling with -fsanitize=address, it throws undefined references

I run Fedora 29 Server with XFCE and xfce4-terminal, standard setup environment wise

Version-Release number of selected component (if applicable):


How reproducible:

Steps to Reproduce:
Run
CC=clang CFLAGS="-g -fsanitize=address" make
on some project

will throw undefined references

Actual results:
undefined references to asan functions

Expected results:
compiles without problems

Additional info:

Workaround:

Run
CC=clang CFLAGS="-g -fsanitize=address" LDFLAGS="-L/usr/lib64/clang/7.0.0/lib/ -lclang_rt.asan-powerpc64le" make
on some project

works

Comment 1 Tom Stellard 2018-12-13 21:17:17 UTC
Can you attach the output of `dnf info clang compiler-rt`

Comment 2 dn49i7+hdm8u5shsmcg 2018-12-13 21:24:24 UTC
(In reply to Tom Stellard from comment #1)
> Can you attach the output of `dnf info clang compiler-rt`

Installed Packages
Name         : clang
Version      : 7.0.0
Release      : 2.fc29
Arch         : ppc64le
Size         : 1.7 M
Source       : clang-7.0.0-2.fc29.src.rpm
Repo         : @System
From repo    : fedora
Summary      : A C language family front-end for LLVM
URL          : http://llvm.org
License      : NCSA
Description  : clang: noun
             :     1. A loud, resonant, metallic sound.
             :     2. The strident call of a crane or goose.
             :     3. C-language family front-end toolkit.
             : 
             : The goal of the Clang project is to create a new C, C++, Objective C
             : and Objective C++ front-end for the LLVM compiler. Its tools are built
             : as libraries and designed to be loosely-coupled and extensible.

Name         : compiler-rt
Version      : 7.0.0
Release      : 1.fc29
Arch         : ppc64le
Size         : 19 M
Source       : compiler-rt-7.0.0-1.fc29.src.rpm
Repo         : @System
From repo    : fedora
Summary      : LLVM "compiler-rt" runtime libraries
URL          : http://llvm.org
License      : NCSA or MIT
Description  : The compiler-rt project is a part of the LLVM project. It provides
             : implementation of the low-level target-specific hooks required by
             : code generation, sanitizer runtimes and profiling library for code
             : instrumentation, and Blocks C language extension.

Comment 3 Tom Stellard 2018-12-14 02:53:39 UTC
Can you post the output of this command:
echo 'int main(){}' | clang  -fsanitize=address -x c - -###

Comment 4 dn49i7+hdm8u5shsmcg 2018-12-15 14:05:03 UTC
(In reply to Tom Stellard from comment #3)
> Can you post the output of this command:
> echo 'int main(){}' | clang  -fsanitize=address -x c - -###

clang version 7.0.0 (Fedora 7.0.0-2.fc29)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/clang-7" "-cc1" "-triple" "powerpc64le-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "-" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu" "ppc64le" "-mfloat-abi" "hard" "-target-abi" "elfv2" "-dwarf-column-info" "-debugger-tuning=gdb" "-resource-dir" "/usr/lib64/clang/7.0.0" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/lib64/clang/7.0.0/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdebug-compilation-dir" "%workingdir%" "-ferror-limit" "19" "-fmessage-length" "146" "-fsanitize=address" "-fsanitize-address-use-after-scope" "-fno-assume-sane-operator-new" "-fno-signed-char" "-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-o" "/tmp/--35c8d1.o" "-x" "c" "-" "-faddrsig"
 "/usr/bin/ld" "--hash-style=gnu" "--no-add-needed" "--build-id" "--eh-frame-hdr" "-m" "elf64lppc" "-dynamic-linker" "/lib64/ld64.so.2" "-o" "a.out" "/usr/bin/../lib/gcc/ppc64le-redhat-linux/8/../../../../lib64/crt1.o" "/usr/bin/../lib/gcc/ppc64le-redhat-linux/8/../../../../lib64/crti.o" "/usr/bin/../lib/gcc/ppc64le-redhat-linux/8/crtbegin.o" "-L/usr/bin/../lib/gcc/ppc64le-redhat-linux/8" "-L/usr/bin/../lib/gcc/ppc64le-redhat-linux/8/../../../../lib64" "-L/usr/bin/../lib64" "-L/lib/../lib64" "-L/usr/lib/../lib64" "-L/usr/bin/../lib/gcc/ppc64le-redhat-linux/8/../../.." "-L/usr/bin/../lib" "-L/lib" "-L/usr/lib" "--whole-archive" "/usr/lib64/clang/7.0.0/lib/linux/libclang_rt.asan-powerpc64le.a" "--no-whole-archive" "--dynamic-list=/usr/lib64/clang/7.0.0/lib/linux/libclang_rt.asan-powerpc64le.a.syms" "/tmp/--35c8d1.o" "--no-as-needed" "-lpthread" "-lrt" "-lm" "-ldl" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "/usr/bin/../lib/gcc/ppc64le-redhat-linux/8/crtend.o" "/usr/bin/../lib/gcc/ppc64le-redhat-linux/8/../../../../lib64/crtn.o"


%workingdir% is me stripping out the path

Comment 5 dn49i7+hdm8u5shsmcg 2018-12-15 14:10:25 UTC
Doing echo 'int main(){char* p = 0x32; char d = *p;}' | clang  -fsanitize=address -x c - -

works and compiles with ASAN

here's my Makefile, I don't think it should conflict;

CFLAGS += -Wall -Werror -Wextra -Iinclude
LDFLAGS += 

CFLAGS += `pkg-config --cflags somelib`
LDFLAGS += `pkg-config --libs somelib`

NAME = proj

SRCS = src/file1.c src/file2.c src/file3.c
OBJS = ${SRCS:.c=.o}

$(NAME): $(OBJS)
	$(CC) $(LDFLAGS) $(OBJS) -o $(NAME)

all: $(NAME)

clean:
	$(RM) $(OBJS)

fclean: clean
	$(RM) $(NAME)

.PHONY: all clean fclean

Comment 6 Tom Stellard 2018-12-18 05:20:54 UTC
The problem is that -fsanitize=address is only added to CFLAGS and not LDFLAGS.  When you are doing separate compile and link steps you need to explicitly add the flag to both steps.

Comment 7 Ben Cotton 2019-10-31 20:17:56 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '29'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 29 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Ben Cotton 2019-11-27 20:24:24 UTC
Fedora 29 changed to end-of-life (EOL) status on 2019-11-26. Fedora 29 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.