Skip to content
Snippets Groups Projects
Commit 2cf27d2e authored by Jason Hiser's avatar Jason Hiser :tractor:
Browse files

cleanup for older versions of gcc

parent 5aecd52f
No related branches found
No related tags found
No related merge requests found
Checking pipeline status
all:
cd chopzero_src; make
#if [ -d cgc_spri ]; then cd cgc_spri; make; fi
$(PEDI_HOME)/pedi -m manifest.txt
clean:
cd chopzero_src; make clean
cd examples; make clean
cd demos; make clean
#cd cgc_spri; make clean
chopzero: chopzero.c
gcc chopzero.c -o chopzero -O3
clean:
rm -f chopzero
#include <stdio.h>
#include <assert.h>
#define MAXLINE 1000
int main() {
char linebuf[MAXLINE];
int addr, size;
while (!feof(stdin)) {
int res;
char* resp;
resp=fgets(linebuf, MAXLINE-1, stdin);
assert(resp==NULL || resp==linebuf);
res=sscanf(linebuf, "%x %d", &addr, &size);
assert(res>=0);
if ((size != 0) && (addr != 0)) {
fputs(linebuf, stdout);
}
}
return 0;
}
......@@ -4,7 +4,13 @@ infile=$1
addr=$2
outfile=$3
gcc $infile -nostdlib -Wl,--section-start -Wl,eh_frame_hdr=$addr -Wl,-e -Wl,0x1000 -Wl,--build-id=none -Wl,-T -Wl,${PEASOUP_HOME}/tools/eh_frame_tools/eh_frame.ls -o $outfile -Wl,-Map,$outfile.map -static -no-pie -fno-PIC || exit
# Try gcc with -no-pie option, but some don't support it
# so then try normal gcc
# and if both fail, then we exit with an error code
gcc $infile -nostdlib -Wl,--section-start -Wl,eh_frame_hdr=$addr -Wl,-e -Wl,0x1000 -Wl,--build-id=none -Wl,-T -Wl,${PEASOUP_HOME}/tools/eh_frame_tools/eh_frame.ls -o $outfile -Wl,-Map,$outfile.map -static -no-pie -fno-PIC || \
gcc $infile -nostdlib -Wl,--section-start -Wl,eh_frame_hdr=$addr -Wl,-e -Wl,0x1000 -Wl,--build-id=none -Wl,-T -Wl,${PEASOUP_HOME}/tools/eh_frame_tools/eh_frame.ls -o $outfile -Wl,-Map,$outfile.map -static || \
exit 1
#eu-readelf -S ./a.out
objcopy --rename-section eh_frame_hdr=.eh_frame_hdr --rename-section eh_frame=.eh_frame --rename-section gcc_except_table=.gcc_except_table $outfile
#eu-readelf -S -w ./b.out
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment