From: Jean THOMAS Date: Thu, 11 Jun 2020 09:49:51 +0000 (+0200) Subject: Make non gram_* symbols local symbols (fixes #2) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2e69ce251444a6c5c8057f3651bb35eddaa1eb02;p=gram.git Make non gram_* symbols local symbols (fixes #2) --- diff --git a/libgram/.gitignore b/libgram/.gitignore index 3adeb9f..b7d34ac 100644 --- a/libgram/.gitignore +++ b/libgram/.gitignore @@ -1,3 +1,5 @@ +libgram.o +libgram.clean.o libgram.a src/*.o src/*.d diff --git a/libgram/Makefile b/libgram/Makefile index 530e83a..3fea0fe 100644 --- a/libgram/Makefile +++ b/libgram/Makefile @@ -6,9 +6,10 @@ CC := $(TRIPLE)-gcc AS := $(TRIPLE)-as OBJCOPY := $(TRIPLE)-objcopy AR := $(TRIPLE)-ar +LD := $(TRIPLE)-ld -CFLAGS := -march=rv32i -mabi=ilp32 -nostdlib -Os -Iinclude -LDFLAGS := -march=rv32i -mabi=ilp32 -nostdlib +CFLAGS := -fvisibility=hidden -march=rv32i -mabi=ilp32 -nostdlib -Os -Iinclude +LDFLAGS := -melf32lriscv -nostdlib all: libgram.a @@ -16,9 +17,13 @@ all: libgram.a $(CC) $(CFLAGS) -c $< -o $@ libgram.a: $(OBJS) - $(AR) rcs $@ $(OBJS) + $(LD) $(LDFLAGS) -r $(OBJS) -o libgram.o + $(OBJCOPY) --localize-hidden libgram.o libgram.clean.o + $(AR) -rcs $@ libgram.clean.o clean: rm -rf $(OBJS) rm -f libgram.a + rm -f libgram.o + rm -f libgram.clean.o .PHONY: clean diff --git a/libgram/include/gram.h b/libgram/include/gram.h index 7440c57..de50a54 100644 --- a/libgram/include/gram.h +++ b/libgram/include/gram.h @@ -15,7 +15,7 @@ struct gramCtx { volatile struct gramPHYRegs *phy; }; -int gram_init(struct gramCtx *ctx, void *ddr_base, void *core_base, void *phy_base); -int gram_memtest(struct gramCtx *ctx); +extern __attribute__((visibility ("default"))) int gram_init(struct gramCtx *ctx, void *ddr_base, void *core_base, void *phy_base); +extern __attribute__((visibility ("default"))) int gram_memtest(struct gramCtx *ctx); #endif /* GRAM_H */