Changeset a3f7b43 for chapter08/gcc.xml
- Timestamp:
- 03/03/2022 04:43:09 PM (2 years ago)
- Branches:
- arm
- Children:
- 426a539
- Parents:
- bd36dc5
- git-author:
- Xi Ruoyao <xry111@…> (02/27/2022 05:04:05 AM)
- git-committer:
- William Harrington <kb0iic@…> (03/03/2022 04:43:09 PM)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter08/gcc.xml
rbd36dc5 ra3f7b43 198 198 some sanity checks:</para> 199 199 200 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 201 href="adjusting.xml" 202 xpointer="xpointer(//*[@os='a'])"/> 203 204 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 205 href="adjusting.xml" 206 xpointer="xpointer(//*[@os='b'])"/> 207 208 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 209 href="adjusting.xml" 210 xpointer="xpointer(//*[@os='c'])"/> 211 212 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 213 href="adjusting.xml" 214 xpointer="xpointer(//*[@os='d'])"/> 215 216 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 217 href="adjusting.xml" 218 xpointer="xpointer(//*[@os='e'])"/> 219 220 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 221 href="adjusting.xml" 222 xpointer="xpointer(//*[@os='f'])"/> 200 <screen><userinput>echo 'int main(){}' > dummy.c 201 cc dummy.c -v -Wl,--verbose &> dummy.log 202 readelf -l a.out | grep ': /lib'</userinput></screen> 203 204 <para>There should be no errors, 205 and the output of the last command will be (allowing for 206 platform-specific differences in the dynamic linker name):</para> 207 208 <screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen> 209 210 <para>Now make sure that we're setup to use the correct start files:</para> 211 212 <screen><userinput>grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log</userinput></screen> 213 214 <para>The output of the last command should be:</para> 223 215 224 216 <screen><computeroutput>/usr/lib/gcc/aarch64-unknown-linux-gnu/&gcc-version;/../../../../lib/crt1.o succeeded … … 233 225 <filename class="directory">/usr/lib</filename> directory.</para> 234 226 235 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 236 href="adjusting.xml" 237 xpointer="xpointer(//*[@os='g'])"/> 227 <para>Verify that the compiler is searching for the correct header 228 files:</para> 238 229 239 230 <screen><userinput>grep -B4 '^ /usr/include' dummy.log</userinput></screen> 240 231 241 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 242 href="adjusting.xml" 243 xpointer="xpointer(//*[@os='h'])"/> 232 <para>This command should return the following output:</para> 244 233 245 234 <screen><computeroutput>#include <...> search starts here: … … 252 241 different than the above, depending on your system architecture.</para> 253 242 254 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 255 href="adjusting.xml" 256 xpointer="xpointer(//*[@os='i'])"/> 257 258 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 259 href="adjusting.xml" 260 xpointer="xpointer(//*[@os='j'])"/> 261 262 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 263 href="adjusting.xml" 264 xpointer="xpointer(//*[@os='k'])"/> 243 <para>Next, verify that the new linker is being used with the correct search paths:</para> 244 245 <screen><userinput>grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'</userinput></screen> 246 247 <para>References to paths that have components with '-linux-gnu' should 248 be ignored, but otherwise the output of the last command should be:</para> 265 249 266 250 <screen><computeroutput>SEARCH_DIR("/usr/aarch64-unknown-linux-gnu/lib64") … … 281 265 SEARCH_DIR("/usr/lib");</computeroutput></screen> 282 266 283 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 284 href="adjusting.xml" 285 xpointer="xpointer(//*[@os='l'])"/> 286 287 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 288 href="adjusting.xml" 289 xpointer="xpointer(//*[@os='m'])"/> 290 291 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 292 href="adjusting.xml" 293 xpointer="xpointer(//*[@os='n'])"/> 294 295 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 296 href="adjusting.xml" 297 xpointer="xpointer(//*[@os='o'])"/> 298 299 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 300 href="adjusting.xml" 301 xpointer="xpointer(//*[@os='p'])"/> 302 303 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 304 href="adjusting.xml" 305 xpointer="xpointer(//*[@os='q'])"/> 306 307 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 308 href="adjusting.xml" 309 xpointer="xpointer(//*[@os='r'])"/> 310 311 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 312 href="adjusting.xml" 313 xpointer="xpointer(//*[@os='s'])"/> 314 315 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 316 href="adjusting.xml" 317 xpointer="xpointer(//*[@os='t'])"/> 318 319 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 320 href="adjusting.xml" 321 xpointer="xpointer(//*[@os='u'])"/> 322 323 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 324 href="adjusting.xml" 325 xpointer="xpointer(//*[@os='v'])"/> 267 <para>Next make sure that we're using the correct libc:</para> 268 269 <screen><userinput>grep "/lib.*/libc.so.6 " dummy.log</userinput></screen> 270 271 <para>The output of the last command should be:</para> 272 273 <screen><computeroutput>attempt to open /usr/lib/libc.so.6 succeeded</computeroutput></screen> 274 275 <para>Make sure GCC is using the correct dynamic linker:</para> 276 277 <screen><userinput>grep found dummy.log</userinput></screen> 278 279 <para>The output of the last command should be (allowing for 280 platform-specific differences in dynamic linker name):</para> 281 282 <screen><computeroutput>found ld-linux-x86-64.so.2 at /usr/lib/ld-linux-x86-64.so.2</computeroutput></screen> 283 284 <para>If the output does not appear as shown above or is not received 285 at all, then something is seriously wrong. Investigate and retrace the 286 steps to find out where the problem is and correct it. <!--The most likely 287 reason is that something went wrong with the specs file adjustment.--> Any 288 issues will need to be resolved before continuing with the process.</para> 289 290 <para>Once everything is working correctly, clean up the test files:</para> 291 292 <screen><userinput>rm -v dummy.c a.out dummy.log</userinput></screen> 326 293 327 294 <para>Finally, move a misplaced file:</para>
Note:
See TracChangeset
for help on using the changeset viewer.