Added clang support
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2020-12-19 22:11:03 +01:00
parent cb6e268252
commit b7d7809437
4 changed files with 29 additions and 13 deletions

View file

@ -1,14 +1,27 @@
---
kind: pipeline
type: docker
name: default
name: build-gcc
steps:
- name: build
image: ubuntu:20.04
commands:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -y gcc make
- make clean
- make
- name: build
image: ubuntu:20.04
commands:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -y gcc make
- make clean
- make CC=gcc CFLAGS="-Wall -Werror -Wno-unknown-warning-option -Wno-packed-bitfield-compat"
---
kind: pipeline
type: docker
name: build-clang
steps:
- name: build
image: ubuntu:20.04
commands:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -y clang make
- make clean
- make CC=clang CFLAGS="-Wall -Werror -Wno-unknown-warning-option -Wno-packed-bitfield-compat"
...

View file

@ -1,11 +1,13 @@
CC=cc
CFLAGS=-Wall -Wno-unknown-warning-option -Wno-packed-bitfield-compat
default: fm10k-dump
fm10k-dump.o: fm10k-dump.c
gcc -c fm10k-dump.c -o fm10k-dump.o -Wall -Wno-packed-bitfield-compat
$(CC) -c fm10k-dump.c -o fm10k-dump.o $(CFLAGS)
fm10k-dump: fm10k-dump.o
gcc fm10k-dump.o -o fm10k-dump -Wall
$(CC) fm10k-dump.o -o fm10k-dump $(CFLAGS)
clean:
-rm -f fm10k-dump

View file

@ -3,7 +3,7 @@
Utility that allows dumping the SPI Flash Non-Volatile Memory of the FM10000 family of cards.
## Requirements
* GCC >= 4.4.0
* GCC >= 4.4.0 or clang
* make
* [fm10k kernel module](https://git.gammaspectra.live/FM10K/fm10k) compiled with UIO.
* `# cd src && make clean && make -j $(nproc) CONFIG_UIO=1 && make install CONFIG_UIO=1`
@ -11,7 +11,8 @@ Utility that allows dumping the SPI Flash Non-Volatile Memory of the FM10000 fam
* If this works an UIO device (`/dev/uio0`) will exist. If not, check your bifurcation settings and/or whether the slot supports 16x PCIe 3.0
## Compilation
* `make clean && make`
* `$ make clean && make`
* You can specify whether to use gcc or clang this way: `$ make CC=gcc` / `$ make CC=clang`
* An executable named `./fm10k-dump` should now exist.
## Usage example

View file

@ -57,7 +57,7 @@
#define FM10K_SPI_HEADER_COMMAND_READ_MANUFACTURER_INFORMATION 0x9F
/* Test for GCC >= 4.4.0, see https://gcc.gnu.org/gcc-4.4/changes.html : Packed bit-fields of type char were not properly bit-packed on many targets prior to GCC 4.4 */
#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 4))
#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 4)) || __clang__
typedef union {
struct {