aboutsummaryrefslogtreecommitdiff
path: root/tccpp.c
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@celest.fr>2010-03-30 09:45:31 +0200
committerThomas Preud'homme <thomas.preudhomme@celest.fr>2010-04-15 19:30:00 +0200
commit47abdbd3d52a0bf92e907c3e059b5136c140fec2 (patch)
tree5de1473730460b2165455752ddeeadf1432247f0 /tccpp.c
parent6d4166df61adf7513593d91bed12b7a9823d104d (diff)
downloadtinycc-47abdbd3d52a0bf92e907c3e059b5136c140fec2.tar.gz
tinycc-47abdbd3d52a0bf92e907c3e059b5136c140fec2.tar.bz2
Better handle ld scripts
* search file from INPUT and GROUP commands in the library path in addition to the current directory * handle libraries specified by -lfoo options * Search lib in GROUP command repeatedly
Diffstat (limited to 'tccpp.c')
-rw-r--r--tccpp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tccpp.c b/tccpp.c
index 51348cf..f974242 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -378,6 +378,27 @@ static int tcc_peekc_slow(BufferedFile *bf)
}
}
+BufferedFile *tcc_save_buffer_state(int *offset)
+{
+ BufferedFile *state;
+
+ state = tcc_malloc(sizeof(BufferedFile));
+ memcpy(state, file, sizeof(BufferedFile));
+ *offset = lseek(file->fd, 0, SEEK_CUR);
+ return state;
+}
+
+void tcc_load_buffer_state(BufferedFile *buf_state, int offset)
+{
+ memcpy(file, buf_state, sizeof(BufferedFile));
+ lseek(file->fd, offset, SEEK_SET);
+}
+
+void tcc_free_buffer_state(BufferedFile *buf_state)
+{
+ tcc_free(buf_state);
+}
+
/* return the current character, handling end of block if necessary
(but not stray) */
ST_FUNC int handle_eob(void)