1 /* Copyright (C) 2002-2012 Red Hat, Inc.
2 This file is part of elfutils.
3 Written by Ulrich Drepper <drepper@redhat.com>, 2002.
5 This file is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 elfutils is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #include ELFUTILS_HEADER(asm)
34 static const char fname[] = "asm-tst5-out.o";
44 elf_version (EV_CURRENT);
46 Ebl *ebl = ebl_openbackend_machine (EM_386);
49 puts ("cannot open backend library");
53 ctx = asm_begin (fname, ebl, false);
56 printf ("cannot create assembler context: %s\n", asm_errmsg (-1));
60 /* Create 66000 sections. */
61 for (cnt = 0; cnt < 66000; ++cnt)
66 /* Create a unique name. */
67 snprintf (buf, sizeof (buf), ".data.%Zu", cnt);
69 /* Create the section. */
70 scn = asm_newscn (ctx, buf, SHT_PROGBITS, SHF_ALLOC | SHF_WRITE);
73 printf ("cannot create section \"%s\" in output file: %s\n",
74 buf, asm_errmsg (-1));
80 snprintf (buf, sizeof (buf), "%Zu", cnt);
81 if (asm_newsym (scn, buf, sizeof (uint32_t), STT_OBJECT,
84 printf ("cannot create symbol \"%s\": %s\n", buf, asm_errmsg (-1));
89 /* Add some content. */
90 if (asm_adduint32 (scn, cnt) != 0)
92 printf ("cannot create content of section \"%s\": %s\n",
93 buf, asm_errmsg (-1));
99 /* Create the output file. */
100 if (asm_end (ctx) != 0)
102 printf ("cannot create output file: %s\n", asm_errmsg (-1));
108 result = WEXITSTATUS (system ("../src/elflint -q asm-tst5-out.o"));
110 /* We don't need the file anymore. */
113 ebl_closebackend (ebl);